home / github

Menu
  • Search all tables
  • GraphQL API

issues

Table actions
  • GraphQL API for issues

4 rows where repo = 13221727, type = "issue" and user = 14000880 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 · 4 ✖

state 1

  • closed 4

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
441192361 MDU6SXNzdWU0NDExOTIzNjE= 2945 Implicit conversion from int to float tampers with values when int is not representable as float floogit 14000880 closed 0     1 2019-05-07T11:57:20Z 2022-04-09T02:14:28Z 2022-04-09T02:14:28Z NONE      

```python ds = xr.Dataset() val = 95042027804193144 ds['var1'] = xr.DataArray(val) ds_1 = ds.where(ds.var1==val)

print(ds_1.var1.dtype) dtype('float64') print(int(ds_1.var1)) 95042027804193152 ```

Problem description

As described in #2183, int values are converted to float in where(), also when there are no NaNs in the data. This is a serious issue for the case when the int64 number is not representable as float64, as is the case in the example above. The resulting numbers are then actually different from the original numbers, without any warning.

Expected Output

I guess this is hard to fix. At a minimum, where() should probably not cast to float when there are no NaNs (which would already fix our use case). I would also rather expect an error instead of silently changing the values of a variable.

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] python-bits: 64 OS: Linux OS-release: 4.19.0-0.bpo.2-amd64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 libhdf5: 1.8.18 libnetcdf: 4.4.1.1 xarray: 0.12.1 pandas: 0.24.2 numpy: 1.15.4 scipy: 1.2.1 netCDF4: 1.2.8 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.3.4 nc_time_axis: None PseudonetCDF: None rasterio: 0.36.0 cfgrib: 0.9.6.post1 iris: None bottleneck: 1.2.1 dask: 1.1.4 distributed: None matplotlib: 3.0.3 cartopy: 0.16.0 seaborn: 0.8.1 setuptools: 39.2.0 pip: 19.0.3 conda: None pytest: 4.4.1 IPython: 7.5.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2945/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
245778442 MDU6SXNzdWUyNDU3Nzg0NDI= 1492 Slicing inconsistent for coordinates and dimensions without coordinates floogit 14000880 closed 0     3 2017-07-26T16:21:21Z 2019-07-29T01:36:13Z 2019-07-29T01:36:13Z NONE      

This is a new behavior since 0.9 and has broken some of my scripts, I am not sure if this is intentional?

old, before 0.9: ``` ds = xr.Dataset() ds['x'] = (('x'), np.arange(100., 200., 10.)) ds['var1'] = (('x', 'i'), np.random.rand(10, 5))

ds.sel(x=slice(110, 130), i=slice(1, 3)) <xarray.Dataset> Dimensions: (i: 3, x: 3) Coordinates: * x (x) float64 110.0 120.0 130.0 * i (i) int64 1 2 3 Data variables: var1 (x, i) float64 0.8894 0.01157 0.2779 0.7247 0.5809 0.3448 ... ```

new, since 0.9: ``` ds = xr.Dataset() ds['x'] = (('x'), np.arange(100., 200., 10.)) ds['var1'] = (('x', 'i'), np.random.rand(10, 5))

ds.sel(x=slice(110, 130), i=slice(1, 3)) <xarray.Dataset> Dimensions: (i: 2, x: 3) Coordinates: * x (x) float64 110.0 120.0 130.0 Dimensions without coordinates: i Data variables: var1 (x, i) float64 0.9989 0.9092 0.9248 0.296 0.2209 0.5416 ```

Maybe slicing uses the standard (excluding) python slice() for these dimensions and continues to use the (including) pandas slice for coordinates? Anyway, I find this slightly unexpected.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1492/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
189721898 MDU6SXNzdWUxODk3MjE4OTg= 1126 unstack raises error when there is only one dimension stacked floogit 14000880 closed 0     3 2016-11-16T14:34:05Z 2019-01-25T06:43:01Z 2019-01-25T06:43:01Z NONE      

I am aware that stack()/unstack() is meant to be used for combining/splitting multiple dimensions. Still, I wonder if it should throw an error when used on a dataset with only one dimension:

ds = xr.Dataset() ds['var'] = xr.DataArray(np.array([3., 4.]), dims=('dim1')) ds_s = ds.stack(z=['dim1']) ds_s.unstack('z') ValueError: cannot unstack a dimension that does not have a MultiIndex

I stumbled upon this when implementing a stack-groupby-apply-unstack pattern on a dataset which normally has more than one dimension to stack, but sometimes might contain only one. I can circumvent this quite easily by checking if there is only one dimension to stack and not using stack/unstack then, but I somehow expected it to work without treating this case in a special way.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1126/reactions",
    "total_count": 3,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
385215500 MDU6SXNzdWUzODUyMTU1MDA= 2579 sortby(dim) removes dimension from an array if dim is a repeated dimension floogit 14000880 closed 0     1 2018-11-28T11:06:54Z 2018-11-28T22:33:15Z 2018-11-28T22:33:15Z NONE      

Related to #1378. As mentioned there, xarray sometimes seems to have problems with repeated dimensions. sortby() such a dimension seems to be an example:

```python

ds = xr.DataArray(np.eye(2), coords={'alt': [100, 200], 'alt': [100, 200], }, dims=('alt', 'alt'), name='cov').to_dataset()

print(ds) <xarray.Dataset> Dimensions: (alt: 2) Coordinates: * alt (alt) int64 100 200 Data variables: cov (alt, alt) float64 1.0 0.0 0.0 1.0

print(ds.sortby('alt')) <xarray.Dataset> Dimensions: (alt: 2) Coordinates: * alt (alt) int64 100 200 Data variables: cov (alt) float64 1.0 1.0 ```

Output of xr.show_versions()

commit: None python: 2.7.13.final.0 python-bits: 64 OS: Linux OS-release: 4.9.0-8-amd64 machine: x86_64 processor: byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.9 pandas: 0.23.4 numpy: 1.15.4 scipy: 1.1.0 netCDF4: 1.2.8 h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.0.0 PseudonetCDF: None rasterio: 0.36.0 iris: None bottleneck: 1.2.1 cyordereddict: 1.0.0 dask: 0.20.2 distributed: None matplotlib: 2.2.3 cartopy: 0.16.0 seaborn: 0.8.1 setuptools: 39.2.0 pip: 18.1 conda: None pytest: 3.8.0 IPython: 5.8.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2579/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 2679.162ms · About: xarray-datasette