home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 1296475783

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
1296475783 I_kwDOAMm_X85NRqaH 6759 DataArray.rolling.reduce() does not apply correctly numpy.nanpercentile 90059220 closed 0     2 2022-07-06T21:10:59Z 2022-07-07T02:05:47Z 2022-07-07T02:05:47Z NONE      

What is your issue?

I stumbled upon the issue of not having a simple DataArray.rolling.quantile() or Dataset.rolling.quantile(), so I tried using the rolling.reduce() alternative, which seems to alter the normal functioning of functions like numpy.nanpercentile. Namely, nanpercentile act like percentile i.e create huge missing chunks the size of rolling as soon as nan are found within the window. Is there a fix to that ?

Here is the code I used to test it out: ``` python import xarray as xr, numpy as np

m,n = 30,56 tab = np.random.uniform(0, 100, size=(m,n)) ds = xr.DataArray(tab) ds.plot.imshow(center=False)

nb_nan = 8 tab.ravel()[np.random.choice(tab.size, nb_nan, replace=False)] = np.nan ds_nan = xr.DataArray(tab) ds_nan.plot.imshow(center=False)

w = 4 roll = ds_nan.rolling({name: w for name in ['dim_0', 'dim_1']}, center = True)

roll_perc = roll.reduce(np.percentile, q=90) roll_perc.plot.imshow(center=False)

roll_perc_nan = roll.reduce(np.nanpercentile, q=90) roll_perc_nan.plot.imshow(center=False)

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

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