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

open_rasterio fails on NetCDF files with non-standard time units #316

Closed
ricardog opened this issue Apr 22, 2021 · 4 comments · Fixed by #319
Closed

open_rasterio fails on NetCDF files with non-standard time units #316

ricardog opened this issue Apr 22, 2021 · 4 comments · Fixed by #319
Labels
bug Something isn't working

Comments

@ricardog
Copy link

Code Sample

NOTE: The dataset is available from the LUH2 site.

import rioxarray as rxr
rxr.open_rasterio('multiple-states_input4MIPs_landState_ScenarioMIP_UofMD-MESSAGE-ssp245-2-1-f_gn_2015-2100.nc')

Problem description

The LUH2 datasets have a non-standard time units (years since 2015-01-01 0:0:0) which causes open_rasterio() to fail with an exception. The error message suggest passing the flag decode_times=False or installing cftime. Neither approach solved the problem for me.

It would be great if rioxarray had the equivalent of decode_times for datasets like this one.

Caveat: I don't get an exception when opening the file remotely via http:// You will need to download the file and run it locally.

Expected Output

open_rasterio() succeeds.

Environment Information

rioxarray (0.3.1) deps:
  rasterio: 1.2.2
    xarray: 0.17.0
      GDAL: 3.2.2

Other python deps:
     scipy: 1.6.2
    pyproj: 3.0.1

Installation method

  • pypi

Packages

Package           Version
----------------- ---------
affine            2.3.0
attrs             20.3.0
blosc             1.9.2
bokeh             2.3.1
certifi           2020.12.5
cftime            1.4.1
click             7.1.2
click-plugins     1.1.1
cligj             0.7.1
cloudpickle       1.6.0
cycler            0.10.0
dask              2021.4.0
distributed       2021.4.0
fsspec            2021.4.0
HeapDict          1.0.1
Jinja2            2.11.3
kiwisolver        1.3.1
locket            0.2.1
lz4               3.1.1
MarkupSafe        1.1.1
matplotlib        3.4.1
msgpack           1.0.0
netCDF4           1.5.6
numpy             1.18.1
packaging         20.9
pandas            1.2.4
partd             1.2.0
Pillow            8.2.0
pip               21.0.1
psutil            5.8.0
pyflakes          2.3.1
pyparsing         2.4.7
pyproj            3.0.1
python-dateutil   2.8.1
pytz              2021.1
PyYAML            5.4.1
rasterio          1.2.2
rioxarray         0.3.1
scipy             1.6.2
setuptools        56.0.0
six               1.15.0
snuggs            1.4.7
sortedcontainers  2.3.0
tblib             1.7.0
toolz             0.11.1
tornado           6.1
typing-extensions 3.7.4.3
wheel             0.36.2
xarray            0.17.0
zict              2.0.0
@ricardog ricardog added the bug Something isn't working label Apr 22, 2021
@snowman2
Copy link
Member

I think adding the decode_times argument make sense.

@snowman2
Copy link
Member

Will need to add it to:

  • rasterio engine here
  • open_rasterio here

@snowman2
Copy link
Member

Fix in #319

@ricardog
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants