home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

1 row where author_association = "NONE", issue = 596606599 and user = 40410085 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

  • jrbuzan · 1 ✖

issue 1

  • Sort DataArray by data values along one dim · 1 ✖

author_association 1

  • NONE · 1 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
868260575 https://github.com/pydata/xarray/issues/3957#issuecomment-868260575 https://api.github.com/repos/pydata/xarray/issues/3957 MDEyOklzc3VlQ29tbWVudDg2ODI2MDU3NQ== jrbuzan 40410085 2021-06-25T06:33:47Z 2021-06-25T07:45:20Z NONE

Hello @zxdawn and @JavierRuano:

I am new to python. And I've been working on a different approach to this issue of ranking data on 3D array. I believe I am close to a solution. I am able to generate ranks on a 3D array, but I can't figure out how to map those ranks to reorder the data from lowest to highest using the produced indexes. Perhaps you might know what needs to happen next?

Cheers, -Jonathan

code: import xarray as xr import os import numpy as np from xarray import DataArray from dask.distributed import Client c = Client()

I am trying to produce a simpler version:

coding: utf-8

In[1]:

import xarray as xr import os import numpy as np from xarray import DataArray

In[2]:

from dask.distributed import Client c = Client()

In[19]:

def calculate_rank(x): return x.rank(dim='time')

In[4]:

lat = 2

In[5]:

lon = 3

In[6]:

time = 5

In[7]:

data = [[[ 29, 19, 8], [ 12, 7, 21]],

   [[ 3,  4,  2],
    [ 18, 10, 24]],

   [[6, 28, 14],
    [15, 16, 17]],

   [[9, 1, 20],
    [5, 27, 26]],

   [[11, 25, 23],
    [22, 13, 0]]]

In[8]:

data_xr = xr.DataArray(data, dims=['time', 'lat', 'lon'], coords={'time': np.arange(time)})

In[9]:

data_xr.values

Groupby on all of the data

In[10]:

stacked_object = data_xr.stack(gridcell=['lat','lon'])#.chunk({'gridcell':500})

In[11]:

stacked_object.load()

In[20]:

TSA_Rank = stacked_object.groupby('gridcell').apply(calculate_rank).unstack()

In[21]:

TSA_Rank

In[22]:

TSA_Rank.values array([[[5., 3., 2.], [2., 1., 3.]],

   [[1., 2., 1.],
    [4., 2., 4.]],

   [[2., 5., 3.],
    [3., 4., 2.]],

   [[3., 1., 4.],
    [1., 5., 5.]],

   [[4., 4., 5.],
    [5., 3., 1.]]])

In[23]:

data_xr.values array([[[29, 19, 8], [12, 7, 21]],

   [[ 3,  4,  2],
    [18, 10, 24]],

   [[ 6, 28, 14],
    [15, 16, 17]],

   [[ 9,  1, 20],
    [ 5, 27, 26]],

   [[11, 25, 23],
    [22, 13,  0]]])
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Sort DataArray by data values along one dim 596606599

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 12.323ms · About: xarray-datasette