rigoudyg / climaf

CliMAF - a Climate Model Analysis Framework - doc at : http://climaf.readthedocs.org/
Other
17 stars 7 forks source link

Can CliMAF handle multiple realizations when project=='CMIP5' ? #233

Closed jypeter closed 3 years ago

jypeter commented 3 years ago

It's very possible I'm doing something wrong. I'm trying to update a script that was working with CMIP6 to also work with CMIP5

I have a CMIP5 variable that is available for two realizations, r1i1p1 and r2i1p1

[jypmce@ciclad-ng ~]$ find /bdd/CMIP5/output/NCAR/CCSM4/midHolocene/mon/atmos/Amon/*/latest/tas/ -name '*.nc'

/bdd/CMIP5/output/NCAR/CCSM4/midHolocene/mon/atmos/Amon/r1i1p1/latest/tas/tas_Amon_CCSM4_midHolocene_r1i1p1_100001-130012.nc

/bdd/CMIP5/output/NCAR/CCSM4/midHolocene/mon/atmos/Amon/r2i1p1/latest/tas/tas_Amon_CCSM4_midHolocene_r2i1p1_126901-130012.nc

But CliMAF seems to find only one!

[jypmce@ciclad-ng ~]$ module load climaf/2.0.0-python3.6
Loading climaf/2.0.0-python3.6
  Loading requirement: nco/4.5.2 ncl/6.3.0 cdo/1.9 netcdf4/4.3.3.1-gfortran

[jypmce@ciclad-ng ~]$ python
Python 3.6.11 | packaged by conda-forge | (default, Aug  5 2020, 20:09:42)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from climaf.api import *
python => 3.6.11 | packaged by conda-forge | (default, Aug  5 2020, 20:09:42)
[GCC 7.5.0]
---
Required softwares to run CliMAF => you are using the following versions/installations:
ncl 6.6.2 => /modfs/modtools/miniconda3/envs/analyse_3.6/bin/ncl
cdo 1.9.6 => /opt/nco/1.9/bin/cdo
nco (ncks) 4.5.2 => /opt/nco-4.5.2/bin/ncks
ncdump such => /prodigfs/ipslfs/dods/jservon/miniconda/envs/cesmep_env/bin/ncdump
Check stamping requirements
nco (ncatted) found -> /opt/nco-4.5.2/bin/ncatted
convert found -> /usr/bin/convert
pdftk found -> /usr/bin/pdftk
exiv2 found -> /ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0/bin/exiv2
---
CliMAF version = 2.0.0
CliMAF install => /ciclad-home/jservon/Evaluation/CliMAF/climaf_installs/climaf_V2.0.0
Cache directory set to : /data/jypmce/climafcache (use $CLIMAF_CACHE if set)
Cache directory for remote data set to : /data/jypmce/climafcache/remote_data (use $CLIMAF_REMOTE_CACHE if set)
Available macros read from ~/.climaf.macros are : []

>>> clog('critical')

>>> selected_facets = {'project': 'CMIP5', 'experiment': 'midHolocene', 'variable': 'tas', 'table': 'Amon', 'period': '*'}

>>> model_query = ds(model='CCSM4', **selected_facets)

>>> model_query
ds('CMIP5%%tas%*%global%/bdd%CCSM4%Amon%midHolocene%r1i1p1%*%*%latest')

>>> model_query.explore('choices')
{'period': [1000-1300], 'frequency': 'mon', 'realm': 'atmos'}

>>> summary(model_query)
/bdd/CMIP5/output/NCAR/CCSM4/midHolocene/mon/atmos/Amon/r1i1p1/latest/tas/tas_Amon_CCSM4_midHolocene_r1i1p1_100001-130012.nc
{'project': 'CMIP5', 'simulation': '', 'variable': 'tas', 'period': '*', 'domain': 'global', 'root': '/bdd', 'model': 'CCSM4', 'table': 'Amon', 'experiment': 'midHolocene', 'realization': 'r1i1p1', 'frequency': '*', 'realm': '*', 'version': 'latest'}

>>> model_query.listfiles()
'/bdd/CMIP5/output/NCAR/CCSM4/midHolocene/mon/atmos/Amon/r1i1p1/latest/tas/tas_Amon_CCSM4_midHolocene_r1i1p1_100001-130012.nc'

>>> model_query.kvp
{'project': 'CMIP5', 'simulation': '', 'variable': 'tas', 'period': '*', 'domain': 'global', 'root': '/bdd', 'model': 'CCSM4', 'table': 'Amon', 'experiment': 'midHolocene', 'realization': 'r1i1p1', 'frequency': '*', 'realm': '*', 'version': 'latest'}

The CMIP5 projects has a realization facet, so why am I not getting 2 realizations ?

>>> cprojects['CMIP5'].facets
['project', 'simulation', 'variable', 'period', 'domain', 'root', 'model', 'table', 'experiment', 'realization', 'frequency', 'realm', 'version']
senesis commented 3 years ago

Because you didn't specify realization = '*', CliMAF uses a default value, which is specific to the project.

Default values for facets can be queried using function cdef

>>> cdef('realization', project='CMIP5')
'r1i1p1'
>>> cdef('realization', project='CMIP6')
'r1i1p1f*'