home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

2 rows where repo = 13221727, type = "issue" and user = 11731042 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 · 2 ✖

state 1

  • closed 2

repo 1

  • xarray · 2 ✖
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
574015429 MDU6SXNzdWU1NzQwMTU0Mjk= 3819 expand_dims changes attrs and encoding of coordinate variable jfpiolle 11731042 closed 0     3 2020-03-02T14:33:30Z 2020-07-02T22:00:03Z 2020-07-02T22:00:02Z NONE      

Expanding the dimensions of a variable with a dimension having the same name as a coordinate variable will also change the attributes (including encoding attributes) of this coordinate variable!

The following examples prints the attrs and encoding of coordinate variable time before/after expanding the dimensions of the variable sea_surface_temperature

```python import xarray as xr import numpy as np

grid = xr.Dataset({ 'time': (('time',), [np.datetime64('2018-01-01')]), 'lat': (('lat'), np.arange(-80, 80, 1)), 'lon': (('lon',), np.arange(-180, 180, 1)), 'sea_surface_temperature': (('lat', 'lon',), np.ones(shape=(160, 360))) })

grid['time'].encoding['units'] = 'seconds since 1981-01-01 00:00:00' grid['time'].attrs['comment'] = 'some comment'

print(grid['time'].encoding, grid['time'].attrs) grid['sea_surface_temperature'] = grid['sea_surface_temperature'].expand_dims('time', axis=0) print(grid['time'].encoding, grid['time'].attrs)

``` The current output is:

{'units': 'seconds since 1981-01-01 00:00:00'} {'comment': 'some comment'} {} {}

Expected Output

I would not expect any change to other coordinates or variables than the expanded one (here sea_surface_temperature)

{'units': 'seconds since 1981-01-01 00:00:00'} {'comment': 'some comment'} {'units': 'seconds since 1981-01-01 00:00:00'} {'comment': 'some comment'}

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.8.1 (default, Jan 8 2020, 22:29:32) [GCC 7.3.0] python-bits: 64 OS: Linux OS-release: 4.15.0-72-generic machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: fr_FR.UTF-8 LOCALE: fr_FR.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.7.3 xarray: 0.15.0 pandas: 1.0.1 numpy: 1.18.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.11.0 distributed: 2.11.0 matplotlib: None cartopy: None seaborn: None numbagg: None setuptools: 45.2.0.post20200210 pip: 20.0.2 conda: None pytest: None IPython: None sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3819/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
457874038 MDU6SXNzdWU0NTc4NzQwMzg= 3034 open_mfdataset fails on variable attributes with 'list' type jfpiolle 11731042 closed 0     6 2019-06-19T08:25:23Z 2019-08-04T17:41:32Z 2019-08-04T17:41:32Z NONE      

Using open_mfdataset on a series of netcdf files having variable attributes with type list will fail with the following exception, when these attributes have different values from one file to another:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

ncf = xarray.open_mfdataset(files) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/backends/api.py", line 658, in open_mfdataset ids=ids) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 553, in _auto_combine data_vars=data_vars, coords=coords) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 474, in _combine_nd compat=compat) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 492, in _auto_combine_all_along_first_dim data_vars, coords) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 510, in _auto_combine_1d for id, ds_group in grouped_by_vars] File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 368, in _auto_concat return concat(datasets, dim=dim, data_vars=data_vars, coords=coords) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 122, in concat return f(objs, dim, data_vars, coords, compat, positions) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/combine.py", line 307, in _dataset_concat combined = concat_vars(vars, dim, positions) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/variable.py", line 1982, in concat return Variable.concat(variables, dim, positions, shortcut) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/variable.py", line 1433, in concat utils.remove_incompatible_items(attrs, var.attrs) File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/utils.py", line 184, in remove_incompatible_items not compat(first_dict[k], second_dict[k]))): File "/home/ananda/jfpiolle/miniconda2/envs/cerbere/lib/python2.7/site-packages/xarray/core/utils.py", line 133, in equivalent (pd.isnull(first) and pd.isnull(second))) ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

An example of such variable is provided below:

double sea_ice_fraction(time) ; sea_ice_fraction:least_significant_digit = 2LL ; sea_ice_fraction:_FillValue = 1.e+20 ; sea_ice_fraction:long_name = "sea ice fraction" ; sea_ice_fraction:standard_name = "sea_ice_fraction" ; sea_ice_fraction:authority = "CF 1.7" ; sea_ice_fraction:units = "1" ; sea_ice_fraction:coverage_content_type = "auxiliaryInformation" ; sea_ice_fraction:coordinates = "time lon lat" ; sea_ice_fraction:source = "CCI Sea Ice" ; sea_ice_fraction:institution = "ESA" ; string sea_ice_fraction:source_files = "ice_conc_nh_ease2-250_cdr-v2p0_199912011200.nc", "ice_conc_sh_ease2-250_cdr-v2p0_199912011200.nc" ;

The exception will occur when the source_files attribute have a different values in the file time series I am trying to concatenate. I had to use the preprocess argument to remove first this attribute to avoid this exception.

This is caused by the equivalent method in xarray/core/utils.py that does not account for this case:

python def equivalent(first, second): """Compare two objects for equivalence (identity or equality), using array_equiv if either object is an ndarray """ # TODO: refactor to avoid circular import from . import duck_array_ops if isinstance(first, np.ndarray) or isinstance(second, np.ndarray): return duck_array_ops.array_equiv(first, second) else: return ((first is second) or (first == second) or (pd.isnull(first) and pd.isnull(second)))

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3034/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 94.358ms · About: xarray-datasette