-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
UnboundLocalError when opening netCDF file #1781
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
Comments
I've got a reproducible example of this (sorry for the length): In [1]: import xarray as xr
...: import numpy as np
...: import pandas as pd
...: import netCDF4 In [2]: xr.show_versions()
In [3]: nds = netCDF4.Dataset('test.nc', 'w', format='NETCDF4') In [4]: nds.createDimension('X', 3)
...: nds.createVariable('X', str, ('X', ), fill_value='invalid')
...: nds.createVariable('xname', str, ('X', ), fill_value='invalid')
...: nds.createVariable('var1', np.float32, ('X', ), fill_value=np.nan)
...:
...: nds.variables['X'][:] = np.array(['first', 'second', 'third'])
...: nds.variables['xname'][:] = np.array(['the_first', 'invalid', 'the_third'])
...: nds.variables['var1'][:] = np.random.random((3, )) In [5]: nds.variables['X']
In [6]: nds.variables['X'][:]
In [7]: nds.variables['xname']
In [8]: nds.variables['xname'][:]
In [9]: nds.variables['var1']
In [10]: nds.variables['var1'][:]
In [11]: nds.close() In [12]: ds = xr.open_dataset('test.nc')
This seems to be produced by the fact that |
5 tasks
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code Sample, a copy-pastable example if possible
Problem description
An UnboundLocalError exception is raised while trying to open a netCDF file on a specific group ('
/PRODUCT
'). Opening the file within another group works fine.The same file can be correctly opened with the netCDF4 library.
Expected Output
File correctly loaded.
Output of
xr.show_versions()
xarray: 0.10.0
pandas: 0.20.1
numpy: 1.12.1
scipy: 0.19.0
netCDF4: 1.2.4
h5netcdf: 0.5.0
Nio: None
bottleneck: 1.2.1
cyordereddict: None
dask: 0.15.3
matplotlib: 2.1.0
cartopy: 0.15.1
seaborn: 0.8.1
setuptools: 27.2.0
pip: 9.0.1
conda: 4.3.29
pytest: 3.0.7
IPython: 5.3.0
sphinx: 1.5.6
The text was updated successfully, but these errors were encountered: