In [2]:
import warnings
warnings.filterwarnings('ignore')
import glob
import xarray as xr
In [3]:
infiles = glob.glob('/g/data/ua6/DRSv3/CMIP5/CCSM4/historical/mon/ocean/r1i1p1/thetao/latest/thetao_Omon_CCSM4_historical_r1i1p1_??????-??????.nc')
infiles.sort()
In [4]:
df = xr.open_mfdataset(infiles)
In [5]:
df.thetao
Out[5]:
In [6]:
thetao_annual = df.thetao.groupby('time.year').mean(dim='time')
In [7]:
thetao_annual
Out[7]:
In [8]:
test = thetao_annual.values
In [9]:
test.shape
Out[9]:
I think xarray is automatically using dask under the hood here, which is why it's able to perform this task.
In [ ]: