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/6272#issuecomment-1039149253,https://api.github.com/repos/pydata/xarray/issues/6272,1039149253,IC_kwDOAMm_X8498CjF,13301940,2022-02-14T14:26:44Z,2022-02-14T14:26:44Z,MEMBER,"@ArcticSnow, > The value z is a float32 which varies from 2000 to -2000 along the time dimension. After being saved in the subsample, z is still a float32 but the values that are less than -1000 are being offset by 44500. You may have `scale_factor` and `add_offset` attributes in your dataset. > However, if I do (ds.z.isel(latitude[1,2,3], longitude=[3,4,5])*1).to_netcdf('sub.nc') There's a chance xarray is discarding the attributes/encoding during the `ds.z.isel(latitude[1,2,3], longitude=[3,4,5])*1` and as a result, netCDF ends up not encoding `z` during the `to_netcdf()` call. What's the output of ```python print(ds.z.encoding) print(ds.z.attrs) ``` ??","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,1136315478