from IPython.display import Image
Image(url='https://vesg.ipsl.upmc.fr/thredds/fileServer/IPSLFS/jservon/CliMAF_Notebooks_html/CliMAF-logo-small.png')
In this notebook we will see how the CliMAF cache works and how to:
https://climaf.readthedocs.io/en/master/functions_results_cache.html
from climaf.api import *
clog('critical') # min verbosity = critical < warning < info < debug = max verbosity
# -- Check which cache your are using
from climaf.cache import cachedirs
cachedirs
cachedir = cachedirs[0]
!cat $cachedir/index
clist()
https://climaf.readthedocs.io/en/master/functions_results_cache.html?highlight=craz#craz-reset-cache
craz()
clist()
# -- Let's get some data as a start
dat_cmip5 = ds(project='CMIP5',
model='CNRM-CM5',
variable='tos',
experiment='historical',
period='1980-2000',
frequency='monthly',
simulation='r1i1p1',
)
summary(dat_cmip5)
dat_cmip5.crs
cfile(dat_cmip5)
clist()
cfile(dat_cmip5)
ref = ds(project='ref_climatos', variable='tos', product='WOA13-v2',clim_period='195501-201212')
summary(ref)
# -- Compute a DJF climatology
djf_dat = clim_average(dat_cmip5, 'DJF')
djf_ref = clim_average(ref, 'DJF')
# -- Regrid ref and simulation on the same regular grid
rgrd_dat = regridn(djf_dat, cdogrid='r360x180')
rgrd_ref = regridn(djf_ref, cdogrid='r360x180')
# -- And compute the difference
bias = minus(rgrd_dat, rgrd_ref)
# -- Make a simple plot
myplot = plot(bias)
# -- And execute the final object
cfile(myplot)
clist()
cdrop(rgrd_dat)
cdrop(rgrd_ref)
clist()
crm(pattern='CNRM-CM5')
clist()
crm(age='+20')
crm(size='2M')
cdu()
crm(pattern='CNRM-CM5', age='+20', size='3M')
# -- And execute the final object
cfile(myplot)
clist()
cprotect(djf_dat)
cprotect(djf_ref)
cprotect(myplot)
craz()
clist()
cdrop(myplot, force=True)
clist()
# -- Check the content of the index file:
!cat $cachedir/index
# -- Synchronize
csync(True)
# -- And check the index file after
!cat $cachedir/index