home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 838231568

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/5284#issuecomment-838231568 https://api.github.com/repos/pydata/xarray/issues/5284 838231568 MDEyOklzc3VlQ29tbWVudDgzODIzMTU2OA== 56925856 2021-05-11T10:28:08Z 2021-05-12T20:45:00Z CONTRIBUTOR

Thanks for that @dcherian ! I didn't know you could use print debugging on chunked operations like this!

One thing actually: If I change da = da.where(missing_vals) to da = da.where(~missing_vals) then we get the results we'd expect. Do you think this fixes the problem?

``` def _get_valid_values(da, other): da1, da2 = xr.align(da, other, join="outer", copy=False)

# 2. Ignore the nans
missing_vals = np.logical_or(da1.isnull(), da2.isnull())

if missing_vals.any():
    da = da.where(~missing_vals)
    return da
else:
    return da

```

print(da_a.map_blocks(_get_valid_values, args=[da_b]).compute()) <xarray.DataArray (space: 3, time: 4)> array([[1. , 2. , 3. , 4. ], [1. , 0.1, 0.2, 0.3], [2. , 3.2, nan, 1.8]]) Coordinates: * time (time) datetime64[ns] 2000-01-01 2000-01-02 2000-01-03 2000-01-04 * space (space) object 'IA' 'IL' 'IN' *

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