home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 330464740

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/1576#issuecomment-330464740 https://api.github.com/repos/pydata/xarray/issues/1576 330464740 MDEyOklzc3VlQ29tbWVudDMzMDQ2NDc0MA== 206773 2017-09-19T08:16:43Z 2017-09-19T08:16:43Z NONE

@shoyer

We currently decode anything with a _FillValue attribute to float, ...

I believe this fact is surprising for any user of integer/index/enum/classification datasets. Since its justification seems to be an implementation detail which comes at the cost of increased memory and CPU consumption I suggest documenting it in open_dataset() and decode_cf() functions.

Here is how we overcome this issue by deleting the _FillValue attribute of integer variables if their scale_factor and add_offset attributes are not provided:

ds = xr.open_dataset(path, decode_cf=False)
old_fill_values = unset_fill_value_for_int_vars(ds)
ds = xr.decode_cf(ds)
reset_fill_value_for_int_vars(ds, old_fill_values)

where old_fill_values is a mapping of variable names to fill values.

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