home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 129040941

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/460#issuecomment-129040941 https://api.github.com/repos/pydata/xarray/issues/460 129040941 MDEyOklzc3VlQ29tbWVudDEyOTA0MDk0MQ== 2443309 2015-08-08T19:48:46Z 2015-08-08T19:48:46Z MEMBER

Is this still something that would be useful? If so, do we want a method on the DataArray object to get this sort of behavior:

``` python In [1]: import xray In [2]: import numpy as np In [3]: da = xray.DataArray(np.random.random_sample(size=(5, 4)))

In [4]: da.where(da < 0.5) Out[4]: <xray.DataArray (dim_0: 5, dim_1: 4)> array([[ 0.127, nan, 0.26 , nan], [ 0.377, 0.336, 0.451, nan], [ 0.123, nan, 0.373, 0.448], [ 0.129, nan, nan, 0.352], [ 0.229, nan, nan, 0.138]]) Coordinates: * dim_0 (dim_0) int64 0 1 2 3 4 * dim_1 (dim_1) int64 0 1 2 3

In [5]: da.where(da < 0.5).to_masked_array() Out[5]: masked_array(data = [[0.12696983303810094 -- 0.26047600586578334 --] [0.37674971618967135 0.33622174433445307 0.45137647047539964 --] [0.12310214428849964 -- 0.37301222522143085 0.4479968246859435] [0.12944067971751294 -- -- 0.35205353914802473] [0.2288873043216132 -- -- 0.1375535565632705]], mask = [[False True False True] [False False False True] [False True False False] [False True True False] [False True True False]], fill_value = 1e+20) ```

Alternatively, we could add a @property to the DataArray but I don't think that is necessary.

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