home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 830638672

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
830638672 MDU6SXNzdWU4MzA2Mzg2NzI= 5030 `missing_dims` option for aggregation methods like `mean` and `std` 14314623 open 0     5 2021-03-12T23:12:08Z 2022-03-03T22:37:16Z   CONTRIBUTOR      

I work a lot with climate model output and often loop over several models, of which some have a 'member' dimension and others don't.

I end up writing many lines like this: python for ds in model_datasets: if 'member_id' in ds.dims: ds = ds.mean('member_id) Which often makes for very lengthy code blocks.

I recently noticed that .isel() actually has a nifty keyword argument 'missing_dims', which enables the user to apply isel and it just doesn't do anything when the dimension is not present.

I'd love to be able to do: python for ds in model_datasets: ds = ds.mean('member_id', missing_dims='ignore') Is there a way to implement this generally for xarray aggregation methods (mean/max/min/std/...). Or is there a reason this should be avoided?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/5030/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 0.532ms · About: xarray-datasette