home / github

Menu
  • Search all tables
  • GraphQL API

pull_requests

Table actions
  • GraphQL API for pull_requests

1 row where user = 30388627

✎ View and edit SQL

This data as json, CSV (advanced)

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

id ▼ node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
396774100 MDExOlB1bGxSZXF1ZXN0Mzk2Nzc0MTAw 3924 closed 0 Coordinates passed to interp have nan values zxdawn 30388627 ## Problem `Keyerror` when the coordinates passed to `interp` have nan value. ### Example ``` import numpy as np import xarray as xr da = xr.DataArray(np.sin(0.3 * np.arange(20).reshape(5, 4)), [('x', np.arange(5)), ('y', [0.1, 0.2, 0.3, 0.4])]) x = xr.DataArray([[0.5, np.nan], [1.5, 2.5]], dims=['z1', 'z2']) y = xr.DataArray([[0.15, 0.2], [np.nan, 0.35]], dims=['z1', 'z2']) da_nan = da.interp(x=x, y=y) ``` ### Output ``` E:\miniconda3\envs\satpy\lib\site-packages\pandas\core\indexes\base.py:2826: RuntimeWarning: invalid value encountered in less op(left_distances, right_distances) | (right_indexer == -1), Traceback (most recent call last): File "C:\Users\Xin\Desktop\test_none.py", line 10, in <module> da_nan = da.interp(x=x, y=y) File "E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\dataarray.py", line 1365, in interp **coords_kwargs, File "E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\dataset.py", line 2610, in interp variables[name] = missing.interp(var, var_indexers, method, **kwargs) File "E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\missing.py", line 611, in interp var, indexes_coords = _localize(var, indexes_coords) File "E:\miniconda3\envs\satpy\lib\site-packages\xarray\core\missing.py", line 552, in _localize imin = index.get_loc(np.min(new_x.values), method="nearest") File "E:\miniconda3\envs\satpy\lib\site-packages\pandas\core\indexes\base.py", line 2654, in get_loc raise KeyError(key) KeyError: nan ``` ## Solution Use `np.nanmin` and `np.nanmax` in `index.get_loc()` ## Test ### Code ``` import numpy as np import xarray as xr da = xr.DataArray(np.sin(0.3 * np.arange(20).reshape(5, 4)), [('x', np.arange(5)), ('y', [0.1, 0.2, 0.3, 0.4])]) x = xr.DataArray([[0.5, np.nan], [1.5, 2.5]], dims=['z1', 'z2']) y = xr.DataArray([[0.15, 0.2], [np.nan, 0.35]], dims=['z1', 'z2']) da_nan = da.interp(x=x, y=y) x = xr.Dat… 2020-04-01T05:46:54Z 2020-08-27T08:51:32Z 2020-08-27T08:51:32Z   54d0b47d45fff64d5acb69a1225078944b61e80a     0 26cf20353d6649d9448e1542feb389479222e8f9 7bf9df9d75c40bcbf2dd28c47204529a76561a3f NONE   xarray 13221727 https://github.com/pydata/xarray/pull/3924  

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [pull_requests] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [state] TEXT,
   [locked] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [body] TEXT,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [merged_at] TEXT,
   [merge_commit_sha] TEXT,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [draft] INTEGER,
   [head] TEXT,
   [base] TEXT,
   [author_association] TEXT,
   [auto_merge] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [url] TEXT,
   [merged_by] INTEGER REFERENCES [users]([id])
);
CREATE INDEX [idx_pull_requests_merged_by]
    ON [pull_requests] ([merged_by]);
CREATE INDEX [idx_pull_requests_repo]
    ON [pull_requests] ([repo]);
CREATE INDEX [idx_pull_requests_milestone]
    ON [pull_requests] ([milestone]);
CREATE INDEX [idx_pull_requests_assignee]
    ON [pull_requests] ([assignee]);
CREATE INDEX [idx_pull_requests_user]
    ON [pull_requests] ([user]);
Powered by Datasette · Queries took 23.412ms · About: xarray-datasette