home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where user = 1411854 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date), closed_at (date)

type 1

  • issue 1

state 1

  • closed 1

repo 1

  • xarray 1
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
391168098 MDU6SXNzdWUzOTExNjgwOTg= 2606 Can't decode cf_variable leroygr 1411854 closed 0     1 2018-12-14T16:00:32Z 2018-12-14T16:28:29Z 2018-12-14T16:28:29Z NONE      

Hi,

Problem description

I'm trying to decode a CF variable that contains required keys/values in encoding, but the values are not decoded when calling `xarray.conventions.decode_cf_variable``. I'm using dask arrays because the feature I'm developing is supposed to be scaled with dask.

Code Sample, a copy-pastable example if possible

```python import dask import xarray as xr from numpy import dtype from collections import OrderedDict

name='lsm' encoded_var = xr.Variable(dims=('latitude','longitude'), data=dask.array.from_array([[-11608, 9419, 27983, 32767, 1306], [ 24657, 27490, 12354, 13565, -31678], [ 23286, 19197, -425, -17866, -2387], [ 8284, 22922, 25428, 28584, 29309], [ 21439, 26654, 15559, -2752, -32766]], chunks=(5,5)), attrs=OrderedDict([('long_name', 'Land-sea mask'), ('standard_name', 'land_binary_mask'), ('units', '(0 - 1)')]), encoding={'chunks': (5, 5), '_FillValue': -32767, 'dtype': dtype('int16'), 'scale_factor': 1.0576998063464478e-07, 'add_offset': 0.9965342350445446} ) encoded_var[:].compute() <xarray.Variable (latitude: 5, longitude: 5)> array([[-11608, 9419, 27983, 32767, 1306], [ 24657, 27490, 12354, 13565, -31678], [ 23286, 19197, -425, -17866, -2387], [ 8284, 22922, 25428, 28584, 29309], [ 21439, 26654, 15559, -2752, -32766]]) Attributes: long_name: Land-sea mask standard_name: land_binary_mask units: (0 - 1) ```

Then when trying to decode, I obtain the same values:

python decoded_var = xr.conventions.decode_cf_variable(name, encoded_var) decoded_var[:].compute() <xarray.Variable (latitude: 5, longitude: 5)> array([[-11608, 9419, 27983, 32767, 1306], [ 24657, 27490, 12354, 13565, -31678], [ 23286, 19197, -425, -17866, -2387], [ 8284, 22922, 25428, 28584, 29309], [ 21439, 26654, 15559, -2752, -32766]]) Attributes: long_name: Land-sea mask standard_name: land_binary_mask units: (0 - 1)

Expected Output

``` <xarray.Variable (latitude: 5, longitude: 5)> array([[0.99530005, 0.99752796, 0.99949646, 1. , 0.99667346], [0.9991455 , 0.9994354 , 0.9978484 , 0.99797046, 0.993179 ], [0.99899286, 0.9985656 , 0.99649036, 0.9946439 , 0.9962767 ], [0.9974059 , 0.99896234, 0.9992218 , 0.9995575 , 0.9996338 ], [0.9987945 , 0.99935913, 0.9981841 , 0.99624616, 0.99307215]]) Attributes: long_name: Land-sea mask standard_name: land_binary_mask units: (0 - 1)

```

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.7.final.0 python-bits: 64 OS: Linux OS-release: 4.19.6-1-MANJARO machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 xarray: 0.11.0 pandas: 0.23.4 numpy: 1.14.3 scipy: 1.1.0 netCDF4: 1.4.2 h5netcdf: None h5py: None Nio: None zarr: 2.2.0 cftime: 1.0.2.1 PseudonetCDF: None rasterio: None iris: None bottleneck: None cyordereddict: None dask: 0.20.2 distributed: 1.24.2 matplotlib: 2.2.3 cartopy: 0.16.0 seaborn: None setuptools: 40.6.0 pip: 18.1 conda: None pytest: None IPython: 7.1.1 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2606/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 1197.676ms · About: xarray-datasette