Skip to content

Commit

Permalink
Update csv2catchmentnetcdf.py issue #710
Browse files Browse the repository at this point in the history
Address issue #710. 

In line 79, when parsing the date column, using the dictionary, as was done before this edit, pandas attempts to parse the column at index 0, to a column 'Time'. So, if 'Time' is already a column the error in issue #710  is produced.

The proposed change assumes column at  index  0 is the date column, but works despite the name.
  • Loading branch information
Ben-Choat authored and hellkite500 committed May 6, 2024
1 parent dd66466 commit a53a32a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utilities/data_conversion/csv2catchmentnetcdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def process_sublist(data : dict, lock: Lock, num: int):
#load the csv data
print("Process ", num, " reading file", csv_file)

df = pd.read_csv(join(input_path,csv_file), parse_dates={"Time": [0]}, na_values=[" nan"])
df = pd.read_csv(join(input_path,csv_file), parse_dates=[0], na_values=[" nan"])

if first:
ds = create_partial_netcdf(netcdf_path + "." + str(num), num_inputs, df.columns)
Expand Down Expand Up @@ -181,4 +181,4 @@ def main():


if __name__ == "__main__":
main()
main()

0 comments on commit a53a32a

Please sign in to comment.