home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

1 row where type = "issue", "updated_at" is on date 2022-03-28 and user = 14371165 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 · 1 ✖

state 1

  • closed 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
1182697604 I_kwDOAMm_X85GfoiE 6416 xr.concat removes datetime information Illviljan 14371165 closed 0     2 2022-03-27T23:19:30Z 2022-03-28T16:05:01Z 2022-03-28T16:05:01Z MEMBER      

What happened?

xr.concat removes datetime information and can't concatenate the arrays because they don't have compatible types anymore.

What did you expect to happen?

Succesful concatenation with the same type.

Minimal Complete Verifiable Example

```Python import numpy as np import xarray as xr from datetime import datetime

month = np.arange(1, 13, 1) data = np.sin(2 * np.pi * month / 12.0)

darray = xr.DataArray(data, dims=["time"]) darray.coords["time"] = np.array([datetime(2017, m, 1) for m in month])

darray_nan = np.nan * darray.isel(**{"time": -1}) darray = xr.concat([darray, darray_nan], dim="time") ```

Relevant log output

```Python Traceback (most recent call last):

File "<ipython-input-15-31040255a336>", line 2, in <module> darray = xr.concat([darray, darray_nan], dim="time")

File "c:\users\j.w\documents\github\xarray\xarray\core\concat.py", line 244, in concat return f(

File "c:\users\j.w\documents\github\xarray\xarray\core\concat.py", line 642, in _dataarray_concat ds = _dataset_concat(

File "c:\users\j.w\documents\github\xarray\xarray\core\concat.py", line 555, in _dataset_concat combined_idx = indexes[0].concat(indexes, dim, positions)

File "c:\users\j.w\documents\github\xarray\xarray\core\indexes.py", line 318, in concat coord_dtype = np.result_type(*[idx.coord_dtype for idx in indexes])

File "<array_function internals>", line 5, in result_type

TypeError: The DType <class 'numpy.dtype[datetime64]'> could not be promoted by <class 'numpy.dtype[int64]'>. This means that no common DType exists for the given inputs. For example they cannot be stored in a single array unless the dtype is object. The full list of DTypes is: (<class 'numpy.dtype[datetime64]'>, <class 'numpy.dtype[int64]'>) ```

Anything else we need to know?

Similar to #6384.

Happens around here:

https://github.com/pydata/xarray/blob/728b648d5c7c3e22fe3704ba163012840408bf66/xarray/core/concat.py#L535

Environment

INSTALLED VERSIONS ------------------ commit: None python: 3.9.6 | packaged by conda-forge | (default, Jul 11 2021, 03:37:25) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: ('Swedish_Sweden', '1252') libhdf5: 1.10.6 libnetcdf: 4.7.4 xarray: 0.16.3.dev99+gc19467fb pandas: 1.3.1 numpy: 1.21.5 scipy: 1.7.1 netCDF4: 1.5.6 pydap: installed h5netcdf: 0.11.0 h5py: 2.10.0 Nio: None zarr: 2.8.3 cftime: 1.5.0 nc_time_axis: 1.3.1 PseudoNetCDF: installed rasterio: 1.2.6 cfgrib: None iris: 3.0.4 bottleneck: 1.3.2 dask: 2021.10.0 distributed: 2021.10.0 matplotlib: 3.4.3 cartopy: 0.19.0.post1 seaborn: 0.11.1 numbagg: 0.2.1 fsspec: 2021.11.1 cupy: None pint: 0.17 sparse: 0.12.0 setuptools: 49.6.0.post20210108 pip: 21.2.4 conda: None pytest: 6.2.4 IPython: 7.31.0 sphinx: 4.3.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6416/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 1595.802ms · About: xarray-datasette