Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utilities/data_conversion /csv2catchmentnetcdf.py fails if 'Time' is name in csv #710

Closed
Ben-Choat opened this issue Jan 18, 2024 · 0 comments · Fixed by #711
Closed

utilities/data_conversion /csv2catchmentnetcdf.py fails if 'Time' is name in csv #710

Ben-Choat opened this issue Jan 18, 2024 · 0 comments · Fixed by #711

Comments

@Ben-Choat
Copy link
Contributor

Short description explaining the high-level reason for the new issue.

I needed to convert forcing .csv files to a netcdf forcing and it was failing.

Current behavior

Executing csv2catchmentnetcdf.py fails with ValueError when attempting to convert csv forcings to a netcdf forcing.

'''
ngen/utilities/data_conversion/csv2catchmentnetcdf.py -i forcing -o forcing.nc -j 2
'''

results in:
ValueError(Date column Time already in dict)

Expected behavior

'''
ngen/utilities/data_conversion/csv2catchmentnetcdf.py -i forcing -o forcing.nc -j 2
'''
results in forcing.nc file containing values that were in the cat-##.csv in the /forcing folder.

Steps to replicate behavior (include URLs)

  1. have folder 'forcing' with appropriate forcing csv files, where one of the columns in the csvs is name 'Time'
  2. run ngen/utilities/data_conversion/csv2catchmentnetcdf.py -i forcing -o forcing.nc -j 2

Screenshots

image

Ben-Choat added a commit to Ben-Choat/ngen_Calib_CFE_TOPMODEL that referenced this issue Jan 18, 2024
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.
@program-- program-- linked a pull request Apr 8, 2024 that will close this issue
11 tasks
hellkite500 pushed a commit that referenced this issue May 6, 2024
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant