html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/issues/3476#issuecomment-1205346130,https://api.github.com/repos/pydata/xarray/issues/3476,1205346130,IC_kwDOAMm_X85H2B9S,44444001,2022-08-04T14:36:26Z,2022-08-04T14:36:26Z,NONE,"@delgadom I just noticed that your proposed solution has the side effect of also converting `cftime` objects (e.g., below) to unicode strings. ``` xarray.DataArray 'time' (time: 1) array([cftime.DatetimeNoLeap(2007, 7, 2, 12, 0, 0, 0, has_year_zero=True)], dtype=object) ``` I updated your lines using @Hoeze' clear function and that seems to work for now. ```[python] for v in list(ds.coords.keys()): if ds.coords[v].dtype == object: ds[v].encoding.clear() for v in list(ds.variables.keys()): if ds[v].dtype == object: ds[v].encoding.clear() ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,516306758 https://github.com/pydata/xarray/issues/3476#issuecomment-1012775218,https://api.github.com/repos/pydata/xarray/issues/3476,1012775218,IC_kwDOAMm_X848Xbky,17399794,2022-01-14T04:53:36Z,2022-01-14T04:53:36Z,NONE,"Thanks for that, looks like I just came across this.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,516306758 https://github.com/pydata/xarray/issues/3476#issuecomment-841692487,https://api.github.com/repos/pydata/xarray/issues/3476,841692487,MDEyOklzc3VlQ29tbWVudDg0MTY5MjQ4Nw==,1200058,2021-05-15T16:56:00Z,2021-05-15T17:03:00Z,NONE,"Hi, I also keep running into this issue all the time. Right now, there is no way of round-tripping `xr.open_zarr().to_zarr()`, also because of https://github.com/pydata/xarray/issues/5219. The only workaround that seems to help is the following: ```python to_store = xrds.copy() for var in to_store.variables: to_store[var].encoding.clear() ```","{""total_count"": 3, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,516306758 https://github.com/pydata/xarray/issues/3476#issuecomment-630863198,https://api.github.com/repos/pydata/xarray/issues/3476,630863198,MDEyOklzc3VlQ29tbWVudDYzMDg2MzE5OA==,624352,2020-05-19T14:38:26Z,2020-05-19T14:38:26Z,NONE,"I ran into the same issue. It seems like zarr is inserting `VLenUTF8` as a filter, but the loaded data array already has that as a filter so it's trying to double encode . So another workaround is to delete the filters on `site_code`: ``` import xarray as xr sm_from_zarr = xr.open_zarr('tmp/test_sm_zarr') del sm_from_zarr.site_code.encoding[""filters""] sm_from_zarr.to_zarr('tmp/test_sm_zarr_from', mode='w') ```","{""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,516306758 https://github.com/pydata/xarray/issues/3476#issuecomment-620090096,https://api.github.com/repos/pydata/xarray/issues/3476,620090096,MDEyOklzc3VlQ29tbWVudDYyMDA5MDA5Ng==,11967971,2020-04-27T16:22:35Z,2020-04-27T16:22:35Z,NONE,"I'm experiencing the same issue, which seems to be also related to one of my coordinates having object as datatype. Luckily, the workaround proposed by @jsadler2 works in my case, too.","{""total_count"": 2, ""+1"": 2, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,516306758 https://github.com/pydata/xarray/issues/3476#issuecomment-550044335,https://api.github.com/repos/pydata/xarray/issues/3476,550044335,MDEyOklzc3VlQ29tbWVudDU1MDA0NDMzNQ==,6943441,2019-11-05T22:07:20Z,2019-11-05T22:07:20Z,NONE,"Sure ``` In [5]: print(ds) <xarray.Dataset> Dimensions: (datetime: 20, site_code: 20) Coordinates: * datetime (datetime) datetime64[ns] 1970-01-01 ... 1970-01-01T19:00:00 * site_code (site_code) object '01302020' '01303000' ... '01315000' Data variables: streamflow (datetime, site_code) float64 dask.array<shape=(20, 20), chunksize=(20, 20)> ```","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,516306758