diff --git a/atlite/datasets/era5.py b/atlite/datasets/era5.py index 786e31b4..b70b311f 100644 --- a/atlite/datasets/era5.py +++ b/atlite/datasets/era5.py @@ -361,15 +361,6 @@ def retrieve_data(product, chunks=None, tmpdir=None, lock=None, **updates): logger.debug(f"Adding finalizer for {target}") weakref.finalize(ds._file_obj._manager, noisy_unlink, target) - # Remove default encoding we get from CDSAPI, which can lead to NaN values after loading with subsequent - # saving due to how xarray handles netcdf compression (only float encoded as short int seem affected) - # Fixes issue by keeping "float32" encoded as "float32" instead of internally saving as "short int", see: - # https://stackoverflow.com/questions/75755441/why-does-saving-to-netcdf-without-encoding-change-some-values-to-nan - # and hopefully fixed soon (could then remove), see https://github.com/pydata/xarray/issues/7691 - for v in ds.data_vars: - if ds[v].encoding["dtype"] == "int16": - ds[v].encoding.clear() - return ds diff --git a/pyproject.toml b/pyproject.toml index 4a098ca4..6b6612d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ dependencies = [ "pandas>=0.25", "bottleneck", "numexpr", - "xarray>=0.20", + "xarray>=2024.03.0", "netcdf4", "dask>=2021.10.0", "toolz", @@ -116,4 +116,4 @@ ignore = [ 'D415', # First line should end with a period, question mark, or exclamation point 'D417', # Missing argument descriptions in the docstring -] \ No newline at end of file +]