home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 204513246

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/pull/815#issuecomment-204513246 https://api.github.com/repos/pydata/xarray/issues/815 204513246 MDEyOklzc3VlQ29tbWVudDIwNDUxMzI0Ng== 4295853 2016-04-01T18:44:27Z 2016-04-01T18:44:27Z CONTRIBUTOR

@fmaussion, for

python array = DataArray(np.arange(5**3).reshape(5, 5, 5), dims=('x', 'y', 'z')) mask = DataArray(np.arange(5**2).reshape(5, 5), dims=('x', 'y')) actual = array.sel_where(np.logical_and(mask > 6, mask < 18))

it returns this

``` python (Pdb) actual <xarray.DataArray (x: 3, y: 5, z: 5)> array([[[ nan, nan, nan, nan, nan], [ nan, nan, nan, nan, nan], [ 35., 36., 37., 38., 39.], [ 40., 41., 42., 43., 44.], [ 45., 46., 47., 48., 49.]],

   [[ 50.,  51.,  52.,  53.,  54.],
    [ 55.,  56.,  57.,  58.,  59.],
    [ 60.,  61.,  62.,  63.,  64.],
    [ 65.,  66.,  67.,  68.,  69.],
    [ 70.,  71.,  72.,  73.,  74.]],

   [[ 75.,  76.,  77.,  78.,  79.],
    [ 80.,  81.,  82.,  83.,  84.],
    [ 85.,  86.,  87.,  88.,  89.],
    [ nan,  nan,  nan,  nan,  nan],
    [ nan,  nan,  nan,  nan,  nan]]])

Coordinates: * x (x) int64 1 2 3 * y (y) int64 0 1 2 3 4 * z (z) int64 0 1 2 3 4 ```

where

``` python (Pdb) array <xarray.DataArray (x: 5, y: 5, z: 5)> array([[[ 0, 1, 2, 3, 4], [ 5, 6, 7, 8, 9], [ 10, 11, 12, 13, 14], [ 15, 16, 17, 18, 19], [ 20, 21, 22, 23, 24]],

   [[ 25,  26,  27,  28,  29],
    [ 30,  31,  32,  33,  34],
    [ 35,  36,  37,  38,  39],
    [ 40,  41,  42,  43,  44],
    [ 45,  46,  47,  48,  49]],

   [[ 50,  51,  52,  53,  54],
    [ 55,  56,  57,  58,  59],
    [ 60,  61,  62,  63,  64],
    [ 65,  66,  67,  68,  69],
    [ 70,  71,  72,  73,  74]],

   [[ 75,  76,  77,  78,  79],
    [ 80,  81,  82,  83,  84],
    [ 85,  86,  87,  88,  89],
    [ 90,  91,  92,  93,  94],
    [ 95,  96,  97,  98,  99]],

   [[100, 101, 102, 103, 104],
    [105, 106, 107, 108, 109],
    [110, 111, 112, 113, 114],
    [115, 116, 117, 118, 119],
    [120, 121, 122, 123, 124]]])

Coordinates: * x (x) int64 0 1 2 3 4 * y (y) int64 0 1 2 3 4 * z (z) int64 0 1 2 3 4 ```

python (Pdb) np.logical_and(mask > 6, mask < 18) <xarray.DataArray (x: 5, y: 5)> array([[False, False, False, False, False], [False, False, True, True, True], [ True, True, True, True, True], [ True, True, True, False, False], [False, False, False, False, False]], dtype=bool) Coordinates: * x (x) int64 0 1 2 3 4 * y (y) int64 0 1 2 3 4

Is this what you were expecting?

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