Example #1
0
def create_global_mean_ts_plot(model,
                               experiment,
                               start_year,
                               end_year,
                               variable,
                               output='output.png'):
    """
    Create a global average time series of CMIP5 variable and plot to output.

    Arguments:
      model:       climate model ID [string]
      experiment:  experiment name [string]
      start_year:  4-digit start year [string or integer]
      end_year:    4-digit end year [string or integer]
      variable:    variable ID [string]
      output:      output file name [string]

    Return: plot object
    """
    # Set data location to CMIP5 archive on local file system
    cmip5_path = configuration.get_config_value("data", "archive_root")
    LOGGER.info("CMIP5 data path: %s", cmip5_path)
    dataloc(project="CMIP5", organization="CMIP5_DRS", url=[cmip5_path])
    # Define a dataset selection from the CMIP5 project, using user inputs
    dset = ds(project='CMIP5',
              model=model,
              experiment=experiment,
              frequency='monthly',
              period='{}-{}'.format(start_year, end_year),
              variable=variable)
    # Calculate the spatial average
    gmean = space_average(dset)
    # Generate the time series plot object
    p = plot(gmean,
             title='Global mean time series of CMIP5: {}, {}, {}'.format(
                 variable, model, experiment),
             format='png')
    # Write the plot to the output file and return it
    cfile(p, target=output)
    return p
Example #2
0
    # -- Specify the pattern
    pattern1 = "${root}/${login}/IGCM_OUT/${IPSL_MODEL}/${status}/${experiment}/${simulation}/CMIP6/${realm}/" \
               "${variable}_*${frequency}_${model}_${experiment}_${realization}_${grid}_${PERIOD}.nc"
    pattern2 = "${root}/${login}/IGCM_OUT/${IPSL_MODEL}/${status}/${experiment}/${simulation}/CMIP6/${realm}/" \
               "${variable}_${table}_${model}_${experiment}_${realization}_${grid}_${PERIOD}.nc"
    # pattern3="${root}/${login}/IGCM_OUT/${IPSL_MODEL}/${status}/${experiment}/${simulation}/CMIP6/${realm}/"
    #          "${variable}_${MIP_prefix}${frequency}${MIP_suffix}${qualifier}_${model}_${experiment}_${realization}_"
    #          "${grid}_${PERIOD}.nc"
    # pattern4="${root}/${login}/IGCM_OUT/${IPSL_MODEL}/${status}/${experiment}/${simulation}/CMIP6/${realm}/"
    #          "${variable}_${miptable}_${model}_${experiment}_${realization}_${grid}_${PERIOD}.nc"
    # -- Si on precise seulement la MIP table, on n'a pas la frequence ;
    #    on pourrait rajouter une analyse de la table, si elle existe, pour rajouter la frequence?
    #

    # pattern1="${root}/*/${variable}_${table}_${model}_${experiment}_${realization}_${gr}_${PERIOD}.nc"
    # pattern2="${root}/${variable}_${table}_${model}_${experiment}_${realization}_${gr}_${PERIOD}.nc"
    # -- call the dataloc CliMAF function
    dataloc(project='IGCM_CMIP6', organization='generic', url=[pattern2])

    calias('IGCM_CMIP6', 'tos', offset=273.15)
    calias('IGCM_CMIP6', 'thetao', offset=273.15)
    calias('IGCM_CMIP6', 'sic', 'siconc')
    calias('IGCM_CMIP6', 'sit', 'sithick')
    calias('IGCM_CMIP6', 'wfo', 'wfonocorr')
    calias('IGCM_CMIP6', 'sivolu', 'sivol')
    calias('IGCM_CMIP6', 'NO3', 'no3')
    calias('IGCM_CMIP6', 'PO4', 'po4')
    calias('IGCM_CMIP6', 'Si', 'si')
    calias('IGCM_CMIP6', 'O2', 'o2')
Example #3
0
"""

This module declares the project E-OBS : 
This archive is available on Ciclad (IPSL)

The specific attributes are:
- grid : '*'


"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs, cdef
from climaf.site_settings import onCiclad, atTGCC, atIDRIS, atCerfacs, atCNRM

if onCiclad:
    # -- Create E-OBS CliMAF project
    EOBS_pattern = '/bdd/E-OBS/Grid_${grid}/${variable}_${grid}_${PERIOD}_v15.0.nc4'
    cproject('E-OBS', 'grid', 'frequency', separator='%')
    dataloc(project='E-OBS', organization='generic', url=EOBS_pattern)

    # -- Make a
    cdef('frequency', 'daily', project='E-OBS')
    cdef('grid', '*deg_*', project='E-OBS')
    cdef('period', '*', project='E-OBS')
    cdef('variable', '*', project='E-OBS')
    cfreqs('E-OBS', {'daily': 'day'})

    calias('E-OBS', 'tasmin', 'tn')
    calias('E-OBS', 'tasmax', 'tx')
Example #4
0
import os
from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs,cdef
from climaf.site_settings import atCNRM, onCiclad, atCEDA

p=cproject("CMIP5" ,"model","experiment", ("frequency","monthly"),
           ("table","*"),("realm","*"),("version","last"),
           ensemble=["model","simulation"])
cdef("simulation","r1i1p1",project="CMIP5")

# Frequency alias
cfreqs('CMIP5', {'monthly':'mon' , 'daily':'day' })

urls_CMIP5=None

if atCNRM :
    # Declare the directory for CNRM-CM CMIP5 data on CNRM's Lustre file system.
    urls_CMIP5=["/cnrm/cmip/cnrm/ESG"]
if onCiclad :
    # Declare a list of root directories for CMIP5 data on IPLS's Ciclad file system
    urls_CMIP5=["/prodigfs/project/"]
if atCEDA:
    urls_CMIP5=["/badc/cmip5/data"]

if urls_CMIP5 :
    # Next command will lead to explore all directories in 'url' 
    # for searching data for a CliMAF dataset (by function ds) except if 
    # a more specific dataloc entry matches the arguments to 'ds'
    dataloc(project="CMIP5", organization="CMIP5_DRS", url=urls_CMIP5)
Example #5
0
    # -- Declare the various CORDEX CliMAF project
    # --------------------------------------------- >
    pattern1 = '${root}/CORDEX/output/${CORDEX_domain}/${institute}/${driving_model}/${experiment}/${realization}/' \
               '${model}/${model_version}/${frequency}/${variable}/${version}/' \
               '${variable}_${CORDEX_domain}_${driving_model}_${experiment}_${realization}_${model}_${model_version}_' \
               '${frequency}_${PERIOD}.nc'
    pattern2 = '${root}/CORDEX/output/${CORDEX_domain}/${institute}/${driving_model}/${extent_experiment}/' \
               '${realization}/${model}/${model_version}/${frequency}/${variable}/${version}/' \
               '${variable}_${CORDEX_domain}_${driving_model}_${extent_experiment}_${realization}_${model}_' \
               '${model_version}_${frequency}_${PERIOD}.nc'

    # -- CORDEX
    cproject('CORDEX', 'root', 'model', 'CORDEX_domain', 'model_version', 'frequency', 'driving_model',
             'realization', 'experiment', 'version', 'institute', ensemble=['model', 'driving_model', 'realization'],
             separator='%')
    dataloc(project='CORDEX', url=[pattern1])
    cdef('experiment', '*', project='CORDEX')
    cdef('model_version', '*', project='CORDEX')

    # -- CORDEX extent (historical + scenario at once)
    cproject('CORDEX_extent', 'root', 'model', 'CORDEX_domain', 'model_version', 'frequency', 'driving_model',
             'realization', 'experiment', 'extent_experiment', 'version', 'institute',
             ensemble=['model', 'driving_model', 'realization'], separator='%')
    dataloc(project='CORDEX_extent', url=[pattern1])
    dataloc(project='CORDEX_extent', url=[pattern2])
    cdef('extent_experiment', 'rcp85', project='CORDEX_extent')
    cdef('experiment', 'historical', project='CORDEX_extent')
    cdef('model_version', '*', project='CORDEX_extent')

    # -- CORDEX Adjust
    pattern = '${root}/CORDEX-Adjust/bias-adjusted-output/${CORDEX_domain}/${institute}/${driving_model}/' \
Example #6
0
    ensemble=["model", "simulation"],
)
cdef("simulation", "r1i1p1", project="CMIP5")

# Frequency alias
cfreqs("CMIP5", {"monthly": "mon", "daily": "day"})

urls_CMIP5 = None

if os.path.exists("/cnrm"):
    # Declare a list of root directories for CNRM-CM CMIP5 data on CNRM's Lustre file system.
    urls_CMIP5 = [
        "/cnrm/aster/data2/ESG/data1",
        "/cnrm/aster/data2/ESG/data2",
        "/cnrm/aster/data2/ESG/data5",
        "/cnrm/aster/data4/ESG/data6",
        "/cnrm/aster/data4/ESG/data7",
        "/cnrm/aster/data4/ESG/data8",
        "/cnrm/aster/data2/ESG/vdr",
    ]
else:
    if os.path.exists("/prodigfs"):
        # Declare a list of root directories for CMIP5 data on IPLS's Ciclad file system
        urls_CMIP5 = ["/prodigfs/esg"]

if urls_CMIP5:
    # Next command will lead to explore all directories in 'url'
    # for searching data for a CliMAF dataset (by function ds) except if
    # a more specific dataloc entry matches the arguments to 'ds'
    dataloc(project="CMIP5", organization="CMIP5_DRS", url=urls_CMIP5)
Example #7
0
"""
This module declares locations for searching data for project OBS4MIP at CNRM (VDR),  for
all frequencies; see file:///cnrm/vdr/DATA/Obs4MIPs/doc/

Additional attribute for OBS4MIPS datasets  : 'frequency'

Example for an OBS4MIPS CMIP5 dataset declaration ::

 >>> pr_obs=ds(project='OBS4MIPS', variable='pr', simulation='GPCP-SG', frequency='monthly', period='1979-1980')


"""
import os.path

if os.path.exists('/cnrm'):
    from climaf.dataloc import dataloc
    from climaf.classes import cproject, calias, cfreqs

    cproject("OBS4MIPS","experiment",("frequency","monthly"))
    # Frequency alias
    cfreqs('OBS4MIPS', {'monthly':'monthly_mean' })
    #
    pattern="/cnrm/vdr/DATA/Obs4MIPs/netcdf/${frequency}/${variable}_${simulation}_*_YYYYMM-YYYYMM.nc"
    dataloc(project="OBS4MIPS", organization="generic", url=[pattern])


Example #8
0
cfreqs('ref_climatos', {
    'monthly': 'mo',
    'daily': 'day',
    'seasonal': 'mo',
    'annual_cycle': 'mo'
})

cdef('variable', '*', project='ref_climatos')
cdef('product', '*', project='ref_climatos')
cdef('clim_period', '*', project='ref_climatos')
cdef('simulation', 'refproduct', project='ref_climatos')
cdef('period', 'fx', project='ref_climatos')

if (root):
    pattern2 = root + "climatos/*/${frequency}/${variable}/${product}/ac/${variable}_*mon_${product}_${clim_period}-clim.nc"
    dataloc(project='ref_climatos', organization='generic', url=pattern2)

##########################################################################################

cproject('ref_ts', ('frequency', 'monthly'), ('product', '*'),
         ('period', '1900-2050'))
cfreqs('ref_ts', {'monthly': 'mo', 'daily': 'day'})

cdef('variable', '*', project='ref_ts')
cdef('product', '*', project='ref_ts')
cdef('simulation', 'refproduct', project='ref_ts')
cdef('period', '1980-2005', project='ref_ts')

if (root):
    pattern1 = root + "ts/*/${frequency}/${variable}/${variable}_*mon_${product}*_YYYYMM-YYYYMM.nc"
    dataloc(project='ref_ts', organization='generic', url=[pattern1])
Example #9
0
"""

This module declares PCMDI reference products on ciclad data organization and specifics, as managed by J. Servonnat at IPSL;

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs, cdef
from climaf.site_settings import onCiclad

cfreqs('ref_pcmdi', {'monthly':'mo' , 'daily':'day' , 'seasonal':'mo', 'annual_cycle':'mo'})


if onCiclad:
    cproject('ref_pcmdi', ('frequency','annual_cycle'), 'product', 'clim_period')
    cdef('variable',     '*',           project='ref_pcmdi')
    cdef('product',      '*',           project='ref_pcmdi')
    cdef('clim_period',  '*',           project='ref_pcmdi')
    cdef('period',       '1950-2015',   project='ref_pcmdi')
    root="/data/jservon/Evaluation/ReferenceDatasets/PCMDI-MP/obs/*/${frequency}/${variable}/${product}/ac/"
    pattern2=root+"${variable}_*mon_${product}_${clim_period}-clim.nc" 
    dataloc(project='ref_pcmdi', organization='generic', url=pattern2)


Example #10
0
"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('erai',('grid','_'), ('frequency','monthly'))  # no grid writes as '_' , otherwise as e.g. 'T42' or 'T127' 

    root="/cnrm/vdr/DATA/OBS/netcdf/${frequency}"
    patmonth1=root+"_mean/erai/erai_???_mm_${variable}${grid}YYYY-YYYY.nc"   #for original grid
    patmonth2=root+"_mean/erai/erai_???_mm_${variable}.${grid}.YYYY-YYYY.nc" #for other grids e.g. : grid ='T42' or 'T127'
    patday1=root+"/erai/ei_${variable}${grid}YYYY-YYYY.nc"   #for original grid
    patday2=root+"/erai/ei_${variable}_${grid}_YYYY-YYYY.nc" #for other grids e.g.: grid ='T42' or 'T127'
    dataloc(project='erai', organization='generic', url=[patmonth1,patmonth2,patday1,patday2])


    # Defining alias and derived variables for ERAI, together with filenames
    ##############################################################################
    # Valid both for daily and monthly data (to check : energy flux in W for
    # daily and Joules for monthly ????)

    calias("erai",'sic'    ,'ci'  ,filenameVar='CI')
    calias("erai",'tos'    ,'sst' ,filenameVar='SSTK')
    calias("erai",'z'      ,'z'   ,filenameVar='Z')
    calias("erai",'ta'     ,'t'   ,filenameVar='T')
    calias("erai",'ua'     ,'u'   ,filenameVar='U')
    calias("erai",'va'     ,'v'   ,filenameVar='V')
    calias("erai",'hus'    ,'q'   ,filenameVar='Q')
    calias("erai",'prw'    ,'tcw' ,filenameVar='TCW')
Example #11
0
"""
This module declares project example and its data location for the standard CliMAF distro

Only one additionnal attribute : frequency (but data sample actually includes only frequency= 'monthly')

Example of an 'example' dataset definition ::

 >>> dg=ds(project='example', simulation='AMIPV6ALB2G', variable='tas', period='1980-1981', frequency='monthly')


"""

import os

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs

from climaf import __path__ as cpath
cpath=os.path.abspath(cpath[0]) 

cproject("example" , ("frequency","monthly") )
cfreqs('example',{'monthly':'mon' })

data_pattern_L=cpath+"/../examples/data/${simulation}/L/${simulation}SFXYYYY.nc"
data_pattern_A=cpath+"/../examples/data/${simulation}/A/${simulation}PLYYYY.nc"
dataloc(project="example",organization="generic",url=[data_pattern_A,data_pattern_L])
Example #12
0
 >>> cdef('project','cruts3')
 >>> d=ds(variable='tas',period='198001',grid='')
 >>> d2=ds(variable='tas',period='198001',grid='T127')

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cdef
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('cruts3','grid')  # no grid writes as '', otherwise as e.g. 'T127'

    url1_cruts3="/cnrm/amacs/DATA/OBS/netcdf/monthly_mean/cruts3/${variable}_cru_ts_3${grid}.nc"  #for original grid
    url2_cruts3="/cnrm/amacs/DATA/OBS/netcdf/monthly_mean/cruts3/${variable}_cru_ts_3.${grid}.nc" #for other grids write e.g. as : grid ='T127'
    dataloc(project='cruts3', organization='generic', url=[url1_cruts3,url2_cruts3])


    # Defining alias and derived variables for CRUTS3, together with filenames
    ##############################################################################

    calias("cruts3",'clt'   ,'cld'  ,filenameVar='cld') 
    
    calias("cruts3",'evspsbl','pet' ,scale=1./86400. ,filenameVar='pet',units="kg m-2 s-1")
    #pet:="potential evapotranspiration"; units="mm/day" 
    #evspsbl:="water_evaporation_flux" en kg.m-2.s-1

    calias("cruts3",'pr'    ,'pr'  ,scale=1./(86400.*30.3),filenameVar='pr', units="kg m-2 s-1") 
    #pr:="precipitation"; units="mm" 
    #pr[CMIP5]:="precipitation" en kg.m-2.s-1
Example #13
0
    cdef('period', 'fx', project='NEMO')

    # Frequency alias
    cfreqs('NEMO', {'monthly': '1M', 'daily': '1D', 'seasonal': 'SE', 'annual_cycle': 'SE', 'yearly': '1Y'})

    urls_NEMO = [
        "${root}/${model}/${config}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/${ave_length}/"
        "${simulation}_${PERIOD}_${frequency}_${variable}.nc",
        "${root}/${model}/${config}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/"
        "${frequency}${clim_period_length}/${simulation}_${frequency}_${clim_period}_1M_${variable}.nc"
    ]

    # Next command will lead to explore all directories in 'urls_NEMO'
    # for searching data for a CliMAF dataset (by function ds) except if
    # a more specific dataloc entry matches the arguments to 'ds'
    dataloc(project="NEMO", organization="generic", url=urls_NEMO)

    # -- Note:
    # -- In the project NEMO, we have defined aliases for both the CMIP variable names (aliased to the old igcm names
    #    when necessary)
    # -- and the old IGCM names to take advantage of the mechanisms behind calias (scale, offset, filenameVar)

    # ---------------------------------------- #
    # -- Aliases to the CMIP variable names -- #

    # OCE
    calias("NEMO", 'tos', offset=273.15, filenameVar='grid_T')
    calias("NEMO", 'sos', filenameVar='grid_T')
    calias("NEMO", 'thetao', offset=273.15, filenameVar='grid_T')
    calias("NEMO", 'so', filenameVar='grid_T')
    calias("NEMO", 'zos', filenameVar='grid_T')
Example #14
0
"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('erai-land','grid')  # no grid writes as '_' , otherwise as e.g. 'T127'

    root="/cnrm/vdr/DATA/OBS/netcdf/monthly_mean/erai-land/erai_???_mm_${variable}"
    suffix="YYYY-YYYY.nc"
    #
    url_erai_land1=root+"${grid}"+suffix   #for original grid
    url_erai_land2=root+".${grid}."+suffix #for other grids write e.g. as : grid='T127'
    #
    dataloc(project='erai-land', organization='generic', url=[url_erai_land1,url_erai_land2])


    # Defining alias and derived variables for ERAI-land, together with filenames
    ############################################################################## 

    #asn:="Snow albedo" sans dimension 
    #calias("erai-land",''    ,'asn'  ,filenameVar='ASN') 

    #calias("erai-land",'snw'    ,'rsn'  , scale= 'snd',filenameVar='RSN') ?
    #rsn=Snow density "kg m**-3"ds .nc

    calias("erai-land",'snd' ,'sd'  ,filenameVar='SD')


Example #15
0
configuration files

Simulation names (or 'EXPIDs') are assumed to be unique in the namespace defined by the user's configuration
file, which may include shared simulation

Example for defining an EM dataset::

 >>> tas=ds(project='EM', simulation='GSAGNS1', variable='tas', period='1975', frequency='monthly', realm='L')

 A number of Seaice fields are duly described with 1.e+20 as missing value (which is ill described in data files); see code for details

"""

from climaf.site_settings import atCNRM

if atCNRM :

    from climaf.dataloc import dataloc
    from climaf.classes import cproject, calias, cfreqs
    
    cproject('EM' , ('frequency','monthly'), ('realm','*') )
    cfreqs('EM',{'monthly':'mon' , 'daily':'day1' })
    dataloc(project='EM', organization='EM', url=['dummy'])

    # Ideally, one should be able to write :
    #cmissing('EM',1.e+20, realm='I')
    calias('EM',[ 'sic', 'sit', 'sim', 'snd', 'ialb', 'tsice', 'mpalb', 'snomlet',
                  'tmelt', 'bmelt', 'snc','sic1','sic2', 'sic3', 'sic4', 'ssi', 'ageice'],
           missing=1.e+20)

Example #16
0
 >>> d=ds(variable='pr',period='198001',grid='2.5d', frequency='monthly')
 >>> d2=ds(variable='pr',period='198001',grid='1d',frequency='daily')
 
"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('gpcp', 'grid', ('frequency', 'monthly'),
             separator="_")  # grid writes as '1d', '2.5d', 'T42' or 'T127'

    root = "/cnrm/amacs/DATA/OBS/netcdf/${frequency}"
    patmonth = root + "_mean/gpcp/${variable}_gpcp.${grid}.nc"
    patday = root + "/gpcp/${variable}_gpcp.${grid}.nc"
    dataloc(project='gpcp', organization='generic', url=[patmonth, patday])

    # Defining alias and derived variables for GPCP, together with filenames
    ##############################################################################

    # Original data is mm/day
    calias("gpcp", 'precip', 'precip', filenameVar='pr')
    # Compute in SI
    calias("gpcp",
           'pr',
           'precip',
           scale=1. / 86400.,
           units="kg m-2 s-1",
           filenameVar='pr')
Example #17
0
"""

This module declares reference products on ipsl data organization and specifics, as managed by J. Servonnat at IPSL;

Attributes are : ...

Example of an 'ref_ipsl' project dataset declaration ::

 >>> cdef('project','ref_ipsl')
 >>> d=ds(variable='tas',period='198001'....)
 >>> d2=ds(variable='tas',period='198001', frequency='daily', ....)

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs
from climaf.site_settings import onCiclad

cfreqs('ref_ipsl', {'monthly':'mo' , 'daily':'day' })

if onCiclad:
    cproject('ref_ipsl', ('frequency','monthly'), ('product','*'), ('period','1900-2050'))

    root="/data/jservon/Evaluation/ReferenceDatasets/*/${frequency}/${variable}/"
    pattern1=root+"${variable}_*mon_${product}*_YYYYMM-YYYYMM.nc"
    dataloc(project='ref_ipsl', organization='generic', url=[pattern1])

Example #18
0
Use attributes 'model' and 'frequency'

Example of a path : /prodigfs/OCMIP5/OUTPUT/IPSL/IPSL-CM4/CTL/mon/CACO3/CACO3_IPSL_IPSL-CM4_CTL_1860-1869.nc


Example ::

    >>> cdef('model','IPSL-CM4') 
    >>> cdef('frequency','monthly') 
    >>> cactl=ds(project='OCMIP5_Ciclad', experiment='CTL', variable='CACO3', period='1860-1861')


"""

import os

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs
from climaf.site_settings import onCiclad

if onCiclad :
    cproject("OCMIP5","model","simulation",("frequency","monthly"),ensemble=["model"])
    #
    # Declare which facets can be used for defining an ensemble
    #
    dataloc(project="OCMIP5", organization="generic",
            url=['/prodigfs/OCMIP5/OUTPUT/*/${model}/${simulation}/${frequency}/'
                 '${variable}/${variable}_*_${model}_${simulation}_YYYY-YYYY.nc'])
    #
    cfreqs('OCMIP5',{'monthly':'mon' })
Example #19
0
        'monthly': '1M',
        'daily': '1D',
        'seasonal': 'SE',
        'annual_cycle': 'SE'
    })

    urls_IGCM_OUT_old = [
        "${root}/${login}/IGCM_OUT/${model}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/${ave_length}/${simulation}_YYYYMMDD_YYYYMMDD_${frequency}_${variable}.nc",
        "${root}/${login}/IGCM_OUT/${model}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/${frequency}${clim_period_length}/${simulation}_${frequency}_${clim_period}_1M_${variable}.nc"
    ]

    # Next command will lead to explore all directories in 'urls_IGCM_OUT_old'
    # for searching data for a CliMAF dataset (by function ds) except if
    # a more specific dataloc entry matches the arguments to 'ds'
    dataloc(project="IGCM_OUT_old",
            organization="generic",
            url=urls_IGCM_OUT_old)

    # -- Note:
    # -- In the project IGCM_OUT_old, we have defined aliases for both the CMIP variable names (aliased to the old igcm names when necessary)
    # -- and the old IGCM names to take advantage of the mechanisms behind calias (scale, offset, filenameVar)

    # ---------------------------------------- #
    # -- Aliases to the CMIP variable names -- #

    # OCE
    calias("IGCM_OUT_old",
           'tos',
           'sosstsst',
           offset=273.15,
           filenameVar='grid_T')
Example #20
0
cdef('period',      '0001-3000',  project='IGCM_OUT')


# Frequency alias
cfreqs('IGCM_OUT', {'monthly':'1M' , 'daily':'1D' , 'seasonal':'SE', 'annual_cycle':'SE'})

urls_IGCM_OUT=[
              "/${root}/${login}/IGCM_OUT/${model}/*/${experiment}/${simulation}/${DIR}/${OUT}/*/${simulation}_YYYYMMDD_YYYYMMDD_${frequency}_${variable}.nc",
	      "/${root}/${login}/IGCM_OUT/${model}/*/${experiment}/${simulation}/${DIR}/${OUT}/${frequency}/${simulation}_${frequency}_${clim_period}_1M_${variable}.nc"
              ]


# Next command will lead to explore all directories in 'urls_IGCM_OUT'
# for searching data for a CliMAF dataset (by function ds) except if 
# a more specific dataloc entry matches the arguments to 'ds'
dataloc(project="IGCM_OUT", organization="generic", url=urls_IGCM_OUT)

# OCE
calias("IGCM_OUT", 'tos'     ,'tos'                ,filenameVar='grid_T')
calias("IGCM_OUT", 'sos'     ,'sos'                ,filenameVar='grid_T')
calias("IGCM_OUT", 'to'      ,'thetao'             ,filenameVar='grid_T')
calias("IGCM_OUT", 'so'      ,'so'                 ,filenameVar='grid_T')
calias("IGCM_OUT", 'zos'     ,'zos'                ,filenameVar='grid_T')
calias("IGCM_OUT", 'mlotst'  ,'mldr10_1'           ,filenameVar='grid_T')

# ICE
calias("IGCM_OUT", 'sic',    'siconc',   scale=100 ,filenameVar="ICE") 

# ATM
calias("IGCM_OUT", 'pr'   ,'precip' ,filenameVar='histmth')
calias("IGCM_OUT", 'psl'  ,'slp'    ,filenameVar='histmth')
Example #21
0
      calias(project, 'thetao', offset=273.15)
      calias(project, 'sivolu', 'sivol')
      calias(project, 'sic', 'siconc')
      calias(project, 'sit', 'sithick')
      calias(project, 'NO3', 'no3')
      calias(project, 'PO4', 'po4')
      calias(project, 'Si', 'si')
      calias(project, 'O2', 'o2')

  cdef('extent_experiment', 'ssp585'      , project='CMIP6_extent')


  # -------------
  ## -- Define the patterns
  base_pattern1="${root}/CMIP6/${mip}/${institute}/${model}/${experiment}/${realization}/${table}/"
  base_pattern1+="${variable}/${grid}/${version}/${variable}_${table}_${model}_${experiment}_${realization}_${grid}"
  patterns1=[base_pattern1 + "_${PERIOD}" + ".nc", base_pattern1 + ".nc"]

  base_pattern2="${root}/CMIP6/${mip}/${institute}/${model}/${extent_experiment}/${realization}/${table}/"
  base_pattern2+="${variable}/${grid}/${version}/${variable}_${table}_${model}_${extent_experiment}_${realization}_${grid}"
  patterns2=[base_pattern2 + "_${PERIOD}" + ".nc"]

  ## -- call the dataloc CliMAF function
  #dataloc(project='CMIP6', organization='generic', url=patterns)
  ## -- CMIP6
  dataloc(project='CMIP6', organization='generic', url=patterns1)
  #dataloc(project='CMIP6', organization='generic', url=patternf)
  ## -- CMIP6_extent
  dataloc(project='CMIP6_extent', organization='generic', url=patterns1)
  dataloc(project='CMIP6_extent', organization='generic', url=patterns2)
Example #22
0
    # example : /cnrm/ioga/Users/voldoire/NO_SAVE/PRE6/CPLTEA623O45

    # In project 'emn36', there is a ROOT location, data is organized in
    # REALMS, and we handle data FREQUENCY
    # 'root' stands for em root directory for alla experiment data (EM_NETCDF_DIR)

    cproject("emn36", "root", "group", "frequency", separator="|")

    # Describe data organization : file hierarchy and filename patterns
    ######################################################################

    # User simulations
    pathG = "${root}/${group}/${simulation}/"
    pathI = pathG + "O/${simulation}_1${frequency}_YYYYMMDD_YYYYMMDD_icemod.nc"  # var:T
    pathO = pathG + "O/${simulation}_1${frequency}_YYYYMMDD_YYYYMMDD_grid_${variable}.nc"  # var:T
    dataloc(project="emn36", organization="generic", url=[pathI, pathO])

    # Shared simulations
    pathg = "/cnrm/cmip/cnrm/simulations/${group}/"
    pathgI = pathg + "O/Origin/Monthly/${simulation}/${simulation}_1${frequency}_YYYYMMDD_YYYYMMDD_icemod.nc"
    pathgO = pathg + "O/Origin/Monthly/${simulation}/${simulation}_1${frequency}_YYYYMMDD_YYYYMMDD_grid_${variable}.nc"
    dataloc(project="emn36", organization="generic", url=[pathgI, pathgO])

    # Define default values
    ############################################

    # You do not need to use a GROUPs experiment
    cdef("group", "", project="emn36")

    cdef("frequency", "monthly", project="emn36")
    cfreqs("emn36", {"daily": "d", "monthly": "m"})
Example #23
0
This module declares CERES data organization and specifics, as managed by Sophie T. at CNRM; see file:///cnrm/amacs/DATA/OBS/netcdf/

No attributes in addition to standard ones; and 'simulation' is not used

Version of dataset is implicitly the latest, through symbolic links managed by Sophie. Please
complain to climaf at cnrm dot fr if this does not fit the needs

Example of a 'ceres' project dataset declaration ::

 >>> d=ds('project='ceres, variable='rlds',period='198001',domain=[40.,60.,-10.,+20.])

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('ceres') 
    url_ceres="/cnrm/amacs/DATA/OBS/netcdf/monthly_mean/ceres/${variable}_CERES-EBAF.nc"
    dataloc(project='ceres', organization='generic', url=[url_ceres])

    # No need to define alias for CERES, which sticks to CMIP5 standards
    ##############################################################################

    #calias("ceres",''    ,'rluscs'  ,filenameVar='rluscs') pas de variable correspondante...?
    #rluscs:="Surface Longwave Flux Up, Monthly Means, Clear-Sky conditions"
	


Example #24
0
                   '${realization}/${version}/${variable}/'

    # a pattern for fixed fields
    patternf = pattern1 + '${variable}_${table}_${model}_${experiment}_${realization}.nc'

    # The pattern for fields with a period
    pattern1 += '${variable}_${table}_${model}_${experiment}_${realization}_${PERIOD}.nc'

    # -- And the additionnal pattern for extent
    pattern2 = '${root}/CMIP5/output*/*/${model}/${extent_experiment}/${frequency}/${realm}/${table}/${realization}/' \
               '${version}/${variable}/'
    pattern2 += '${variable}_${table}_${model}_${extent_experiment}_${realization}_${PERIOD}.nc'

    # -- call the dataloc CliMAF function
    # -- CMIP5
    dataloc(project='CMIP5', organization='generic', url=pattern1)
    dataloc(project='CMIP5', organization='generic', url=patternf)
    # -- CMIP5_extent
    dataloc(project='CMIP5_extent', organization='generic', url=pattern1)
    dataloc(project='CMIP5_extent', organization='generic', url=pattern2)

    # -- Make the alias and default values for both projects
    for project in ['CMIP5', 'CMIP5_extent']:
        # calias(project, 'tos', offset=273.15)
        # calias(project, 'thetao', offset=273.15)
        # calias(project, 'sivolu', 'sivol')
        # calias(project, 'sic', 'siconc')
        # calias(project, 'sit', 'sithick')
        calias(project, 'NO3', 'no3')
        calias(project, 'PO4', 'po4')
        calias(project, 'Si', 'si')
Example #25
0
    >>> cdef('model','IPSL-CM4')
    >>> cdef('frequency','monthly')
    >>> cactl=ds(project='OCMIP5_Ciclad', simulation='CTL', variable='CACO3', period='1860-1861')


"""

import os

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs
from climaf.site_settings import onCiclad

if onCiclad:
    cproject("OCMIP5",
             "model",
             "simulation", ("frequency", "monthly"),
             ensemble=["model"])
    #
    # Declare which facets can be used for defining an ensemble
    #
    dataloc(
        project="OCMIP5",
        organization="generic",
        url=[
            '/prodigfs/project/OCMIP5/OUTPUT/*/${model}/${simulation}/${frequency}/'
            '${variable}/${variable}_*_${model}_${simulation}_${PERIOD}.nc'
        ])
    #
    cfreqs('OCMIP5', {'monthly': 'mon'})
Example #26
0
        'monthly': '1M',
        'daily': '1D',
        'seasonal': 'SE',
        'annual_cycle': 'SE'
    })

    urls_IGCM_OUT_CMIP = [
        "${root}/${login}/IGCM_OUT/${model}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/${ave_length}/${simulation}_YYYYMMDD_YYYYMMDD_${frequency}_${variable}.nc",
        "${root}/${login}/IGCM_OUT/${model}/${status}/${experiment}/${simulation}/${DIR}/${OUT}/${frequency}${clim_period_length}/${simulation}_${frequency}_${clim_period}_1M_${variable}.nc"
    ]

    # Next command will lead to explore all directories in 'urls_IGCM_OUT_CMIP'
    # for searching data for a CliMAF dataset (by function ds) except if
    # a more specific dataloc entry matches the arguments to 'ds'
    dataloc(project="IGCM_OUT_CMIP",
            organization="generic",
            url=urls_IGCM_OUT_CMIP)

    # -- Note:
    # -- In the project IGCM_OUT_CMIP, we have defined aliases for both the CMIP variable names (aliased to the old igcm names when necessary)
    # -- and the old IGCM names to take advantage of the mechanisms behind calias (scale, offset, filenameVar)

    # ---------------------------------------- #
    # -- Aliases to the CMIP variable names -- #

    # OCE
    calias("IGCM_OUT_CMIP", 'tos', offset=273.15, filenameVar='grid_T')
    calias("IGCM_OUT_CMIP", 'sos', filenameVar='grid_T')
    calias("IGCM_OUT_CMIP", 'thetao', offset=273.15, filenameVar='grid_T')
    calias("IGCM_OUT_CMIP", 'so', filenameVar='grid_T')
    calias("IGCM_OUT_CMIP", 'zos', filenameVar='grid_T')
Example #27
0
"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('erai-land',
             'grid')  # no grid writes as '_' , otherwise as e.g. 'T127'

    root = "/cnrm/amacs/DATA/OBS/netcdf/monthly_mean/erai-land/erai_???_mm_${variable}"
    suffix = "${PERIOD}.nc"
    #
    url_erai_land1 = root + "${grid}" + suffix  # for original grid
    url_erai_land2 = root + ".${grid}." + suffix  # for other grids write e.g. as : grid='T127'
    #
    dataloc(project='erai-land',
            organization='generic',
            url=[url_erai_land1, url_erai_land2])

    # Defining alias and derived variables for ERAI-land, together with filenames
    ##############################################################################

    # asn:="Snow albedo" sans dimension
    # calias("erai-land",''    ,'asn'  ,filenameVar='ASN')

    # calias("erai-land",'snw'    ,'rsn'  , scale= 'snd',filenameVar='RSN') ?
    # rsn=Snow density "kg m**-3"ds .nc

    calias("erai-land", 'snd', 'sd', filenameVar='SD')
Example #28
0
"""
This module declares project example and its data location for the standard CliMAF distro

Only one additionnal attribute : frequency (but data sample actually includes only frequency= 'monthly')

Example of an 'example' dataset definition ::

 >>> dg=ds(project='example', simulation='AMIPV6ALB2G', variable='tas', period='1980-1981', frequency='monthly')


"""

import os

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cfreqs

from climaf import __path__ as cpath

cpath = os.path.abspath(cpath[0])

cproject("example", ("frequency", "monthly"), separator='|')
cfreqs('example', {'monthly': 'mon'})

data_pattern_L = cpath + "/../examples/data/${simulation}/L/${simulation}SFXYYYY.nc"
data_pattern_A = cpath + "/../examples/data/${simulation}/A/${simulation}PLYYYY.nc"
data_pattern_histmth = cpath + "/../examples/data/${simulation}_SE_1982_1991_1M_ua_pres.nc"
dataloc(project="example", organization="generic", url=[data_pattern_A, data_pattern_L, data_pattern_histmth])

# calias("example",'tas','tas_${frequency}')
Example #29
0
Example of an 'gpcp' project dataset declaration ::

 >>> cdef('project','gpcp')
 >>> d=ds(variable='pr',period='198001',grid='2.5d', frequency='monthly')
 >>> d2=ds(variable='pr',period='198001',grid='1d',frequency='daily')
 
"""


from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('gpcp','grid', ('frequency','monthly'), separator="_")  # grid writes as '1d', '2.5d', 'T42' or 'T127'

    root="/cnrm/vdr/DATA/OBS/netcdf/${frequency}"
    patmonth=root+"_mean/gpcp/${variable}_gpcp.${grid}.nc"
    patday  =root+"/gpcp/${variable}_gpcp.${grid}.nc"
    dataloc(project='gpcp', organization='generic', url=[patmonth,patday])
    
    
    # Defining alias and derived variables for GPCP, together with filenames
    ##############################################################################

    # Original data is mm/day
    calias("gpcp",'precip'    ,'precip', filenameVar='pr')   
    # Compute in SI
    calias("gpcp",'pr'    ,'precip', scale=1./86400.,units="kg m-2 s-1", filenameVar='pr')   
    
Example #30
0
from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('erai', ('grid', '_'),
             ('frequency', 'monthly'
              ))  # no grid writes as '_' , otherwise as e.g. 'T42' or 'T127'

    root = "/cnrm/amacs/DATA/OBS/netcdf/${frequency}"
    patmonth1 = root + "_mean/erai/erai_???_mm_${variable}${grid}${PERIOD}.nc"  #for original grid
    patmonth2 = root + "_mean/erai/erai_???_mm_${variable}.${grid}.${PERIOD}.nc"  #for other grids e.g. : grid ='T42' or 'T127'
    patday1 = root + "/erai/ei_${variable}${grid}${PERIOD}.nc"  #for original grid
    patday2 = root + "/erai/ei_${variable}_${grid}_${PERIOD}.nc"  #for other grids e.g.: grid ='T42' or 'T127'
    dataloc(project='erai',
            organization='generic',
            url=[patmonth1, patmonth2, patday1, patday2])

    # Defining alias and derived variables for ERAI, together with filenames
    ##############################################################################
    # Valid both for daily and monthly data (to check : energy flux in W for
    # daily and Joules for monthly ????)

    calias("erai", 'sic', 'ci', filenameVar='CI')
    calias("erai", 'tos', 'sst', filenameVar='SSTK')
    calias("erai", 'z', 'z', filenameVar='Z')
    calias("erai", 'ta', 't', filenameVar='T')
    calias("erai", 'ua', 'u', filenameVar='U')
    calias("erai", 'va', 'v', filenameVar='V')
    calias("erai", 'hus', 'q', filenameVar='Q')
    calias("erai", 'prw', 'tcw', filenameVar='TCW')
Example #31
0
Example of an 'gpcc' project dataset declaration ::

 >>> cdef('project','gpcc')
 >>> d=ds(variable='pr',period='198001',grid='05d')
 >>> d2=ds(variable='pr',period='198001',grid='1d')
 >>> d3=ds(variable='pr',period='198001',grid='T127')

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('gpcc','grid')  # grid writes as '05d', '1d' or 'T127'

    url_gpcc="/cnrm/vdr/DATA/OBS/netcdf/monthly_mean/gpcc/GPCC.Reanalysis.${grid}.nc"
    dataloc(project='gpcc', organization='generic', url=[url_gpcc])


    # Defining alias and derived variables for GPCC, together with filenames
    ##############################################################################

    calias("gpcc",'pr'       ,'GPCC' ,scale=1./86400. ,missing=1.e+20, units="kg m-2 s-1")

    #calias("gpcc",'GPCC'    ,'GPCC' ,                                   ,units="mm/day")
    #NSTA:="Number of stations available for a specific analysis grid in a specific month" 
    #calias("gpcc",'site'    ,'NSTA'   ) 

Example #32
0
"""

This module declares CERES data organization and specifics, as managed by Sophie T. at CNRM; see file:///cnrm/vdr/DATA/OBS/netcdf/

No attributes in addition to standard ones; and 'simulation' is not used

Version of dataset is implicitly the latest, through symbolic links managed by Sophie. Please
complain to climaf at cnrm dot fr if this does not fit the needs

Example of a 'ceres' project dataset declaration ::

 >>> d=ds('project='ceres, variable='rlds',period='198001',domain=[40.,60.,-10.,+20.])

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject("ceres")
    url_ceres = "/cnrm/vdr/DATA/OBS/netcdf/monthly_mean/ceres/${variable}_CERES-EBAF.nc"
    dataloc(project="ceres", organization="generic", url=[url_ceres])

    # No need to define alias for CERES, which sticks to CMIP5 standards
    ##############################################################################

    # calias("ceres",''    ,'rluscs'  ,filenameVar='rluscs') pas de variable correspondante...?
    # rluscs:="Surface Longwave Flux Up, Monthly Means, Clear-Sky conditions"
Example #33
0
 >>> cdef('project','gpcc')
 >>> d=ds(variable='pr',period='198001',grid='05d')
 >>> d2=ds(variable='pr',period='198001',grid='1d')
 >>> d3=ds(variable='pr',period='198001',grid='T127')

"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias
from climaf.site_settings import atCNRM

if atCNRM:
    cproject('gpcc', 'grid')  # grid writes as '05d', '1d' or 'T127'

    url_gpcc = "/cnrm/amacs/DATA/OBS/netcdf/monthly_mean/gpcc/GPCC.Reanalysis.${grid}.nc"
    dataloc(project='gpcc', organization='generic', url=[url_gpcc])

    # Defining alias and derived variables for GPCC, together with filenames
    ##############################################################################

    calias("gpcc",
           'pr',
           'GPCC',
           scale=1. / 86400.,
           missing=1.e+20,
           units="kg m-2 s-1")

    #calias("gpcc",'GPCC'    ,'GPCC' ,                                   ,units="mm/day")
    #NSTA:="Number of stations available for a specific analysis grid in a specific month"
    #calias("gpcc",'site'    ,'NSTA'   )
Example #34
0
    # 'root' stands for em root directory for alla experiment data (EM_NETCDF_DIR)

    cproject("em","root","group","realm", "frequency",separator="|")

    # Describe data organization : file hierarchy and filename patterns
    ######################################################################

    # User simulations
    pathg="${root}/${group}/${simulation}/"
    pathA=pathg+"${realm}/${simulation}PLYYYY.nc" #GSAG
    pathL=pathg+"${realm}/${simulation}SFXYYYY.nc"
    pathI=pathg+"${realm}/${variable}_O1_YYYY-YYYY.nc" #HISTNATr8
    pathO=pathg+"${realm}/${simulation}_1${frequency}_${PERIOD}_grid_${variable}.nc" # var:T_table2.2
    pathO2=pathg+"${realm}/${simulation}_1${frequency}_${PERIOD}_scalar_table2.2.nc" # PICTLWS2, PRE6CPLCr2alb
    
    dataloc(project="em", organization="generic", url=[pathA,pathL,pathI,pathO,pathO2])
    
    # Shared simulations - example : group=SC
    pathg="/cnrm/cmip/cnrm/simulations/${group}/"
    pathgA=pathg+"${realm}/Regu/${frequency}/${simulation}/${simulation}PLYYYY.nc" #C1P60
    pathgL=pathg+"${realm}/Regu/${frequency}/${simulation}/${simulation}SFXYYYY.nc" #C1P60
    pathgI=pathg+"${realm}/Origin/Monthly/${simulation}/${variable}_O1_${PERIOD}.nc" #HISTNATr8
    pathgO=pathg+"${realm}/Origin/Monthly/${simulation}/${simulation}_1${frequency}_${PERIOD}_grid_${variable}.nc" 
    
    dataloc(project="em", organization="generic", url=[pathgA,pathgL,pathgI,pathgO])
    

    # Define default values
    ############################################

    # You do not need to use a GROUPs experiment
Example #35
0
    cproject('CMIP3',
             'root',
             'model',
             'realm',
             'experiment',
             'realization',
             'frequency',
             ensemble=['model', 'realization'],
             separator='%')

    ## -- Define the pattern for CMIP3 data
    pattern1 = '${root}/${experiment}/${realm}/${frequency}/${variable}/${model}/${realization}/'
    pattern1 += '${variable}_*.nc'

    ## -- call the dataloc CliMAF function
    dataloc(project='CMIP3', organization='generic', url=pattern1)

    # -- Make the alias and default values for both projects
    for project in ['CMIP3']:
        #calias(project, 'tos', offset=273.15)

        cdef('root', root, project=project)
        cdef('realm', '*', project=project)
        cdef('realization', '*', project=project)
        cdef('experiment', 'sresa1b', project=project)
        cdef('frequency', 'mo', project=project)
        cdef('period', '*', project=project)

        cfreqs(project, {
            'monthly': 'mo',
        })
Example #36
0
if atCerfacs:
    root = "/data/scratch/globc/dcom/globc_obs/OBS4MIPS_ANA4MIPS_CMOR/Tier1/ERA5/"
if atCNRM:
    root = "/cnrm/est/COMMON/climaf/reference_datasets_from_IPSL/"

cproject('ref_era5cerfacs', ('frequency', 'monthly'),
         'product', ('period', '1979-2018'),
         'obs_type',
         'table',
         separator='%')
cfreqs('ref_era5cerfacs', {'monthly': 'mon', 'daily': 'day'})

cdef('variable', '*', project='ref_era5cerfacs')
cdef('product', 'ERA5', project='ref_era5cerfacs')
cdef('period', '1979-2018', project='ref_era5cerfacs')
cdef('obs_type', 'reanalysis', project='ref_era5cerfacs')
cdef('table', '*', project='ref_era5cerfacs')

# Obs de MOC RAPID (Il a fallu bricoler les donnees d'origine pour la dimension time au debut et unlim)
# dataloc(project="ref_climatos",organization="generic",
#        url='/home/esanchez/data_climaf/${variable}_vertical_unlim.nc')
calias(project='ref_era5cerfacs',
       variable='moc',
       fileVariable='stream_function_mar',
       filenameVar='moc')

if root:
    pattern1 = root + "${variable}_${table}_${obs_type}_${product}_${PERIOD}.nc"
    dataloc(project='ref_era5cerfacs', organization='generic', url=[pattern1])

#calias("ref_era5cerfacs","tas",offset=273.15)
Example #37
0
"""
This module declares locations for searching data for project OBS4MIP at CNRM (VDR),  for
all frequencies; see file:///cnrm/amacs/DATA/Obs4MIPs/doc/

Additional attribute for OBS4MIPS datasets  : 'frequency'

Example for an OBS4MIPS CMIP5 dataset declaration ::

 >>> pr_obs=ds(project='OBS4MIPS', variable='pr', simulation='GPCP-SG', frequency='monthly', period='1979-1980')


"""
import os.path

if os.path.exists('/cnrm'):
    from climaf.dataloc import dataloc
    from climaf.classes import cproject, calias, cfreqs

    cproject("OBS4MIPS", "experiment", ("frequency", "monthly"))
    # Frequency alias
    cfreqs('OBS4MIPS', {'monthly': 'monthly_mean'})
    #
    pattern = "/cnrm/amacs/DATA/Obs4MIPs/netcdf/${frequency}/${variable}_${simulation}_*_YYYYMM-YYYYMM.nc"
    dataloc(project="OBS4MIPS", organization="generic", url=[pattern])
Example #38
0
Example ::

    >>> pr_gpcp=ds(project='CAMIOBS', simulation='GPCP2.5d', variable='pr', period='1979-1980')


"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias, cdef

cproject("CAMIOBS", "product", separator="_")

# Root directory for obs data organized 'a la CAMI' on CNRM's Lustre file system.
CAMIOBS_root = "/cnrm/est/COMMON/cami/V1.8/climlinks/"

# Pattern for matching CAMI obs data files and their directory.
# We choose to use facet 'model' to carry the observation source
CAMIOBS_pattern = "${product}/${variable}_1m_${PERIOD}_${simulation}.nc"

# Declare the CAMIOBS pattern to be associated with a project we name OBS_CAMI
dataloc(project="CAMIOBS",
        organization="generic",
        url=[CAMIOBS_root + CAMIOBS_pattern])

cdef("simulation", "*", project="CAMIOBS")

# From here, you can define your dataset using these files.
# You need only to define the facets useful w.r.t. the patterns
# i.e. here : model and variable
#pr_gpcp=ds(project="CAMIOBS", product="GPCP2.5d", variable="pr", period="1979-1980")
Example #39
0
This module declares how to access observation datasets organized 'a la CAMI' at CNRM,
at /cnrm/aster/data1/UTILS/cami/V1.7/climlinks/

Example ::

    >>> pr_gpcp=ds(project='CAMIOBS', simulation='GPCP2.5d', variable='pr', period='1979-1980')


"""

from climaf.dataloc import dataloc
from climaf.classes import cproject, calias

cproject("CAMIOBS" , separator="_")

# Root directory for obs data organized 'a la CAMI' on CNRM's Lustre file system.
CAMIOBS_root="/cnrm/aster/data1/UTILS/cami/V1.7/climlinks/"

# Pattern for matching CAMI obs data files and their directory. 
# We choose to use facet 'model' to carry the observation source
CAMIOBS_pattern="${simulation}/${variable}_1m_YYYYMM_YYYYMM_${simulation}.nc"

# Declare the CAMIOBS pattern to be associated with a project we name OBS_CAMI
dataloc(project="CAMIOBS", organization="generic", 
        url=[CAMIOBS_root+CAMIOBS_pattern])

# From here, you can define your dataset using these files. 
# You need only to define the facets useful w.r.t. the patterns
# i.e. here : model and variable
#pr_gpcp=ds(project="CAMIOBS", simulation="GPCP2.5d", variable="pr", period="1979-1980")
Example #40
0
cdef('period', '*', project='CMIP6CERFACS')
cdef('variable', 'tas', project='CMIP6CERFACS')
cdef('table', 'Amon', project='CMIP6CERFACS')
cdef('realization', 'r*i1p1f*', project='CMIP6CERFACS')
cdef('grid', 'g*', project='CMIP6CERFACS')

# -- Specify the pattern
root1 = "/data/scratch/globc/dcom/CMIP6/${mip}/${institute}/${model}/${model}_${simulation}_${realization}/"
pathfiles1 = root1 + "${variable}_${table}_${model}_${simulation}_${realization}_${grid}_${PERIOD}.nc"
root2 = "/data/scratch/globc/dcom/PRIMAVERA/WP6_HIGHRESMIP/${model}_${simulation}_${realization}/"
pathfiles2 = root2 + "${variable}_${table}_${model}_${simulation}_${realization}_${grid}_${PERIOD}.nc"
root3 = "/data/scratch/globc/vrousseau/MODELE/${model}_${simulation}_${realization}/"
pathfiles3 = root3 + "${variable}_${table}_${model}_${simulation}_${realization}_${grid}_${PERIOD}.nc"

# -- call the dataloc CliMAF function
dataloc(project='CMIP6CERFACS', organization='generic', url=[pathfiles1])
dataloc(project='CMIP6CERFACS', organization='generic', url=[pathfiles2])
dataloc(project='CMIP6CERFACS', organization='generic', url=[pathfiles3])

# -- Define alias if necessary
calias("CMIP6CERFACS", "msftmyz", scale=1.e-3)
calias("CMIP6CERFACS", "tos", offset=273.15)
calias("CMIP6CERFACS", "thetao", offset=273.15)
calias("CMIP6CERFACS", "thetaoga", offset=273.15)
calias("CMIP6CERFACS", 'sic', 'siconc', filenameVar='siconc')
calias("CMIP6CERFACS", 'sit', 'sithick', filenameVar='sithick')
calias("CMIP6CERFACS", 'sivolu', 'sivol', filenameVar='sivol')
# Obs de MOC RAPID (Il a fallu bricoler les donnees d'origine pour la dimension time au debut et unlim)
# dataloc(project="ref_climatos",organization="generic",
#        url='/home/esanchez/data_climaf/${variable}_vertical_unlim.nc')
calias(project='ref_climatos', variable='moc', fileVariable='stream_function_mar', filenameVar='moc')