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

Potential bug in 4-d variable output for standard memory mode #56

Open
anewman89 opened this issue May 24, 2016 · 1 comment
Open

Potential bug in 4-d variable output for standard memory mode #56

anewman89 opened this issue May 24, 2016 · 1 comment

Comments

@anewman89
Copy link

anewman89 commented May 24, 2016

When running vic2netcdf, an error occurs when outputting 4-d variables (e.g. soil moisture) using the standard memory mode.

I used the "standard" option and got an error. If I tried to include soil moisture in the configuration file I got the following error when the code tries to write to the netcdf files after it loads all the files in the current chunk:

Traceback (most recent call last):
File "./bin/vic_utils", line 5, in
pkg_resources.run_script('tonic==0.0.0.dev-2bf5167', 'vic_utils')
File "/glade/apps/opt/python/2.7.7/gnu-westmere/4.8.2/lib/python2.7/site-packages/pkg_resources.py", line 534, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/glade/apps/opt/python/2.7.7/gnu-westmere/4.8.2/lib/python2.7/site-packages/pkg_resources.py", line 1441, in run_script
exec(script_code, namespace, namespace)
File "./lib/python2.7/site-packages/tonic-0.0.0.dev_2bf5167-py2.7.egg/EGG-INFO/scripts/vic_utils", line 221, in
File "./lib/python2.7/site-packages/tonic-0.0.0.dev_2bf5167-py2.7.egg/EGG-INFO/scripts/vic_utils", line 197, in main
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 546, in _run
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 896, in vic2nc
File "build/bdist.linux-x86_64/egg/tonic/models/vic/vic2netcdf.py", line 459, in nc_add_data_standard
File "netCDF4.pyx", line 3267, in netCDF4.Variable.setitem (netCDF4.c:39658)
ValueError: total size of new array must be unchanged

I traced it back to line ~448:

self.f.variables[name][:, i, ys, xs]

is looking for something that is 2-dimensional while

p.df[sn].values[self.slice]

is only 1 dimensional with a length set at the number of time steps going into the current netcdf file. If I removed soil moisture in the configuration file, I got this option to output properly, so it is an issue with 4-d variables.

@anewman89
Copy link
Author

@bartnijssen Does this issue give enough description, have proper formatting, etc?

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

No branches or pull requests

1 participant