-
Notifications
You must be signed in to change notification settings - Fork 12
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 Z axis support for spatial averaging #596
Comments
@tomvothecoder - FYI - I thought this might only be a couple lines and took a look. It ended up being a little more than I thought, but I committed a working prototype because I thought it might be helpful (needs validation, review to make sure the docs are updated correctly, and unit tests). It could be possible to combine some of the _get_XYZ_weights functionality, but maybe it is fine as-is. We can delete the branch if you have something in progress already. Or I can open a PR. |
@pochedls Thanks for taking a stab at this so quickly! You can open a PR and tag me for review. As a temporary workaround in |
Discussed in #591
Originally posted by tomvothecoder January 29, 2024
Is your feature request related to a problem?
I'm running into a case where I need to average over the Z axis. The CDAT code being used is
cdutil.averager(tvar, axis="z")
, which I need to replace.xCDAT's spatial averager, which is based on
cdutil.averager()
, only supports rectilinear grids ("X" and "Y"). However, we do mention that theget_weights()
method can be extended to support other axes:xcdat/xcdat/spatial.py
Lines 246 to 252 in fbf1db6
Are there are any possible answers you came across?
No response
Describe alternatives you've considered
No response
Additional context
For the short-term, I might be able to use xarray.DataArray.weighted directly. However, I still need to generate the weights xr.DataArray beforehand.
The text was updated successfully, but these errors were encountered: