id,node_id,number,title,user,state,locked,assignee,milestone,comments,created_at,updated_at,closed_at,author_association,active_lock_reason,draft,pull_request,body,reactions,performed_via_github_app,state_reason,repo,type 782440858,MDU6SXNzdWU3ODI0NDA4NTg=,4784,Opening a tiff with scale_factor/add_offset attrs then saving as zarr and opening causes a UFuncTypeError,53100696,closed,0,,,4,2021-01-08T22:45:21Z,2024-02-06T10:40:15Z,2024-02-06T10:40:14Z,NONE,,,," **What happened**: When opening a geotiff that has `scale_factor` and `add_offset` metadata and then saving it as a zarr the `scale_factor` and `add_offset` attributes are [loaded](https://github.com/pydata/xarray/blob/5296ed18272a856d478fbbb3d3253205508d1c2d/xarray/backends/rasterio_.py#L280) and then saved as strings. When the resulting zarr is opened xarray attempts to [apply](https://github.com/pydata/xarray/blob/569a4da18229aed391886ef768132f3d6d64fb30/xarray/coding/variables.py#L245) the `scale_factor` and `add_offset` attributes, but raises an exception because they are of type ` 220 data *= scale_factor 221 if add_offset is not None: 222 data += add_offset UFuncTypeError: Cannot cast ufunc 'multiply' output from dtype('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 ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4784/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue