Skip to content

How obtain the mean of a series of DataArray? #5509

Answered by keewis
leonardojimenez1990 asked this question in Q&A
Discussion options

You must be logged in to vote

from what I could understand, you first select a specific region of interest, select a time slice, compute a mean over all Marches in that time slice and the region of interest, group each individual March by comparing its mean over the region of interest with that total mean and finally compute a mean over those two groups.

In other words:

with xr.open_dataset('sst.mean.anom.nc') as ds:
    # region of interest
    sst = ds.sst.isel(lat=slice(20, 87), lon=slice(60, 70))

# time slice
sst_1948_1998 = sst.sel(time=slice('1948-03-01', '1998-03-01'))
# all first-of-Marches
# not sure if there's a better way for this, you can probably also use .isel(time=slice(None, None, 12)) instead
selected =

Replies: 2 comments 16 replies

Comment options

You must be logged in to vote
7 replies
@leonardojimenez1990
Comment options

@max-sixty
Comment options

@leonardojimenez1990
Comment options

@keewis
Comment options

@leonardojimenez1990
Comment options

Comment options

You must be logged in to vote
9 replies
@leonardojimenez1990
Comment options

@keewis
Comment options

@leonardojimenez1990
Comment options

@keewis
Comment options

@leonardojimenez1990
Comment options

Answer selected by keewis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants