home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

4 rows where comments = 6 and user = 43316012 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 2

  • issue 2
  • pull 2

state 2

  • closed 3
  • open 1

repo 1

  • xarray 4
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
1368900431 PR_kwDOAMm_X84-u2Jv 7020 Typing of abstract base classes headtr1ck 43316012 open 0     6 2022-09-11T10:27:01Z 2023-01-19T10:48:20Z   COLLABORATOR   0 pydata/xarray/pulls/7020

This PR adds some typing to several abstract base classes that are used in xarray.

Most of it is working, only one major point I could not figure out:

What is the type of NDArrayMixin.array??? I would appreciate it if someone that has more insight into this would help me.

Several minor open points:

  • What is the return value of ExplicitlyIndexed.__getitem__
  • What is the return value of ExplicitlyIndexed.transpose
  • What is the return value of AbstractArray.data
  • Variable.values seems to be able to return scalar values which is incompatible with the AbstractArray definition.

Overall it seems that typing has helped to find some problems again :)

Mypy should fail for tests, I did not adopt them yet, want to solve the outstanding issues first.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7020/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1377097243 PR_kwDOAMm_X84_J8JL 7051 Add parse_dims func headtr1ck 43316012 closed 0     6 2022-09-18T15:36:59Z 2022-12-08T20:10:01Z 2022-11-30T23:36:33Z COLLABORATOR   0 pydata/xarray/pulls/7051

This PR adds a utils.parse_dims function for parsing one or more dimensions. Currently every function that accepts multiple dimensions does this by itself.

I decided to first see if it would be useful to centralize the dimension parsing and collect inputs before adding it to other functions.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7051/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1120405560 I_kwDOAMm_X85CyAg4 6229 [Bug]: rename_vars to dimension coordinate does not create an index headtr1ck 43316012 closed 0     6 2022-02-01T09:09:50Z 2022-09-27T09:33:42Z 2022-09-27T09:33:42Z COLLABORATOR      

What happened?

We used Data{set,Array}.rename{_vars}({coord: dim_coord}) to make a coordinate a dimension coordinate (instead of set_index). This results in the coordinate correctly being displayed as a dimension coordinate (with the *) but it does not create an index, such that further operations like sel fail with a strange KeyError.

What did you expect to happen?

I expect one of two things to be true:

  1. rename{_vars} does not allow setting dimension coordinates (raises Error and tells you to use set_index)
  2. rename{_vars} checks for this occasion and sets the index correctly

Minimal Complete Verifiable Example

```python import xarray as xr

data = xr.DataArray([5, 6, 7], coords={"c": ("x", [1, 2, 3])}, dims="x")

<xarray.DataArray (x: 3)>

array([5, 6, 7])

Coordinates:

c (x) int64 1 2 3

Dimensions without coordinates: x

data_renamed = data.rename({"c": "x"})

<xarray.DataArray (x: 3)>

array([5, 6, 7])

Coordinates:

* x (x) int64 1 2 3

data_renamed.indexes

Empty

data_renamed.sel(x=2)

KeyError: 'no index found for coordinate x'

if we use set_index it works

data_indexed = data.set_index({"x": "c"})

looks the same as data_renamed!

<xarray.DataArray (x: 3)>

array([1, 2, 3])

Coordinates:

* x (x) int64 1 2 3

data_indexed.indexes

x: Int64Index([1, 2, 3], dtype='int64', name='x')

```

Relevant log output

No response

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS

commit: None python: 3.9.1 (default, Jan 13 2021, 15:21:08) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.49.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.0 libnetcdf: 4.7.4

xarray: 0.20.2 pandas: 1.3.5 numpy: 1.21.5 scipy: 1.7.3 netCDF4: 1.5.8 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.5.1.1 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.5.1 cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 49.2.1 pip: 22.0.2 conda: None pytest: 6.2.5 IPython: 8.0.0 sphinx: None

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6229/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
932677183 MDU6SXNzdWU5MzI2NzcxODM= 5550 Dataset.transpose support for missing_dims headtr1ck 43316012 closed 0     6 2021-06-29T13:32:37Z 2021-07-17T21:02:59Z 2021-07-17T21:02:59Z COLLABORATOR      

Is your feature request related to a problem? Please describe. I have a dataset where I do not know which of two dimensions (lets call them a and b) exists in this dataset (So either it has dims ("a", "other") or ("b", "other")). I would like to make sure that this dimension is first using transpose, but currently this is only possible using if or try statements. Just using ds.transpose("a", "b", "other") raises a ValueError arguments to transpose XXX must be permuted dataset dimensions YYY.

Describe the solution you'd like It would be nice if I could just use ds.transpose("a", "b", "other", missing_dims="ignore") similar to how DataArray.transpose handles it.

Describe alternatives you've considered Currently I'm also using ds.map(lambda x: x.transpose("a", "b", "other", missing_dims="ignore")), which could (maybe?) replace the current implementation of the transpose.

While at it, transpose_coords could also be exposed to Dataset.transpose.

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