from IPython.display import Image
Image(url='https://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/jservon/CliMAF_Notebooks_html/CliMAF-logo-small.png')
The goals of CliMAF are to provide the scientists with simplified and science-oriented means for :
How we:
https://climaf.readthedocs.io/en/master/std_operators.html
from climaf.api import *
clog('critical') # min verbosity = critical < warning < info < debug = max verbosity
# -- We use ds() to get the dataset
dat_cmip5 = ds(project='CMIP5',
model='CNRM-CM5',
variable='tos',
experiment='historical',
period='1980-2000',
frequency='monthly',
simulation='r1i1p1',
version='latest'
)
summary(dat_cmip5)
# -- summary() gives the list of files found by ds() and the pairs 'facets':'values' associated with the request
# -> The user can then refine the request to select only one file
help(clim_average)
# -- Annual mean
annual_mean_dat_cmip5 = clim_average(dat_cmip5, 'ANM')
# -- DJF and JJA climatologies
djf_dat_cmip5 = clim_average(dat_cmip5, 'DJF')
jja_dat_cmip5 = clim_average(dat_cmip5, 'JJA')
# -- Climatology of March
march_dat_cmip5 = clim_average(dat_cmip5, 'March')
Let's get a reference for dat2:
ref = ds(project='ref_climatos',
variable='tos',
product='WOA13-v2',
clim_period='195501-201212'
).explore('resolve')
summary(ref)
rgrd_annual_mean_dat_cmip5 = regrid(annual_mean_dat_cmip5, ref)
cfile(rgrd_annual_mean_dat_cmip5)
regridn() is based on cdo; you can specify the destination grid (cdogrid) and the regridding method (option='remapcon', 'remapbil'...)
help(regridn)
# -- Standard = remapbil
rgrd_anm_dat_cmip5 = regridn(annual_mean_dat_cmip5, cdogrid='r360x180')
print cfile(rgrd_anm_dat_cmip5)
# -- First order conservative (cdo remapcon)
remapcon_rgrd_anm_dat_cmip5 = regridn(annual_mean_dat_cmip5, cdogrid='r360x180', option='remapcon')
print cfile(remapcon_rgrd_anm_dat_cmip5)
# -- Nearest neighbour
remapnn_rgrd_anm_dat_cmip5 = regridn(annual_mean_dat_cmip5, cdogrid='r360x180', option='remapnn')
print cfile(remapnn_rgrd_anm_dat_cmip5)
NAtl_anm_dat_cmip5 = llbox(rgrd_anm_dat_cmip5, lonmin=-80, lonmax=40, latmin=20, latmax=80)
implot(NAtl_anm_dat_cmip5)
ccdo() is a very simple way to use any cdo operator, even piped operators, from CliMAF.
You can do A LOT of things with ccdo.
# -- Compute a climatological annual cycle using ymonavg
annual_cycle_dat_cmip5 = ccdo(dat_cmip5, operator='ymonavg')
# --> FYI: the annual_cycle operator already exists -> try in the quick search
cfile(annual_cycle_dat_cmip5)
# -- Pipe CDO operators: select a region on a regridded annual cycle
test = ccdo(dat_cmip5, operator='sellonlatbox,-80,40,20,80 -remapbil,r360x180 -ymonavg')
cfile(test)
https://code.mpimet.mpg.de/projects/cdo/embedded/cdo.pdf
cscript('ctimavg','cdo timavg ${in} ${out}')
my_clim = ctimavg(dat_cmip5)
print my_clim.crs
cfile(my_clim)
Example with ncrcat: takes multiple files as argument and the last one as output/result file
cscript('cncrcat','ncrcat ${ins} ${out}')