home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 520306672

This data as json

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
520306672 MDExOlB1bGxSZXF1ZXN0MzM4OTE5MTg1 3502 Harmonize `FillValue` and `missing_value` during encoding and decoding steps 13301940 closed 0     7 2019-11-09T01:07:25Z 2019-12-11T20:09:15Z 2019-11-14T01:22:51Z MEMBER   0 pydata/xarray/pulls/3502

As pointed out in https://github.com/jbusecke/cmip6_preprocessing/issues/5, xarray appears to be very strict during the encoding and decoding steps even when there are (harmless) discrepancies between missing_value and _FillValue. For instance, when dtypes of missing_value and _FillValue are different, xarray gives up:

```python In [74]: from xarray.coding import variables

In [75]: import numpy as np

In [76]: import xarray as xr

In [77]: original = xr.Variable( ...: ("x",), ...: [0.0, -1.0, 1.0], ...: encoding={"_FillValue": np.float32(1e20), "missing_value": np.float64(1e20)}, ...: )

In [78]: coder = variables.CFMaskCoder()

In [79]: encoded = coder.encode(original)

ValueError Traceback (most recent call last) <ipython-input-79-9fbc3632e28b> in <module> ----> 1 encoded = coder.encode(original)

/glade/work/abanihi/devel/pangeo/xarray/xarray/coding/variables.py in encode(self, variable, name) 156 raise ValueError( 157 "Variable {!r} has multiple fill values {}. " --> 158 "Cannot encode data. ".format(name, [fv, mv]) 159 ) 160

ValueError: Variable None has multiple fill values [1e+20, 1e+20]. Cannot encode data. ```

  • [ ] Closes #xxxx
  • [x] Tests added
  • [x] Passes black . && mypy . && flake8
  • [x] Fully documented, including whats-new.rst for all changes and api.rst for new API
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3502/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 7 rows from issue in issue_comments
Powered by Datasette · Queries took 0.611ms · About: xarray-datasette