Open PerrineFreydier opened 5 months ago
Could you post the error message you've been getting? That build _2
was generated from a libgdal 3.8 rebuild at https://github.com/conda-forge/rasterio-feedstock/pull/289. I'm wondering if there are some other dependencies (e.g. hdf5
) you'll need to upgrade/reinstall to be compatible with libgdal3.8 too.
I have this error message
Hmm ok, I found that KeyError: 'NETCDF_DIM_time_VALUES'
mentioned at https://github.com/corteva/rioxarray/issues/174#issuecomment-1879892161 and https://github.com/mdsumner/ghrsst.coop/issues/3#issuecomment-1868437012, but not sure if those are related. Could you copy and paste the output of rioxarray.show_versions()
(as text rather than a screenshot)? It might be that you have some incompatible netcdf4 version and need to upgrade.
Also, just checking if you are opening the NetCDF from a remote HTTP url? Also, what is the structure inside your NetCDF file (e.g. number of dimensions).
Ok, so
rioxarray.show_versions()
rioxarray` (0.15.0) deps:
rasterio: 1.3.9
xarray: 2023.12.0
GDAL: 3.8.2
GEOS: 3.12.1
PROJ: 9.3.1
PROJ DATA: C:\Users\freydier\AppData\Local/proj;C:\Users\freydier\AppData\Local\anaconda3\envs\conda_scientifique_05janv2024V2\Library/share/proj;D:/bld/proj_1701484245271/_h_env/Library/share/proj
GDAL DATA: C:\Users\freydier\AppData\Local\anaconda3\envs\conda_scientifique_05janv2024V2\Library\share\gdal
Other python deps: scipy: 1.11.4 pyproj: 3.6.1 rioxarray.show_versions() System: python: 3.11.5 | packaged by conda-forge | (main, Aug 27 2023, 03:23:48) [MSC v.1936 64 bit (AMD64)] executable: C:\Users\freydier\AppData\Local\anaconda3\envs\conda_scientifique_05janv2024V2\python.exe machine: Windows-10-10.0.19045-SP0
I downloaded my file from https://www.gloh2o.org/mswep/ , then I open it from my hard drive My netcdf file is organizing as following :
file='198101.nc' test = Dataset(file, 'r') print(test.variables.keys())
dict_keys(['lon', 'lat', 'time', 'precipitation'])
test["time"]
<class 'netCDF4._netCDF4.Variable'>
int32 time(time)
units: days since 1900-1-1 00:00:00
long_name: time
unlimited dimensions: time
current shape = (1,)
filling on, default _FillValue of -2147483647 used
Solution to issue cannot be found in the documentation.
Issue
This function
myfile=whatever.nc mydata = rioxarray.open_rasterio(myfile)
doesn't work in my environnement that I created with the command conda install conda-forge::rasterio
But, if specify in the command, rasterio=1.3.9=py311hd1b6236_0, then, the rioxarray.open_rasterio function works.
So, it seems that the problem comes from the specific version of rasterio that is automatically generated by the conda-forge channel. It takes the py311h02f6225_2 instead of the py311hd1b6236_0
My configuration with the environnment that doesn't work : rioxarray 0.15.0 pyhd8ed1ab_0 conda-forge rasterio 1.3.9 py311h02f6225_2 conda-forge gdal 3.8.2 py311hff9a05f_1 conda-forge python 3 11 5 Windows-10-10.0.19045-SP0
Installation method : I both tried in a command line conda create -n myenv python=3.11 numpy jupyter geopandas shapely pyrosm stonesoup gpxpy pandas xarray rasterio rasterstats rioxarray hvplot plotly geoviews osmnx pyarrow folium seaborn xlsxwriter geojson python-kaleido or with a yml file :
name: myenv channels:
conda-forge defaults dependencies: python=3.11.5 numpy jupyter geopandas shapely pyrosm stonesoup gpxpy pandas xarray rasterio rasterstats rioxarray hvplot plotly geoviews osmnx pyarrow folium seaborn xlsxwriter geojson python-kaleido
Installed packages
Environment info