-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing_dims
option for aggregation methods like mean
and std
#5030
Comments
That seems like a reasonable suggestion @jbusecke . To confirm, would |
Alternatively, you could run the following at the beginning # not sure if syntax is right
model_datasets = [
ds.expand_dims('member_id')
if "member_id" not in ds.coords else ds
for ds in model_datasets
] so all your datasets are consistent. |
I ran into the same sort of thing today, when trying to loop over many datasets (each of which contained the contents of a node in a datatree...). I also think that adding a |
My concern is that we could conceivably adding For datatree, you could apply the reduction with the set-intersection of provided dims and dims present in a node (if that's the right term). |
I specifically want the user to be able to choose between different behaviours with a flag, but you're right that I could just deal with this at the datatree level instead of here. That would make a fair amount of sense, and it would cover Julius' use-case (via encouraging him to store his models in a tree, so that
Do you think that's a problem though? We added I'm fine with doing it either here or in |
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:
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 applyisel
and it just doesn't do anything when the dimension is not present.I'd love to be able to do:
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?
The text was updated successfully, but these errors were encountered: