Opening a tiff with scale_factor/add_offset attrs then saving as zarr and opening causes a UFuncTypeError #4784
Labels
topic-backends
topic-CF conventions
topic-metadata
Relating to the handling of metadata (i.e. attrs and encoding)
What happened:
When opening a geotiff that has
scale_factor
andadd_offset
metadata and then saving it as a zarr thescale_factor
andadd_offset
attributes are loaded and then saved as strings. When the resulting zarr is opened xarray attempts to apply thescale_factor
andadd_offset
attributes, but raises an exception because they are of type<U32
.What you expected to happen:
scale_factor
andadd_offset
are converted to floats and applied when the tiff is openedscale_factor
andadd_offset
attributes, check their types and/or cast them to floats.Minimal Complete Verifiable Example:
Anything else we need to know?:
Environment:
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.8.6 | packaged by conda-forge | (default, Dec 26 2020, 05:05:16)
[GCC 9.3.0]
python-bits: 64
OS: Linux
OS-release: 5.4.0-1034-azure
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: C.UTF-8
LANG: C.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.6
libnetcdf: 4.7.4
xarray: 0.16.2
pandas: 1.2.0
numpy: 1.19.5
scipy: 1.6.0
netCDF4: 1.5.5.1
pydap: None
h5netcdf: 0.8.1
h5py: 2.10.0
Nio: None
zarr: 2.6.1
cftime: 1.3.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.1.8
cfgrib: None
iris: None
bottleneck: None
dask: 2020.12.0
distributed: 2020.12.0
matplotlib: 3.3.3
cartopy: 0.18.0
seaborn: None
numbagg: None
pint: None
setuptools: 49.6.0.post20201009
pip: 20.3.3
conda: None
pytest: 6.2.1
IPython: 7.19.0
sphinx: None
The text was updated successfully, but these errors were encountered: