Reputation: 25
I am simply trying to open a netcdf file with the following line of code:
ds = xr.open_dataset('file.nc')
But I get the following warning message:
/sw/rhel6-x64/python/python-3.5.2-gcc49/lib/python3.5/site-packages/xarray-0.9.5-py3.5.egg/xarray/conventions.py:389: RuntimeWarning: Unable to decode time axis into full numpy.datetime64 objects, continuing using dummy netCDF4.datetime objects instead, reason: dates out of range result = decode_cf_datetime(example_value, units, calendar)
The file is pretty big and contains yearly data from 1850 to 2849.
Does anyone know of a solution?
Upvotes: 1
Views: 1217
Reputation: 2097
The file is pretty big and contains yearly data from 1850 to 2849.
This is the crucial detail. This means that some of the times are outside the range of what can be represented by nanosecond-precision np.datetime64
values -- this range is approximately between years 1678 to 2262 -- and so xarray falls back on representing the times using an array of another kind of datetime (hence the warning). In earlier versions of xarray, functionality was quite limited with these types of datetime objects, but in the present version this functionality is much improved. For that reason I recommend upgrading to the latest versions of the xarray and netCDF4 packages. I think you'll find that while you will still get a similar warning when opening the file, you will be able to do just about everything that you were able to do with an index of np.datetime64
values.
Hopefully that helps! I know this is a bit of a confusing issue; see a little more discussion about this here.
Upvotes: 2