home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 472247188 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 2

  • shoyer 1
  • TomNicholas 1

issue 1

  • xarray: How to get the coordinates of the maximum and minimum value over a spatial domain in xarray? · 2 ✖

author_association 1

  • MEMBER 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
514852985 https://github.com/pydata/xarray/issues/3160#issuecomment-514852985 https://api.github.com/repos/pydata/xarray/issues/3160 MDEyOklzc3VlQ29tbWVudDUxNDg1Mjk4NQ== shoyer 1217238 2019-07-25T00:58:12Z 2019-07-25T00:58:12Z MEMBER

In fact, this was already asked on StackOverflow :) https://stackoverflow.com/questions/40179593/how-to-get-the-coordinates-of-the-maximum-in-xarray

I'm going to close this, but feel free to comment or reopen if you have any further questions.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray: How to get the coordinates of the maximum and minimum value over a spatial domain in xarray? 472247188
514619297 https://github.com/pydata/xarray/issues/3160#issuecomment-514619297 https://api.github.com/repos/pydata/xarray/issues/3160 MDEyOklzc3VlQ29tbWVudDUxNDYxOTI5Nw== TomNicholas 35968931 2019-07-24T12:52:58Z 2019-07-24T12:52:58Z MEMBER

There might be a better way, but I think this is one way:

First mask out all the data that isn't in your lat/long box. If your latitude and longitude are 1D then you could use .sel(), otherwise use .where(). You have two conditions (one for latitude and one for longitude), so combine them with np.logical_and():

python condition = np.logical_and(data.lat > 10.0, data.lon < 50.0) box = data.where(condition)

Then use DataArray.argmax() across all the dimensions of the result to find the indices of the maximum values.

python inds_of_max = box.argmax(dims=['lat', 'lon'])

Pass those indices to your latitude/longitude coordinate arrays to get the (lat, lon) pair you want.

python lat, lon = data.lat[inds_of_max], data.lon[inds_of_max]

(This would probably be better placed on stackoverflow than here but doesn't matter)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  xarray: How to get the coordinates of the maximum and minimum value over a spatial domain in xarray? 472247188

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 11.754ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows