Problem
When importing any dataset from this package, I encountered the following errors:
KeyError: [<class 'netCDF4._netCDF4.Dataset'>, ('./env/lib/python3.12/site-packages/agrifoodpy_data/land/data/UKCEH_LC_1000.nc',), 'r', (('clobber', True), ('diskless', False), ('format', 'NETCDF4'), ('persist', False))]
During handling of the above exception, another exception occurred:
OSError: [Errno -101] NetCDF: HDF error: './env/lib/python3.12/site-packages/agrifoodpy_data/land/data/UKCEH_LC_1000.nc'
Solution
The solution I found was to explicitly set the xarray engine to h5netcdf, such that:
xr.open_dataset("./env/lib/python3.12/site-packages/agrifoodpy_data/land/data/UKCEH_LC_1000.nc",
engine="h5netcdf",
)
Request
Please change the agrifoodpy-data/agrifoodpy_data/*/__init__.py files to contain:
with xr.open_dataset(_data_file, engine="h5netcdf") as data:
I would also request that the setup.py is updated to explicitly include the following packages as I had to install them after agrifoodpy-data has been installed due to additional errors when loading data:
INSTALL_REQUIRES = [
...
'hdf5',
'cftime'
]
Problem
When importing any dataset from this package, I encountered the following errors:
Solution
The solution I found was to explicitly set the xarray engine to
h5netcdf, such that:Request
Please change the
agrifoodpy-data/agrifoodpy_data/*/__init__.pyfiles to contain:I would also request that the
setup.pyis updated to explicitly include the following packages as I had to install them afteragrifoodpy-datahas been installed due to additional errors when loading data: