home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

3 rows where state = "closed", type = "issue" and user = 22488770 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 · 3 ✖

state 1

  • closed · 3 ✖

repo 1

  • xarray 3
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
1636431481 I_kwDOAMm_X85hifZ5 7661 Dark mode documentation not readable andrewpauling 22488770 closed 0     0 2023-03-22T20:11:06Z 2023-03-27T18:14:27Z 2023-03-27T18:14:27Z CONTRIBUTOR      

What is your issue?

When opening the xarray documentation website, it defaults to dark mode as my system is using dark mode. However, much of the text is not readable as it remains black on the dark background, see screenshots for comparison of the homepage in dark vs light mode:

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7661/reactions",
    "total_count": 5,
    "+1": 5,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
702373263 MDU6SXNzdWU3MDIzNzMyNjM= 4427 assign_coords with datetime64[us] changes dtype to datetime64[ns] andrewpauling 22488770 closed 0     3 2020-09-16T01:14:11Z 2020-09-30T00:49:35Z 2020-09-30T00:49:35Z CONTRIBUTOR      

What happened: When using xr.DataArray.assign_coords() to assign a new coordinate to the time dimension that is an array with dtype datetime64[us], after assigning, the dtype is datetime64[ns], resulting in the wrong dates, since the dates I am using are outside the valid range for the [ns] units.

What you expected to happen: Preserve dtype of array when assigning as a coordinate.

Minimal Complete Verifiable Example:

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

tmp = np.random.random(12)

da = xr.DataArray(tmp, dims='time')

times=list()

for mth in np.arange(1, 13): times.append(cftime.DatetimeNoLeap(1250, mth, 1))

times64 = np.array([np.datetime64(t, 'us') for t in times])

da = da.assign_coords({'time': times64}) which gives for the original array:python In [49]: times64 Out[49]: array(['1250-01-01T00:00:00.000000', '1250-02-01T00:00:00.000000', '1250-03-01T00:00:00.000000', '1250-04-01T00:00:00.000000', '1250-05-01T00:00:00.000000', '1250-06-01T00:00:00.000000', '1250-07-01T00:00:00.000000', '1250-08-01T00:00:00.000000', '1250-09-01T00:00:00.000000', '1250-10-01T00:00:00.000000', '1250-11-01T00:00:00.000000', '1250-12-01T00:00:00.000000'], dtype='datetime64[us]') ```

and for the array after assigning: python In [51]: da.time Out[51]: <xarray.DataArray 'time' (time: 12)> array(['1834-07-22T23:34:33.709551616', '1834-08-22T23:34:33.709551616', '1834-09-19T23:34:33.709551616', '1834-10-20T23:34:33.709551616', '1834-11-19T23:34:33.709551616', '1834-12-20T23:34:33.709551616', '1835-01-19T23:34:33.709551616', '1835-02-19T23:34:33.709551616', '1835-03-22T23:34:33.709551616', '1835-04-21T23:34:33.709551616', '1835-05-22T23:34:33.709551616', '1835-06-21T23:34:33.709551616'], dtype='datetime64[ns]') Coordinates: * time (time) datetime64[ns] 1834-07-22T23:34:33.709551616 ... 1835-06-...

Anything else we need to know?:

Environment:

Output of <tt>xr.show_versions()</tt> INSTALLED VERSIONS ------------------ commit: None python: 3.7.8 | packaged by conda-forge | (default, Jul 31 2020, 02:37:09) [Clang 10.0.1 ] python-bits: 64 OS: Darwin OS-release: 18.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.7.3 xarray: 0.16.0 pandas: 1.1.0 numpy: 1.19.1 scipy: 1.4.1 netCDF4: 1.5.3 pydap: installed h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.4.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: 2.21.0 distributed: 2.22.0 matplotlib: 3.1.2 cartopy: 0.17.0 seaborn: None numbagg: None pint: None setuptools: 49.3.1.post20200810 pip: 20.2.2 conda: None pytest: None IPython: 7.17.0 sphinx: 3.2.0
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4427/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
506914634 MDU6SXNzdWU1MDY5MTQ2MzQ= 3398 Mean called on groupby object adds dimensions to undesired variables andrewpauling 22488770 closed 0     3 2019-10-14T23:03:04Z 2019-10-16T14:30:38Z 2019-10-16T14:30:38Z CONTRIBUTOR      

MCVE Code Sample

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

create time coordinate

tdays = np.arange(0, 730) time = cftime.num2date(tdays, 'days since 0001-01-01 00:00:00', calendar='noleap')

create spatial coordinate

lev = np.arange(100)

Create dummy data

x = np.random.rand(time.size, lev.size) y = np.random.rand(lev.size)

Create sample Dataset

ds = xr.Dataset({'sample_data': (['time', 'lev'], x), 'independent_data': (['lev'], y)}, coords={'time': (['time'], time), 'lev': (['lev'], lev)})

Perform groupby and mean

ds2 = ds.groupby('time.month').mean(dim='time') ```

Actual Output

python <xarray.Dataset> Dimensions: (lev: 100, month: 12) Coordinates: * lev (lev) int64 0 1 2 3 4 5 6 7 8 ... 92 93 94 95 96 97 98 99 * month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12 Data variables: sample_data (month, lev) float64 0.5143 0.554 0.5027 ... 0.5246 0.5435 independent_data (month, lev) float64 0.01667 0.4687 ... 0.1015 0.7459

Expected Output

python <xarray.Dataset> Dimensions: (lev: 100, month: 12) Coordinates: * lev (lev) int64 0 1 2 3 4 5 6 7 8 ... 92 93 94 95 96 97 98 99 * month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12 Data variables: sample_data (month, lev) float64 0.5143 0.554 0.5027 ... 0.5246 0.5435 independent_data (lev) float64 0.01667 0.4687 ... 0.1015 0.7459

Problem Description

The variable independent_data above initially has no time dimension but, after performing groupby('time.month').mean(dim='time') on the Dataset, it now has a month dimension that is meaningless. Preferably, it should leave the independent_data variable untouched.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.7.3 (default, Mar 27 2019, 16:54:48) [Clang 4.0.1 (tags/RELEASE_401/final)] python-bits: 64 OS: Darwin OS-release: 18.7.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: en_US.UTF-8 LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.10.5 libnetcdf: 4.6.2 xarray: 0.12.2 pandas: 0.24.2 numpy: 1.16.4 scipy: 1.3.0 netCDF4: 1.5.1.2 pydap: installed h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudonetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.1.0 cartopy: 0.17.0 seaborn: None numbagg: None setuptools: 41.0.1 pip: 19.1.1 conda: None pytest: None IPython: 7.2.0 sphinx: 2.1.2
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/3398/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 20.84ms · About: xarray-datasette