Skip to content

Error when oppening netcdf file with open_mfdataset #2804

@mada0007

Description

@mada0007

Code Sample, a copy-pastable example if possible

dset = xr.open_mfdataset('/Users/mada0007/Desktop/Spi1_data/*.nc',autoclose=True)
spi_all  =  dset['pr'][:,:,:]
spi_lat   =  dset['lat'][:]
spi_lon   =  dset['lon'][:]

this is my error message

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/backends/api.py", line 637, in open_mfdataset
    datasets = [open_(p, **open_kwargs) for p in paths]
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/backends/api.py", line 344, in open_dataset
    ds = maybe_decode_store(store)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/backends/api.py", line 274, in maybe_decode_store
    drop_variables=drop_variables)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/conventions.py", line 461, in decode_cf
    decode_coords, drop_variables=drop_variables)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/conventions.py", line 394, in decode_cf_variables
    stack_char_dim=stack_char_dim)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/conventions.py", line 300, in decode_cf_variable
    var = coder.decode(var, name=name)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/coding/times.py", line 412, in decode
    dtype = _decode_cf_datetime_dtype(data, units, calendar)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/coding/times.py", line 131, in _decode_cf_datetime_dtype
    raise ValueError(msg)
ValueError: unable to decode time units u'days since 0001-01-01' with calendar u'days since 0001-01-01'. Try opening your dataset with decode_times=False. Full traceback:
Traceback (most recent call last):
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/coding/times.py", line 122, in _decode_cf_datetime_dtype
    result = decode_cf_datetime(example_value, units, calendar)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/coding/times.py", line 192, in decode_cf_datetime
    flat_num_dates.astype(np.float), units, calendar)
  File "/Users/mada0007/anaconda3/envs/Research_ass/lib/python2.7/site-packages/xarray/coding/times.py", line 92, in _decode_datetime_with_cftime
    only_use_cftime_datetimes=True))
  File "cftime/_cftime.pyx", line 265, in cftime._cftime.num2date
  File "cftime/_cftime.pyx", line 730, in cftime._cftime.utime.__init__
######ValueError: calendar must be one of ['standard', 'gregorian', 'proleptic_gregorian', 'noleap', 'julian', 'all_leap', '365_day', '366_day', '360_day'], got 'days since 0001-01-01'

Problem description

trying to open this netcdf files which was writtend by me, code not working at all expecting ext

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.15 | packaged by conda-forge | (default, Feb 27 2019, 20:44:16) [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 18.2.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: None LOCALE: None.None libhdf5: 1.10.2 libnetcdf: 4.6.1 xarray: 0.11.3 pandas: 0.24.1 numpy: 1.16.2 scipy: 1.2.1 netCDF4: 1.4.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.3.4 PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None cyordereddict: None dask: 1.1.3 distributed: None matplotlib: 2.2.3 cartopy: 0.17.0 seaborn: None setuptools: 40.8.0 pip: 19.0.3 conda: None pytest: None IPython: None sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs mcvehttps://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reportsusage question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions