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

vic2netcdf standard memory mode error #62

Open
ghost opened this issue Mar 28, 2017 · 0 comments
Open

vic2netcdf standard memory mode error #62

ghost opened this issue Mar 28, 2017 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 28, 2017

I'm using vic2netcf to convert the ascii data files into a netcdf file. However, there is an error when using standard memory mode, where the data cannot be inserted into the NetCDF variable.

Traceback (most recent call last):
File "/home/scott/venv/tonic/bin/vic_utils", line 4, in
import('pkg_resources').run_script('tonic===0.0.0.dev-190aca2', 'vic_utils')
File "/home/scott/venv/tonic/lib/python3.5/site-packages/pkg_resources/init.py", line 743, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/scott/venv/tonic/lib/python3.5/site-packages/pkg_resources/init.py", line 1505, in run_script
exec(script_code, namespace, namespace)
File "/home/scott/venv/tonic/lib/python3.5/site-packages/tonic-0.0.0.dev_190aca2-py3.5.egg/EGG-INFO/scripts/vic_utils", line 221, in
File "/home/scott/venv/tonic/lib/python3.5/site-packages/tonic-0.0.0.dev_190aca2-py3.5.egg/EGG-INFO/scripts/vic_utils", line 197, in main
File "/home/scott/venv/tonic/lib/python3.5/site-packages/tonic-0.0.0.dev_190aca2-py3.5.egg/tonic/models/vic/vic2netcdf.py", line 512, in _run
File "/home/scott/venv/tonic/lib/python3.5/site-packages/tonic-0.0.0.dev_190aca2-py3.5.egg/tonic/models/vic/vic2netcdf.py", line 861, in vic2nc
File "/home/scott/venv/tonic/lib/python3.5/site-packages/tonic-0.0.0.dev_190aca2-py3.5.egg/tonic/models/vic/vic2netcdf.py", line 462, in nc_add_data_standard
File "netCDF4/_netCDF4.pyx", line 4074, in netCDF4._netCDF4.Variable.setitem (netCDF4/_netCDF4.c:46416)
ValueError: cannot reshape array of size 70858 into shape (35429,2,2)

The problem is coming from Segment.nc_add_data_standard() when assinging the 2d array to the variable on line 462 as it's iterating over all combinations of (ys,xs) which is not the same size as data.

self.f.variables[name][:, ys, xs] = data

ghost pushed a commit to scotthavens/tonic that referenced this issue Mar 28, 2017
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

0 participants