home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 197779069

This data as json

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
197779069 MDExOlB1bGxSZXF1ZXN0OTk0OTc4MDY= 1187 add quantile method to DataArray 2443309 closed 0     2 2016-12-28T01:06:51Z 2017-01-23T18:22:14Z 2017-01-23T18:22:14Z MEMBER   0 pydata/xarray/pulls/1187

This PR adds the quantile method to the DataArray. There may be a way to better fit this in with .apply or reduce it wasn't immediately clear to me how to do that. It uses np.nanpercentile under the hood so this shouldn't be expected to work well with dask. The main advantage to this method, over using apply(np.nanpercentile) is the handling of the quantile coordinate.

example usage:

```Python In [12]: x = np.random.random(size=(2, 3, 800))

In [13]: da = xr.DataArray(x, dims=('x', 'y', 'time'))

In [14]: da.quantile([1, 5, 10, 25, 50, 75, 90, 95, 99], dim='time', interpolation='lower') Out[14]: <xarray.DataArray (quantile: 9, x: 2, y: 3)> array([[[ 0.00835474, 0.01126747, 0.00778847], [ 0.00803924, 0.00919259, 0.01150164]],

   [[ 0.04902814,  0.05346976,  0.04493341],
    [ 0.04236611,  0.05273082,  0.05858802]],

   [[ 0.09370776,  0.09976448,  0.09256707],
    [ 0.08943787,  0.09331907,  0.08832309]],

   [[ 0.25416402,  0.22577298,  0.24407393],
    [ 0.25386087,  0.23052584,  0.24621966]],

   [[ 0.534169  ,  0.46017551,  0.49817391],
    [ 0.50968059,  0.49427688,  0.51573855]],

   [[ 0.76633412,  0.73405412,  0.77210754],
    [ 0.76759837,  0.74243892,  0.76703357]],

   [[ 0.90832116,  0.89495854,  0.91818434],
    [ 0.91492771,  0.88063773,  0.91416636]],

   [[ 0.95260527,  0.95132871,  0.95979701],
    [ 0.95988286,  0.93137055,  0.95941658]],

   [[ 0.98597133,  0.98883232,  0.99013424],
    [ 0.98951238,  0.97550784,  0.99224201]]])

Coordinates: * quantile (quantile) float64 1.0 5.0 10.0 25.0 50.0 75.0 90.0 95.0 99.0 o x (x) - o y (y) - ```

closes #303 fixes #561

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1187/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 pull

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 2 rows from issue in issue_comments
Powered by Datasette · Queries took 0.554ms · About: xarray-datasette