home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

1 row where repo = 13221727, state = "open" and user = 13491008 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

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

type 1

  • issue 1

state 1

  • open · 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
1600364072 I_kwDOAMm_X85fY54o 7560 xr.merge does not respect datatypes of inputs pbranson 13491008 open 0     3 2023-02-27T02:52:39Z 2023-03-01T19:00:35Z   NONE      

What happened?

I have noticed a behaviour when using xr.merge to combine results where the datatype of the inputs are changed on the output to float.

This is undesirable at times, in particular when the results are to be used to index into an array.

What did you expect to happen?

Expected the datatypes to be preserved.

Minimal Complete Verifiable Example

```Python subsets = [] for i in range(10): subsets.append(xr.DataArray([i,],dims=['idx'],coords={'idx':[i,]},name='da'))

display(subsets[0].dtype)

merged=xr.merge(subsets)

display(merged) display(merged.da.dtype) ```

MVCE confirmation

  • [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [X] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [X] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [X] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

```Python dtype('int32')

<xarray.Dataset> Dimensions: (idx: 10) Coordinates: * idx (idx) int32 0 1 2 3 4 5 6 7 8 9 Data variables: da (idx) float64 0.0 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0

dtype('float64') ```

Anything else we need to know?

No response

Environment

INSTALLED VERSIONS ------------------ commit: None python: 3.10.9 | packaged by conda-forge | (main, Jan 11 2023, 15:15:40) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 154 Stepping 3, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: ('English_Australia', '1252') libhdf5: 1.12.1 libnetcdf: 4.8.1 xarray: 2023.1.0 pandas: 1.5.2 numpy: 1.23.5 scipy: 1.10.0 netCDF4: 1.6.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: 2.13.6 cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.5 dask: 2023.1.1 distributed: 2023.1.1 matplotlib: 3.6.2 cartopy: None seaborn: 0.12.2 numbagg: None fsspec: 2023.1.0 cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.6.3 pip: 22.3.1 conda: None pytest: None mypy: None IPython: 8.9.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7560/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    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 1682.665ms · About: xarray-datasette