home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

8 rows where state = "closed", type = "issue" and user = 90008 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue · 8 ✖

state 1

  • closed · 8 ✖

repo 1

  • xarray 8
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
1429172192 I_kwDOAMm_X85VL2_g 7239 include/exclude lists in Dataset.expand_dims hmaarrfk 90008 closed 0     6 2022-10-31T03:01:52Z 2023-11-05T06:29:06Z 2023-11-05T06:29:06Z CONTRIBUTOR      

Is your feature request related to a problem?

I would like to be able to expand the dimensions of a dataset, but most of the time, I only want to expand the datasets of a few key variables.

It would be nice if there were some kind of filter mechanism.

Describe the solution you'd like

```python import xarray as xr dataset = xr.Dataset(data_vars={'foo': 1, 'bar': 2}) dataset.expand_dims("zar", include_variables=["foo"])

Only foo is expanded, bar is left alone.

```

Describe alternatives you've considered

Writing my own function. I'll probably do this.

Subclassing. Too confusing and easy to "diverge" from you all when you do decide to implment this.

Additional context

For large datasets, you likely just want some key parameters expanded, and not all parameters expanded.

xarray version: 2022.10.0

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7239/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1428549868 I_kwDOAMm_X85VJfDs 7237 The new NON_NANOSECOND_WARNING is not very nice to end users hmaarrfk 90008 closed 0     5 2022-10-30T01:56:59Z 2023-05-09T12:52:54Z 2022-11-04T20:13:20Z CONTRIBUTOR      

What is your issue?

The new nanosecond warning doesn't really point anybody to where they should change their code.

Nor does it really tell them how to fix it.

import xarray as xr import numpy as np xr.DataArray(np.zeros(1, dtype='datetime64[us]')) yields

xarray/core/variable.py:194: UserWarning: Converting non-nanosecond precision datetime values to nanosecond precision. This behavior can eventually be relaxed in xarray, as it is an artifact from pandas which is now beginning to support non-nanosecond precision values.

https://github.com/pydata/xarray/blob/f32d354e295c05fb5c5ece7862f77f19d82d5894/xarray/core/variable.py#L194

I think at the very least, the stacklevel should be specified when calling the warn function.

It isn't really pretty, but I've been passing a parameter when I expect to pass up a warning to the end user: eg. https://github.com/vispy/vispy/pull/2405

However, others have not liked that approach.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7237/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1306457778 I_kwDOAMm_X85N3vay 6791 get_data or get_varibale method hmaarrfk 90008 closed 0     3 2022-07-15T20:24:31Z 2023-04-29T03:40:01Z 2023-04-29T03:40:01Z CONTRIBUTOR      

Is your feature request related to a problem?

I often store a few scalars or arrays in xarray containers.

However, when I want to optionally address their data the code I have to run ```python import xarray as xr dataset = xr.Dataset()

my_variable = dataset.get('my_variable', None) if my_variable is not None: my_variable = my_variable.data else: my_variable = np.asarray(1.0) # the default value I actually want ```

Describe the solution you'd like

```python import xarray as xr dataset = xr.Dataset()

my_variable = dataset.get_data('my_variable', np.asarray(1.0)) ```

Describe alternatives you've considered

No response

Additional context

Thank you!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6791/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1675299031 I_kwDOAMm_X85j2wjX 7770 Provide a public API for adding new backends hmaarrfk 90008 closed 0     3 2023-04-19T17:06:24Z 2023-04-20T00:15:23Z 2023-04-20T00:15:23Z CONTRIBUTOR      

Is your feature request related to a problem?

I understand that this is a double edge sword. but we were relying on BACKEND_ENTRYPOINTS being a dictionary to a class and that broke in

https://github.com/pydata/xarray/pull/7523

Describe the solution you'd like

Some agreed upon way that we could create a new backend. This would allow users to provide more custom parameters to file creation attributes and other options that are currently not exposed via xarray.

I've used this to overwrite some parameters like netcdf global variables.

I've also used this to add alignment_threshold and alignment_interval to h5netcdf.

I did it through a custom backend because it felt like a contentious feature at the time. (I really do think it helps performance).

Describe alternatives you've considered

A deprecation cycle in the future???

Maybe this could have been acheived with the definition of RELOADABLE_BACKEND_ENTRYPOINTS and leaving the BACKEND_ENTRYPOINTS unchanged in signature.

Additional context

We used this to define the alignment within a file. netcdf4 exposed this as a global variable so we have to somewhat hack around it just before creation time.

I mean, you can probably say:

"Doing this is too complicated, we don't want to give any guarantees on this front."

I would agree with you.....

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7770/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
347962055 MDU6SXNzdWUzNDc5NjIwNTU= 2347 Serialization of just coordinates hmaarrfk 90008 closed 0     6 2018-08-06T15:03:29Z 2022-01-09T04:28:49Z 2022-01-09T04:28:49Z CONTRIBUTOR      

In the search for the perfect data storage mechanism, I find myself needing to store some of the images I am generating the metadata seperately. It is really useful for me to serialize just the coordinates of my DataArray.

My serialization method of choice is json since it allows me to read the metadata with just a text editor. For that, having the coordinates as a self contained dictionary is really important.

Currently, I convert just the coordinates to a dataset, and serialize that. The code looks something like this:

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

Setup an array with coordinates

n = np.zeros(3) coords={'x': np.arange(3)} m = xr.DataArray(n, dims=['x'], coords=coords)

coords_dataset_dict = m.coords.to_dataset().to_dict() coords_dict = coords_dataset_dict['coords']

Read/Write dictionary to JSON file

This works, but I'm essentially creating an emtpy dataset for it

coords_set = xr.Dataset.from_dict(coords_dataset_dict) coords2 = coords_set.coords # so many coords :D m2 = xr.DataArray(np.zeros(shape=m.shape), dims=m.dims, coords=coords2) ```

Would encapsulating this functionality in the Coordinates class be accepted as a PR?

It would add 2 functions that would look like: ```python def to_dict(self): # offload the heavy lifting to the Dataset class return self.to_dataset().to_dict()['coords']

def from_dict(self, d): # Offload the heavy lifting again to the Dataset class d_dataset = {'dims': [], 'attrs': [], 'coords': d} return Dataset.from_dict(d_dataset).coords ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2347/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
689390592 MDU6SXNzdWU2ODkzOTA1OTI= 4394 Is it possible to append_dim to netcdf stores hmaarrfk 90008 closed 0     2 2020-08-31T18:02:46Z 2020-08-31T22:11:10Z 2020-08-31T22:11:09Z CONTRIBUTOR      

Is your feature request related to a problem? Please describe. Feature request: It seems that it should be possible to append to netcdf4 stores along the unlimited dimensions. Is there an example of this?

Describe the solution you'd like I would like the following code to be valid: ```python from xarray.tests.test_dataset import create_append_test_data ds, ds_to_append, ds_with_new_var = create_append_test_data()

filename = 'test_dataset.nc'

Choose any one of

engine : {'netcdf4', 'scipy', 'h5netcdf'}

engine = 'netcdf4' ds.to_netcdf(filename, mode='w', unlimited_dims=['time'], engine=engine) ds_to_append.to_netcdf(filename, mode='a', unlimited_dims=['time'], engine=engine) ```

Describe alternatives you've considered I guess you could use zarr, but the fact that it creates multiple files is a problem.

Additional context xarray version: 0.16.0

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4394/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
335608017 MDU6SXNzdWUzMzU2MDgwMTc= 2251 netcdf roundtrip fails to preserve the shape of numpy arrays in attributes hmaarrfk 90008 closed 0     5 2018-06-25T23:52:07Z 2018-08-29T16:06:29Z 2018-08-29T16:06:28Z CONTRIBUTOR      

Code Sample

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

a = xr.DataArray(np.zeros((3, 3)), dims=('y', 'x')) a.attrs['my_array'] = np.arange(6, dtype='uint8').reshape(2, 3)

a.to_netcdf('a.nc') b = xr.open_dataarray('a.nc') b.load() assert np.all(b == a) print('all arrays equal')

assert b.dtype == a.dtype print('dtypes equal')

print(a.my_array.shape) print(b.my_array.shape) assert a.my_array.shape == b.my_array.shape ```

Problem description

I have some metadata that is in the form of numpy arrays. I would think that it should round trip with netcdf.

Expected Output

equal shapes inside the metadata

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.6.5.final.0 python-bits: 64 OS: Linux OS-release: 4.16.15-300.fc28.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.7 pandas: 0.23.0 numpy: 1.14.4 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.5 distributed: 1.21.8 matplotlib: 2.2.2 cartopy: None seaborn: None setuptools: 39.2.0 pip: 9.0.3 conda: None pytest: 3.6.1 IPython: 6.4.0 sphinx: 1.7.5
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2251/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
347558405 MDU6SXNzdWUzNDc1NTg0MDU= 2340 expand_dims erases named dim in the array's coordinates hmaarrfk 90008 closed 0     5 2018-08-03T23:00:07Z 2018-08-05T01:15:49Z 2018-08-04T03:39:49Z CONTRIBUTOR      

Code Sample, a copy-pastable example if possible

```python

%%

import xarray as xa import numpy as np

n = np.zeros((3, 2))

data = xa.DataArray(n, dims=['y', 'x'], coords={'y':range(3), 'x':range(2)})

data = data.assign_coords(z=xa.DataArray(np.arange(6).reshape((3, 2)), dims=['y', 'x']))

print('Original Data') print('=============') print(data)

%%

my_slice = data[0, 1] print("Sliced data") print("===========") print("z coordinate remembers it's own x value") print(f'x = {my_slice.z.x}')

%%

expanded_slice = data[0, 1].expand_dims('x') print("expanded slice") print("==============") print("forgot that 'z' had 'x' coordinates") print("but remembered it had a 'y' coordinate") print(f"z = {expanded_slice.z}") print(expanded_slice.z.x) ```

Output: Original Data ============= <xarray.DataArray (y: 3, x: 2)> array([[0., 0.], [0., 0.], [0., 0.]]) Coordinates: * y (y) int32 0 1 2 * x (x) int32 0 1 z (y, x) int32 0 1 2 3 4 5 Sliced data =========== z coordinate remembers it's own x value x = <xarray.DataArray 'x' ()> array(1) Coordinates: y int32 0 x int32 1 z int32 1 expanded slice ============== forgot that 'z' had 'x' coordinates but remembered it had a 'y' coordinate z = <xarray.DataArray 'z' ()> array(1) Coordinates: y int32 0 z int32 1 AttributeError: 'DataArray' object has no attribute 'x'

Problem description

The coordinate used to have an explicit dimension. When we expanded the dimension, that information should not be erased. Note that information about other coordinates are maintained.

The challenge

The coordinates probably have fewer dimensions than the original data. I'm not sure about xarray's model, but a few challenges come to mind: 1. is the relative order of dimensions maintained between data in the same dataset/dataarray? 2. Can coordinates have MORE dimensions than the array itself?

The answer to these two questions might make or break If not, then this becomes a very difficult problem to solve since we don't know where to insert this new dimension in the coordinate array.

Output of xr.show_versions()

xa.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.6.6.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 79 Stepping 1, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: None.None xarray: 0.10.7 pandas: 0.23.1 numpy: 1.14.3 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.18.1 distributed: 1.22.0 matplotlib: 2.2.2 cartopy: None seaborn: None setuptools: 39.2.0 pip: 9.0.3 conda: None pytest: 3.7.1 IPython: 6.4.0 sphinx: 1.7.5
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2340/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 35.968ms · About: xarray-datasette