home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 426353764

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/2450#issuecomment-426353764 https://api.github.com/repos/pydata/xarray/issues/2450 426353764 MDEyOklzc3VlQ29tbWVudDQyNjM1Mzc2NA== 6628425 2018-10-02T17:07:37Z 2018-10-02T17:07:37Z MEMBER

@am-thyst thanks for the extra details -- try out my method -- I think it does the same thing. Well perhaps you'll just need to multiply the result by 100 at the end and use >= instead of > for the threshold condition :)

Your approach can also be vectorized in such a way that you don't need to manually iterate over the individual times: ``` In [6]: b = da.where(da >= threshold, other=0)

In [7]: c = b.where(b == 0, other=1)

In [8]: (c.sum('time') / c.sizes['time']) * 100 Out[8]: <xarray.DataArray (x: 2, y: 3)> array([[ 25., 50., 25.], [ 25., 50., 50.]]) Dimensions without coordinates: x, y `` Effectivelyda >= threshold` in my earlier example is shorthand for lines 6 and 7 from the example above (and taking the mean is the same as summing over the dimension and dividing by the number of elements along that dimension).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  365438396
Powered by Datasette · Queries took 1.01ms · About: xarray-datasette