home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 991042526

This data as json

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/6055#issuecomment-991042526 https://api.github.com/repos/pydata/xarray/issues/6055 991042526 IC_kwDOAMm_X847Ehve 3383837 2021-12-10T14:59:29Z 2021-12-10T15:25:11Z CONTRIBUTOR

@dcherian Chiming in as the author of TileDB-Inc/TileDB-CF-py#117. To help ensure the tiledb backend matches the behavior of xr.open_dataset for netCDF files, can you help me understand why the promotion to float does NOT occur in the following case:

``` import netCDF4 import xarray as xr import numpy as np

filename = 'temp_file.nc' with netCDF4.Dataset(filename, mode="w") as group: group.createDimension("index", 4) var = group.createVariable("var", np.int16, ("index",)) var[0:3] = np.array([5, 6, 7], dtype=np.int16) dataset = xr.open_dataset(filename) dataset["var"].dtype ```

Note that netCDF.default_fillvalues['i2'] is the value found at dataset["var"][3], which was never explicitly written. Here XArray seems to ignore the fill value.

Update

Okay, I think I understand why. In createVariable whether I use the default fill_value=None or set fill_value=False, XArray does not include _FillValue in dataset["var"].encoding. That, I think, is a bug. If you print(var) with fill_value=None, you'll see that NetCDF is setting the _FIllValue attribute. I don't think XArray should ignore it.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  1075765204
Powered by Datasette · Queries took 0.758ms · About: xarray-datasette