Skip to content

Commit

Permalink
Merge pull request #33 from LabSid-USP/28-Arquivos-csv-resultantes-se…
Browse files Browse the repository at this point in the history
…m-header

28-Arquivos-csv-resultantes-sem-header
  • Loading branch information
soaressgabriel authored Jul 15, 2021
2 parents 306699b + c3d2234 commit cd63960
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Visual Studio Code project settings
.vscode

# JetBrains PyCharm project settings
.idea

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
3 changes: 2 additions & 1 deletion rubem.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ def dynamic(self):
# Check whether the generation of time series has been activated
if genTss:
print("RUBEM::Converting *.tss files to *.csv...", end=" ", flush=True)
cols = [str(n) for n in myModel.sample_vals[1:]]
# Convert generated time series to .csv format and removes .tss files
tss2csv(myModel.outpath)
tss2csv(myModel.outpath, cols)
print("OK", flush=True) # Converting *.tss files to *.csv...

print("RUBEM::Finished", flush=True)
4 changes: 2 additions & 2 deletions utilities/file_convertions.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def tif2map(path):
pass


def tss2csv(tssPath):
def tss2csv(tssPath, colNames):
"""Convert all PCRaster Time Series (*.tss) files present in the specified directory to (*.csv).
:param path: Directory containing the files.
Expand All @@ -62,7 +62,7 @@ def tss2csv(tssPath):
csvFileName = splitext(tssFile)[0] + ".csv"

# Export csv file
df.to_csv(csvFileName, sep=",", header=None)
df.to_csv(csvFileName, sep=",", header=colNames)

# Remove tss files
eraseFiles(tssFileList)
Expand Down

0 comments on commit cd63960

Please sign in to comment.