home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where issue = 597785475 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)

user 1

  • Illviljan · 1 ✖

issue 1

  • Interpolation - Support extrapolation method "clip" · 1 ✖

author_association 1

  • MEMBER 1
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
612077587 https://github.com/pydata/xarray/issues/3962#issuecomment-612077587 https://api.github.com/repos/pydata/xarray/issues/3962 MDEyOklzc3VlQ29tbWVudDYxMjA3NzU4Nw== Illviljan 14371165 2020-04-10T15:25:30Z 2020-04-10T15:30:05Z MEMBER

Nice find! The documentation doesn't explain that at all currently.

But that solution doesn't work for 1d DataArrays. You have to use this kwargs instead: python kwargs = dict(fill_value=(np.min(da.data), np.max(da.data))) So it still isn't as convenient as I would like it to be. The wrapper function can now be simplified to this however:

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

def interp(da, coords, extrapolation='clip'): """ Linear interpolation that clips the inputs to the coords min and max value.

Parameters
----------
da : DataArray
    DataArray to interpolate.
coords : dict
    Coordinates for the interpolated value.
"""
if extrapolation == 'clip':
    if len(da.coords) > 1:
        kwargs = dict(fill_value=None)
    else:
        kwargs = dict(fill_value=(np.min(da.data), np.max(da.data)))
return da.interp(coords, kwargs=kwargs)

Create coordinates:

x = np.linspace(1000, 6000, 4) y = np.linspace(100, 1200, 3) z = np.linspace(1, 2, 2)

Create 1D DataArray:

da1 = xr.DataArray(data=2*x, coords=[('x', x)])

Create 2D DataArray:

X = np.meshgrid(*[x, y], indexing='ij') data = X[0] * X[1] da2 = xr.DataArray(data=data, coords=[('x', x), ('y', y)])

Create 3D DataArray:

X = np.meshgrid(*[x, y, z], indexing='ij') data = X[0] * X[1] * X[2] da3 = xr.DataArray(data=data, coords=[('x', x), ('y', y), ('z', z)])

Attempt to extrapolate:

print(interp(da1, {'x': 7000})) print(interp(da2, {'x': 7000, 'y': 375})) print(interp(da3, {'x': 7000, 'y': 375, 'z': 1})) ````

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Interpolation - Support extrapolation method "clip" 597785475

Advanced export

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

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 31.125ms · About: xarray-datasette