home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 547373923

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
547373923 MDU6SXNzdWU1NDczNzM5MjM= 3675 Dataset.expand_dims expands dimensions on coordinate bounds 1991007 closed 0     2 2020-01-09T10:03:08Z 2020-01-09T11:03:22Z 2020-01-09T11:03:22Z NONE      

MCVE Code Sample

```python import xarray as xr

ds = xr.Dataset({'data': ('x', [1, 2]), 'x': ('x', [1, 2]), 'x_bnds': (('x', 'bnds'), [[0.5, 1.5], [1.5, 2.5]])}) ds['x'].attrs['bounds'] = 'x_bnds' ds = ds.expand_dims({'time': [0]}) ```

Output: <xarray.Dataset> Dimensions: (bnds: 2, time: 1, x: 2) Coordinates: * time (time) int64 0 * x (x) int64 1 2 Dimensions without coordinates: bnds Data variables: data (time, x) int64 1 2 x_bnds (time, x, bnds) float64 0.5 1.5 1.5 2.5

Expected Output

<xarray.Dataset> Dimensions: (bnds: 2, time: 1, x: 2) Coordinates: * time (time) int64 0 * x (x) int64 1 2 Dimensions without coordinates: bnds Data variables: data (time, x) int64 1 2 x_bnds (x, bnds) float64 0.5 1.5 1.5 2.5

Problem Description

Dataset.expand_dims expands dimensions on coordinate bounds (referenced via the bounds attribute of a coordinate variable). Since coordinates are not expanded I would expect their bounds to remain unchanged, too. At the moment you'd have to expand dimensions before adding bounds to achieve that.

Output of xr.show_versions()

``` INSTALLED VERSIONS ------------------ commit: None python: 3.7.2 (default, Mar 15 2019, 15:45:45) [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] python-bits: 64 OS: Linux OS-release: 3.10.0-957.12.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 libhdf5: 1.10.4 libnetcdf: 4.6.3 xarray: 0.14.1 pandas: 0.25.3 numpy: 1.17.4 scipy: None netCDF4: 1.5.3 pydap: None h5netcdf: 0.7.4 h5py: 2.10.0 Nio: None zarr: 2.3.2 cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.9.0 distributed: None matplotlib: 3.1.2 cartopy: None seaborn: None numbagg: None setuptools: 40.6.2 pip: 18.1 conda: None pytest: 5.3.2 IPython: 7.10.2 sphinx: None ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3675/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

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