Replies: 1 comment 6 replies
-
Hi @briochemc check out xCDAT, which builds on xarray. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
👋 Noob here so maybe this is a dumb question but here I go.
Given a dataset
ds
with some variablefoo
with atime
coordinate (among others likex
,y
,z
, and so on) that also includestime_bnds
, what's the preferred way to get the time-weighted average offoo
(that uses thetime_bnds
data)?Adapting Calculating Seasonal Averages from Time Series of Monthly Means from the docs, I know I could manually extract
deltatime = ds["time_bnds"].sel(bnds=1) - ds["time_bnds"].sel(bnds=0)
and build weights fromweights = deltatime / deltatime.sum()
and then do the weighted sum(foo * weights).sum()
or something similar, but I was hoping there is a predefined automatic way to that in a single liner with xarray. Is that the case?Beta Was this translation helpful? Give feedback.
All reactions