home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 242940333

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/987#issuecomment-242940333 https://api.github.com/repos/pydata/xarray/issues/987 242940333 MDEyOklzc3VlQ29tbWVudDI0Mjk0MDMzMw== 1063143 2016-08-27T20:55:59Z 2016-08-27T20:59:09Z NONE

Sure. My actual usage is usually much more complicated, but basically, with

python import numpy as np import xarray as xr X = xr.DataArray(np.random.normal(size=(10, 10)), coords=[range(10), range(10)],)

if I want to choose only values larger than 0 from X, it seems I cannot do X[X > 0], I have to do X.values[X.values > 0]. You can see how this thing can quickly get long if I'm doing this for assignment with multidimensional xarrays - something like

python X.loc[:, :, :, 'variable'].values[X.loc[:, :, :, 'variable'].values > 0] = Y.loc[:, :, :, 'variable'].values[Y.loc[:, :, :, 'variable'].values > 0]

Maybe I'm mistaken and there is a way to do this more nicely, but I haven't been able to figure it out.

Thank you!

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