Skip to content

Commit

Permalink
Update csv2catchmentnetcdf.py issue NOAA-OWP#710
Browse files Browse the repository at this point in the history
Address issue NOAA-OWP#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 NOAA-OWP#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 Jan 18, 2024
1 parent 025efa0 commit 3576523
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 3576523

Please sign in to comment.