home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 788507019

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/3390#issuecomment-788507019 https://api.github.com/repos/pydata/xarray/issues/3390 788507019 MDEyOklzc3VlQ29tbWVudDc4ODUwNzAxOQ== 2448579 2021-03-02T01:42:09Z 2021-03-02T01:42:09Z MEMBER

It seems rather unlikely to me to have an example of where with drop=True where the condition is exactly aligned with the grid, such that there are no missing values.

Actually, this is a really common pattern python ds = xr.tutorial.open_dataset('air_temperature') ds.where(ds.time.dt.hour.isin([0, 12]), drop=True)

The efficient way to do this is python ds.loc[{"time": ds.time.dt.hour.isin([0, 12])}] or

python ds.sel(time=ds.time.dt.hour.isin([0, 12]))

At this point https://github.com/pydata/xarray/blob/48378c4b11c5c2672ff91396d4284743165b4fbe/xarray/core/common.py#L1270-L1273

cond is all True and applying where is basically a totally useless copy since the isel has already copied.

Shall we raise a warning in where advising the more-efficient syntax? Or shall we skip the call to where_method

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