-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add a FlagGrouper
to handle grouping by a flag variable
#472
Comments
That would be super cool! Would need to decide if the A short example (using regionmask - could of course be simplified to only using xarray): import cf_xarray
import regionmask
import xarray as xr
air = xr.tutorial.open_dataset("air_temperature")
mask = regionmask.defined_regions.ar6.land.mask(air)
regional_mean = air.air.groupby(mask).mean()
regional_mean = regional_mean.assign_coords({mask.name: mask.attrs["flag_values"]})
regional_mean = regional_mean.assign_coords({"flags": mask.attrs["flag_meanings"]})
# or
regional_mean = regional_mean.assign_coords({mask.name: mask.attrs["flag_meanings"]}) |
With our new Grouper API, this should just be a |
flag_meanings
FlagGrouper
to handle grouping by a flag variable
This would be cool and particularly useful with
regionmask
cc @mathause
The text was updated successfully, but these errors were encountered: