import rioxarray
local_file = "/tmp/c_gls_NDVI_202004010000_GLOBE_PROBAV_V3.0.1.nc"
with rioxarray.open_rasterio(local_file) as src:
print(src.data_vars)
remote_file = "https://globalland.vito.be/download/netcdf/ndvi/ndvi_1km_v3_10daily/2020/20200401/c_gls_NDVI_202004010000_GLOBE_PROBAV_V3.0.1.nc"
with rioxarray.open_rasterio(remote_file) as src:
print(src.data_vars)
Problem description
Loading netCDF files containing a time dimension fails when the file is located on a 'remote' source. For remote sources, like HTTP but also NFS shares, the NETCDF_DIM_time_VALUES tag is not set. This raises the following exception:
Traceback (most recent call last):
File "/home/stijn/PycharmProjects/scratch/rioxarray_bug.py", line 8, in <module>
with rioxarray.open_rasterio(remote_file) as src:
File "/home/stijn/PycharmProjects/scratch/.venv/lib/python3.10/site-packages/rioxarray/_io.py", line 1147, in open_rasterio
subdataset_result = _load_subdatasets(
File "/home/stijn/PycharmProjects/scratch/.venv/lib/python3.10/site-packages/rioxarray/_io.py", line 829, in _load_subdatasets
rioda: DataArray = open_rasterio( # type: ignore
File "/home/stijn/PycharmProjects/scratch/.venv/lib/python3.10/site-packages/rioxarray/_io.py", line 1192, in open_rasterio
coords = _load_netcdf_1d_coords(attrs)
File "/home/stijn/PycharmProjects/scratch/.venv/lib/python3.10/site-packages/rioxarray/_io.py", line 609, in _load_netcdf_1d_coords
dim_values = _parse_netcdf_attr_array(tags[f"NETCDF_DIM_{dim_name}_VALUES"])
KeyError: 'NETCDF_DIM_time_VALUES'
Code Sample, a copy-pastable example if possible
Problem description
Loading netCDF files containing a time dimension fails when the file is located on a 'remote' source. For remote sources, like HTTP but also NFS shares, the
NETCDF_DIM_time_VALUES
tag is not set. This raises the following exception:Related topics in GDAL repository:
Expected Output
Environment Information
Installation method