You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I was busy trying to convert Meteo data from MetNordic to a CWatM compatible format, and I found a quirk in the CWatM code that could be perhaps adjusted to make it more clear whats going wrong:
Essentally, I used R package terra and functions project() and writeCDF() to reproject the MetNordic provided .nc file. This function writeCDF() function appends a "crs" variable onto the file.
After that I figured I was ready to feed the file to CWatM, but got a cryptic error message:
File "C:\Users\mosh\Documents\GIT\CWatM\cwatm\management_modules\data_handling.py", line 989, in multinetdf
shapey = nf1.variables[value].shape[1]
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
IndexError: tuple index out of range
The reason for the error turns out to be that it takes the last variable from the netCDF file:
value=list(nf1.variables.items())[-1][0] # get the last variable name
...which in my case was crs and does not have x and y definitions in .shape[1]. Reversing the order of the variables to have crs first and precipitation_amount_sum last fixed the issue.
This could be improved by dropping dimensionless variables, or perhaps an error message explaning the issue?
Its also totally possible that I just totally missed some sort of documentation specifying these requirements....
Anyway, just thought I'd mention it, in case it interests you..
The text was updated successfully, but these errors were encountered:
Hi, I was busy trying to convert Meteo data from MetNordic to a CWatM compatible format, and I found a quirk in the CWatM code that could be perhaps adjusted to make it more clear whats going wrong:
Essentally, I used R package
terra
and functionsproject()
andwriteCDF()
to reproject the MetNordic provided.nc
file. This functionwriteCDF()
function appends a "crs" variable onto the file.I then edited the file to replace the "easting" and "northing" with "x" and "y" (otherwise the CWatM code would break, due to line 982 perhaps?:
CWatM/cwatm/management_modules/data_handling.py
Line 982 in 31ed493
After that I figured I was ready to feed the file to CWatM, but got a cryptic error message:
The reason for the error turns out to be that it takes the last variable from the netCDF file:
CWatM/cwatm/management_modules/data_handling.py
Line 981 in 31ed493
...which in my case was
crs
and does not have x and y definitions in.shape[1]
. Reversing the order of the variables to havecrs
first andprecipitation_amount_sum
last fixed the issue.This could be improved by dropping dimensionless variables, or perhaps an error message explaning the issue?
Its also totally possible that I just totally missed some sort of documentation specifying these requirements....
Anyway, just thought I'd mention it, in case it interests you..
The text was updated successfully, but these errors were encountered: