cf-xarray icon indicating copy to clipboard operation
cf-xarray copied to clipboard

add align?

Open dcherian opened this issue 1 year ago • 1 comments

xarray.align only supports an opt-out exclude kwarg, but for these purposes it seems like we'd want an opt-in include kwarg, so that we only aligned along specific user-specified dimensions (so cfxr.align(..., include="vertical")) Or perhaps cfxr.align_along_dims(..., dims="vertical")

xref https://github.com/Unidata/MetPy/issues/1599#issuecomment-1579492224

I imagine a xarray Dataset going in that contains the variables needing to be unified, which will have multiple vertical coordinates (e.g., 'isobaric', 'isobaric3', 'isobaric5', etc.) and out comes a xarray Dataset with all of the same variables subset to the common levels that are available for all of the variables with a single common vertical coordinate name across all of the variables (e.g., 'isobaric_unified').

dcherian avatar Jun 06 '23 21:06 dcherian

Given that renaming to a common dimension name is probably sensible, I lean towards align_along_dims to make it clear that this new function isn't too closely related to xr.align

dcherian avatar Jun 08 '23 02:06 dcherian