Changeset 278 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Feb 25, 2015, 11:58:27 AM (10 years ago)
Author:
lfita
Message:

Moving 'variables_values' at the right place

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/nc_var_tools.py

    r277 r278  
    143143
    144144    return boolv
     145
     146
     147def variables_values(varName):
     148    """ Function to provide values to plot the different variables
     149    variables_values(varName)
     150      [varName]= name of the variable
     151        return: [var name], [std name], [minimum], [maximum],
     152          [long name]('|' for spaces), [units], [color palette] (following:
     153          http://matplotlib.org/1.3.1/examples/color/colormaps_reference.html)
     154     [varn]: original name of the variable
     155       NOTE: It might be better doing it with an external ASII file. But then we
     156         got an extra dependency...
     157    >>> variables_values('WRFght')
     158    ['z', 'geopotential_height', 0.0, 80000.0, 'geopotential|height', 'm2s-2', 'rainbow']
     159    """
     160    fname='variables_values'
     161
     162    if varName == 'h':
     163        print fname + '_____________________________________________________________'
     164        print variables_values.__doc__
     165        quit()
     166
     167# Variable name might come with a statistical surname...
     168    stats=['min','max','mean','stdv']
     169
     170    ifst = False
     171    for st in stats:
     172        if varName.find(st) > -1:
     173            print '    '+ fname + ": varibale '" + varName + "' with a statistical "+\
     174              " surname: '",st,"' !!"
     175            Lst = len(st)
     176            LvarName = len(varName)
     177            varn = varName[0:LvarName - Lst]
     178            ifst = True
     179            break
     180    if not ifst:
     181        varn = varName
     182
     183    if varn[0:6] == 'varDIM':
     184# Variable from a dimension (all with 'varDIM' prefix)
     185        Lvarn = len(varn)
     186        varvals = [varn[6:Lvarn+1], varn[6:Lvarn+1], 0., 1.,                         \
     187          "variable|from|size|of|dimension|'" + varn[6:Lvarn+1] + "'", '1', 'rainbox']
     188    elif varn == 'a_tht' or varn == 'LA_THT':
     189        varvals = ['ath', 'total_thermal_plume_cover', 0., 1.,                       \
     190        'total|column|thermal|plume|cover', '1', 'YlGnBu']
     191    elif varn == 'bils' or varn == 'LBILS':
     192        varvals = ['bils', 'surface_total_heat_flux', -100., 100.,                   \
     193          'surface|total|heat|flux', 'Wm-2', 'seismic']
     194    elif varn == 'landcat' or varn == 'category':
     195        varvals = ['landcat', 'land_categories', 0., 22., 'land|categories', '1',    \
     196          'rainbow']
     197    elif varn == 'c' or varn == 'QCLOUD' or varn == 'oliq' or varn == 'OLIQ':
     198        varvals = ['c', 'condensed_water_mixing_ratio', 0., 3.e-4,                   \
     199          'condensed|water|mixing|ratio', 'kgkg-1', 'BuPu']
     200    elif varn == 'ci' or varn == 'iwcon' or varn == 'LIWCON':
     201        varvals = ['ci', 'cloud_iced_water_mixing_ratio', 0., 0.0003,                \
     202         'cloud|iced|water|mixing|ratio', 'kgkg-1', 'Purples']
     203    elif varn == 'cl' or varn == 'lwcon' or varn == 'LLWCON':
     204        varvals = ['cl', 'cloud_liquidwater_mixing_ratio', 0., 0.0003,               \
     205         'cloud|liquid|water|mixing|ratio', 'kgkg-1', 'Blues']
     206    elif varn == 'cld' or varn == 'CLDFRA' or varn == 'rneb' or varn == 'lrneb' or   \
     207      varn == 'LRNEB':
     208        varvals = ['cld', 'cloud_area_fraction', 0., 1., 'cloud|fraction', '1',      \
     209          'gist_gray']
     210    elif varn == 'cldc' or varn == 'rnebcon' or varn == 'lrnebcon' or                \
     211      varn == 'LRNEBCON':
     212        varvals = ['cldc', 'convective_cloud_area_fraction', 0., 1.,                 \
     213          'convective|cloud|fraction', '1', 'gist_gray']
     214    elif varn == 'cldl' or varn == 'rnebls' or varn == 'lrnebls' or varn == 'LRNEBLS':
     215        varvals = ['cldl', 'large_scale_cloud_area_fraction', 0., 1.,                \
     216          'large|scale|cloud|fraction', '1', 'gist_gray']
     217    elif varn == 'clt' or varn == 'CLT' or varn == 'cldt' or                         \
     218      varn == 'Total cloudiness':
     219        varvals = ['clt', 'cloud_area_fraction', 0., 1., 'total|cloud|cover', '1',   \
     220          'gist_gray']
     221    elif varn == 'cll' or varn == 'cldl' or varn == 'LCLDL' or                       \
     222      varn == 'Low-level cloudiness':
     223        varvals = ['cll', 'low_level_cloud_area_fraction', 0., 1.,                   \
     224          'low|level|(p|>|680|hPa)|cloud|fraction', '1', 'gist_gray']
     225    elif varn == 'clm' or varn == 'cldm' or varn == 'LCLDM' or                       \
     226      varn == 'Mid-level cloudiness':
     227        varvals = ['clm', 'mid_level_cloud_area_fraction', 0., 1.,                   \
     228          'medium|level|(440|<|p|<|680|hPa)|cloud|fraction', '1', 'gist_gray']
     229    elif varn == 'clh' or varn == 'cldh' or varn == 'LCLDH' or                       \
     230      varn == 'High-level cloudiness':
     231        varvals = ['clh', 'high_level_cloud_area_fraction', 0., 1.,                  \
     232          'high|level|(p|<|440|hPa)|cloud|fraction', '1', 'gist_gray']
     233    elif varn == 'clmf' or varn == 'fbase' or varn == 'LFBASE':
     234        varvals = ['clmf', 'cloud_base_max_flux', -0.3, 0.3, 'cloud|base|max|flux',  \
     235          'kgm-2s-1', 'seismic']
     236    elif varn == 'clp' or varn == 'pbase' or varn == 'LPBASE':
     237        varvals = ['clp', 'cloud_base_pressure', -0.3, 0.3, 'cloud|base|pressure',   \
     238          'Pa', 'Reds']
     239    elif varn == 'cpt' or varn == 'ptconv' or varn == 'LPTCONV':
     240        varvals = ['cpt', 'convective_point', 0., 1., 'convective|point', '1',       \
     241          'seismic']
     242    elif varn == 'dqajs' or varn == 'LDQAJS':
     243        varvals = ['dqajs', 'dry_adjustment_water_vapor_tendency', -0.0003, 0.0003,  \
     244        'dry|adjustment|water|vapor|tendency', 'kg/kg/s', 'seismic']
     245    elif varn == 'dqcon' or varn == 'LDQCON':
     246        varvals = ['dqcon', 'convective_water_vapor_tendency', -3e-8, 3.e-8,         \
     247        'convective|water|vapor|tendency', 'kg/kg/s', 'seismic']
     248    elif varn == 'dqdyn' or varn == 'LDQDYN':
     249        varvals = ['dqdyn', 'dynamics_water_vapor_tendency', -3.e-7, 3.e-7,          \
     250        'dynamics|water|vapor|tendency', 'kg/kg/s', 'seismic']
     251    elif varn == 'dqeva' or varn == 'LDQEVA':
     252        varvals = ['dqeva', 'evaporation_water_vapor_tendency', -3.e-6, 3.e-6,       \
     253        'evaporation|water|vapor|tendency', 'kg/kg/s', 'seismic']
     254    elif varn == 'dqlscst' or varn == 'LDQLSCST':
     255        varvals = ['dqlscst', 'stratocumulus_water_vapor_tendency', -3.e-7, 3.e-7,   \
     256        'stratocumulus|water|vapor|tendency', 'kg/kg/s', 'seismic']
     257    elif varn == 'dqlscth' or varn == 'LDQLSCTH':
     258        varvals = ['dqlscth', 'thermals_water_vapor_tendency', -3.e-7, 3.e-7,        \
     259        'thermal|plumes|water|vapor|tendency', 'kg/kg/s', 'seismic']
     260    elif varn == 'dqlsc' or varn == 'LDQLSC':
     261        varvals = ['dqlsc', 'condensation_water_vapor_tendency', -3.e-6, 3.e-6,      \
     262        'condensation|water|vapor|tendency', 'kg/kg/s', 'seismic']
     263    elif varn == 'dqphy' or varn == 'LDQPHY':
     264        varvals = ['dqphy', 'physics_water_vapor_tendency', -3.e-7, 3.e-7,           \
     265        'physics|water|vapor|tendency', 'kg/kg/s', 'seismic']
     266    elif varn == 'dqthe' or varn == 'LDQTHE':
     267        varvals = ['dqthe', 'thermals_water_vapor_tendency', -3.e-7, 3.e-7,          \
     268        'thermal|plumes|water|vapor|tendency', 'kg/kg/s', 'seismic']
     269    elif varn == 'dqvdf' or varn == 'LDQVDF':
     270        varvals = ['dqvdf', 'vertical_difussion_water_vapor_tendency', -3.e-8, 3.e-8,\
     271        'vertical|difussion|water|vapor|tendency', 'kg/kg/s', 'seismic']
     272    elif varn == 'dqwak' or varn == 'LDQWAK':
     273        varvals = ['dqwak', 'wake_water_vapor_tendency', -3.e-7, 3.e-7,              \
     274        'wake|water|vapor|tendency', 'kg/kg/s', 'seismic']
     275    elif varn == 'dta' or varn == 'tnt' or varn == 'LTNT':
     276        varvals = ['dta', 'tendency_air_temperature', -3.e-3, 3.e-3,                 \
     277        'tendency|of|air|temperature', 'K/s', 'seismic']
     278    elif varn == 'dtac' or varn == 'tntc' or varn == 'LTNTC':
     279        varvals = ['dtac', 'moist_convection_tendency_air_temperature', -3.e-3,      \
     280        3.e-3, 'moist|convection|tendency|of|air|temperature', 'K/s', 'seismic']
     281    elif varn == 'dtar' or varn == 'tntr' or varn == 'LTNTR':
     282        varvals = ['dtar', 'radiative_heating_tendency_air_temperature', -3.e-3,     \
     283          3.e-3, 'radiative|heating|tendency|of|air|temperature', 'K/s', 'seismic']
     284    elif varn == 'dtascpbl' or varn == 'tntscpbl' or varn == 'LTNTSCPBL':
     285        varvals = ['dtascpbl',                                                       \
     286          'stratiform_cloud_precipitation_BL_mixing_tendency_air_temperature',       \
     287          -3.e-6, 3.e-6,                                                             \
     288          'stratiform|cloud|precipitation|Boundary|Layer|mixing|tendency|air|'       +
     289          'temperature', 'K/s', 'seismic']
     290    elif varn == 'dtajs' or varn == 'LDTAJS':
     291        varvals = ['dtajs', 'dry_adjustment_thermal_tendency', -3.e-5, 3.e-5,        \
     292        'dry|adjustment|thermal|tendency', 'K/s', 'seismic']
     293    elif varn == 'dtcon' or varn == 'LDTCON':
     294        varvals = ['dtcon', 'convective_thermal_tendency', -3.e-5, 3.e-5,            \
     295        'convective|thermal|tendency', 'K/s', 'seismic']
     296    elif varn == 'dtdyn' or varn == 'LDTDYN':
     297        varvals = ['dtdyn', 'dynamics_thermal_tendency', -3.e-4, 3.e-4,              \
     298        'dynamics|thermal|tendency', 'K/s', 'seismic']
     299    elif varn == 'dteva' or varn == 'LDTEVA':
     300        varvals = ['dteva', 'evaporation_thermal_tendency', -3.e-3, 3.e-3,           \
     301        'evaporation|thermal|tendency', 'K/s', 'seismic']
     302    elif varn == 'dtlscst' or varn == 'LDTLSCST':
     303        varvals = ['dtlscst', 'stratocumulus_thermal_tendency', -3.e-4, 3.e-4,       \
     304        'stratocumulus|thermal|tendency', 'K/s', 'seismic']
     305    elif varn == 'dtlscth' or varn == 'LDTLSCTH':
     306        varvals = ['dtlscth', 'thermals_thermal_tendency', -3.e-4, 3.e-4,            \
     307        'thermal|plumes|thermal|tendency', 'K/s', 'seismic']
     308    elif varn == 'dtlsc' or varn == 'LDTLSC':
     309        varvals = ['dtlsc', 'condensation_thermal_tendency', -3.e-3, 3.e-3,          \
     310        'condensation|thermal|tendency', 'K/s', 'seismic']
     311    elif varn == 'dtlwr' or varn == 'LDTLWR':
     312        varvals = ['dtlwr', 'long_wave_thermal_tendency', -3.e-3, 3.e-3, \
     313        'long|wave|radiation|thermal|tendency', 'K/s', 'seismic']
     314    elif varn == 'dtphy' or varn == 'LDTPHY':
     315        varvals = ['dtphy', 'physics_thermal_tendency', -3.e-4, 3.e-4,               \
     316        'physics|thermal|tendency', 'K/s', 'seismic']
     317    elif varn == 'dtsw0' or varn == 'LDTSW0':
     318        varvals = ['dtsw0', 'cloudy_sky_short_wave_thermal_tendency', -3.e-4, 3.e-4, \
     319        'cloudy|sky|short|wave|radiation|thermal|tendency', 'K/s', 'seismic']
     320    elif varn == 'dtthe' or varn == 'LDTTHE':
     321        varvals = ['dtthe', 'thermals_thermal_tendency', -3.e-4, 3.e-4,              \
     322        'thermal|plumes|thermal|tendency', 'K/s', 'seismic']
     323    elif varn == 'dtvdf' or varn == 'LDTVDF':
     324        varvals = ['dtvdf', 'vertical_difussion_thermal_tendency', -3.e-5, 3.e-5,    \
     325        'vertical|difussion|thermal|tendency', 'K/s', 'seismic']
     326    elif varn == 'dtwak' or varn == 'LDTWAK':
     327        varvals = ['dtwak', 'wake_thermal_tendency', -3.e-4, 3.e-4,                  \
     328        'wake|thermal|tendency', 'K/s', 'seismic']
     329    elif varn == 'ducon' or varn == 'LDUCON':
     330        varvals = ['ducon', 'convective_eastward_wind_tendency', -3.e-3, 3.e-3,      \
     331        'convective|eastward|wind|tendency', 'ms-2', 'seismic']
     332    elif varn == 'dudyn' or varn == 'LDUDYN':
     333        varvals = ['dudyn', 'dynamics_eastward_wind_tendency', -3.e-3, 3.e-3,        \
     334        'dynamics|eastward|wind|tendency', 'ms-2', 'seismic']
     335    elif varn == 'duvdf' or varn == 'LDUVDF':
     336        varvals = ['duvdf', 'vertical_difussion_eastward_wind_tendency', -3.e-3,     \
     337         3.e-3, 'vertical|difussion|eastward|wind|tendency', 'ms-2', 'seismic']
     338    elif varn == 'dvcon' or varn == 'LDVCON':
     339        varvals = ['dvcon', 'convective_difussion_northward_wind_tendency', -3.e-3,  \
     340         3.e-3, 'convective|northward|wind|tendency', 'ms-2', 'seismic']
     341    elif varn == 'dvdyn' or varn == 'LDVDYN':
     342        varvals = ['dvdyn', 'dynamics_northward_wind_tendency', -3.e-3,    \
     343         3.e-3, 'dynamics|difussion|northward|wind|tendency', 'ms-2', 'seismic']
     344    elif varn == 'dvvdf' or varn == 'LDVVDF':
     345        varvals = ['dvvdf', 'vertical_difussion_northward_wind_tendency', -3.e-3,    \
     346         3.e-3, 'vertical|difussion|northward|wind|tendency', 'ms-2', 'seismic']
     347    elif varn == 'evspsbl' or varn == 'LEVAP' or varn == 'evap':
     348        varvals = ['evspsbl', 'water_evaporation_flux', 0., 1.5e-4,                  \
     349          'water|evaporation|flux', 'kgm-2s-1', 'Blues']
     350    elif varn == 'g' or varn == 'QGRAUPEL':
     351        varvals = ['g', 'grauepl_mixing_ratio', 0., 0.0003, 'graupel|mixing|ratio',  \
     352          'kgkg-1', 'Purples']
     353    elif varn == 'h2o' or varn == 'LH2O':
     354        varvals = ['h2o', 'water_mass_fraction', 0., 3.e-2,                          \
     355          'mass|fraction|of|water', '1', 'Blues']
     356    elif varn == 'h' or varn == 'QHAIL':
     357        varvals = ['h', 'hail_mixing_ratio', 0., 0.0003, 'hail|mixing|ratio',        \
     358          'kgkg-1', 'Purples']
     359    elif varn == 'hfls' or varn == 'LH' or varn == 'LFLAT' or varn == 'flat':
     360        varvals = ['hfls', 'surface_upward_latent_heat_flux', -400., 400.,           \
     361          'upward|latnt|heat|flux|at|the|surface', 'Wm-2', 'seismic']
     362    elif varn == 'hfss' or varn == 'LSENS' or varn == 'sens':
     363        varvals = ['hfss', 'surface_upward_sensible_heat_flux', -150., 150.,         \
     364          'upward|sensible|heat|flux|at|the|surface', 'Wm-2', 'seismic']
     365    elif varn == 'hus' or varn == 'WRFrh' or varn == 'LMDZrh' or varn == 'rhum' or   \
     366      varn == 'LRHUM':
     367        varvals = ['hus', 'specific_humidity', 0., 1., 'specific|humidty', '1',      \
     368          'BuPu']
     369    elif varn == 'huss' or varn == 'WRFrhs' or varn == 'LMDZrhs' or varn == 'rh2m' or\
     370      varn == 'LRH2M':
     371        varvals = ['huss', 'specific_humidity', 0., 1., 'specific|humidty|at|2m',    \
     372          '1', 'BuPu']
     373    elif varn == 'i' or varn == 'QICE':
     374        varvals = ['i', 'iced_water_mixing_ratio', 0., 0.0003,                       \
     375         'iced|water|mixing|ratio', 'kgkg-1', 'Purples']
     376    elif varn == 'lat' or varn == 'XLAT' or varn == 'XLAT_M' or varn == 'latitude':
     377        varvals = ['lat', 'latitude', -90., 90., 'latitude', 'degrees North',        \
     378          'seismic']
     379    elif varn == 'lcl' or varn == 's_lcl' or varn == 'ls_lcl' or varn == 'LS_LCL':
     380        varvals = ['lcl', 'condensation_level', 0., 2500., 'level|of|condensation',  \
     381          'm', 'Greens']
     382    elif varn == 'lambdath' or varn == 'lambda_th' or varn == 'LLAMBDA_TH':
     383        varvals = ['lambdath', 'thermal_plume_vertical_velocity', -30., 30.,         \
     384          'thermal|plume|vertical|velocity', 'm/s', 'seismic']
     385    elif varn == 'lmaxth' or varn == 'LLMAXTH':
     386        varvals = ['lmaxth', 'upper_level_thermals', 0., 100., 'upper|level|thermals'\
     387          , '1', 'Greens']
     388    elif varn == 'lon' or varn == 'XLONG' or varn == 'XLONG_M':
     389        varvals = ['lon', 'longitude', -180., 180., 'longitude', 'degrees East',     \
     390          'seismic']
     391    elif varn == 'longitude':
     392        varvals = ['lon', 'longitude', 0., 360., 'longitude', 'degrees East',        \
     393          'seismic']
     394    elif varn == 'orog' or varn == 'HGT' or varn == 'HGT_M':
     395        varvals = ['orog', 'orography',  0., 3000., 'surface|altitude', 'm','terrain']
     396    elif varn == 'pfc' or varn == 'plfc' or varn == 'LPLFC':
     397        varvals = ['pfc', 'pressure_free_convection', 100., 1100.,                   \
     398          'pressure|free|convection', 'hPa', 'BuPu']
     399    elif varn == 'plcl' or varn == 'LPLCL':
     400        varvals = ['plcl', 'pressure_lifting_condensation_level', 700., 1100.,       \
     401          'pressure|lifting|condensation|level', 'hPa', 'BuPu']
     402    elif varn == 'pr' or varn == 'RAINTOT' or varn == 'precip' or                    \
     403      varn == 'LPRECIP' or varn == 'Precip Totale liq+sol':
     404        varvals = ['pr', 'precipitation_flux', 0., 1.e-4, 'precipitation|flux',      \
     405          'kgm-2s-1', 'BuPu']
     406    elif varn == 'prprof' or varn == 'vprecip' or varn == 'LVPRECIP':
     407        varvals = ['prprof', 'precipitation_profile', 0., 1.e-3,                     \
     408          'precipitation|profile', 'kg/m2/s', 'BuPu']
     409    elif varn == 'prprofci' or varn == 'pr_con_i' or varn == 'LPR_CON_I':
     410        varvals = ['prprofci', 'precipitation_profile_convective_i', 0., 1.e-3,      \
     411          'precipitation|profile|convective|i', 'kg/m2/s', 'BuPu']
     412    elif varn == 'prprofcl' or varn == 'pr_con_l' or varn == 'LPR_CON_L':
     413        varvals = ['prprofcl', 'precipitation_profile_convective_l', 0., 1.e-3,      \
     414          'precipitation|profile|convective|l', 'kg/m2/s', 'BuPu']
     415    elif varn == 'prprofli' or varn == 'pr_lsc_i' or varn == 'LPR_LSC_I':
     416        varvals = ['prprofli', 'precipitation_profile_large_scale_i', 0., 1.e-3,     \
     417          'precipitation|profile|large|scale|i', 'kg/m2/s', 'BuPu']
     418    elif varn == 'prprofll' or varn == 'pr_lsc_l' or varn == 'LPR_LSC_L':
     419        varvals = ['prprofll', 'precipitation_profile_large_scale_l', 0., 1.e-3,     \
     420          'precipitation|profile|large|scale|l', 'kg/m2/s', 'BuPu']
     421    elif varn == 'pracc' or varn == 'ACRAINTOT':
     422        varvals = ['pracc', 'precipitation_amount', 0., 100.,                        \
     423          'accumulated|precipitation', 'kgm-2', 'BuPu']
     424    elif varn == 'prc' or varn == 'LPLUC' or varn == 'pluc' or varn == 'WRFprc':
     425        varvals = ['prc', 'convective_precipitation_flux', 0., 2.e-4,                \
     426          'convective|precipitation|flux', 'kgm-2s-1', 'Blues']
     427    elif varn == 'prci' or varn == 'pr_con_i' or varn == 'LPR_CON_I':
     428        varvals = ['prci', 'convective_ice_precipitation_flux', 0., 0.003,           \
     429          'convective|ice|precipitation|flux', 'kgm-2s-1', 'Purples']
     430    elif varn == 'prcl' or varn == 'pr_con_l' or varn == 'LPR_CON_L':
     431        varvals = ['prcl', 'convective_liquid_precipitation_flux', 0., 0.003,        \
     432          'convective|liquid|precipitation|flux', 'kgm-2s-1', 'Blues']
     433    elif varn == 'pres' or varn == 'presnivs' or varn == 'pressure' or               \
     434      varn == 'lpres' or varn == 'LPRES':
     435        varvals = ['pres', 'air_pressure', 0., 103000., 'air|pressure', 'Pa',        \
     436          'Blues']
     437    elif varn == 'prls' or varn == 'WRFprls' or varn == 'LPLUL' or varn == 'plul':
     438        varvals = ['prls', 'large_scale_precipitation_flux', 0., 2.e-4,              \
     439          'large|scale|precipitation|flux', 'kgm-2s-1', 'Blues']
     440    elif varn == 'prsn' or varn == 'SNOW' or varn == 'snow' or varn == 'LSNOW':
     441        varvals = ['prsn', 'snowfall', 0., 1.e-4, 'snowfall|flux', 'kgm-2s-1', 'BuPu']
     442    elif varn == 'prw' or varn == 'WRFprh':
     443        varvals = ['prw', 'atmosphere_water_vapor_content', 0., 10.,                 \
     444          'water|vapor"path', 'kgm-2', 'Blues']
     445    elif varn == 'ps' or varn == 'psfc' or varn =='PSFC' or varn == 'psol' or        \
     446      varn == 'Surface Pressure':
     447        varvals=['ps', 'surface_air_pressure', 85000., 105400., 'surface|pressure',  \
     448          'hPa', 'cool']
     449    elif varn == 'psl' or varn == 'mslp' or varn =='WRFmslp':
     450        varvals=['psl', 'air_pressure_at_sea_level', 85000., 104000.,                \
     451          'mean|sea|level|pressure', 'Pa', 'Greens']
     452    elif varn == 'qth' or varn == 'q_th' or varn == 'LQ_TH':
     453        varvals = ['qth', 'thermal_plume_total_water_content', 0., 25.,              \
     454          'total|water|cotent|in|thermal|plume', 'mm', 'YlOrRd']
     455    elif varn == 'r' or varn == 'QVAPOR' or varn == 'ovap' or varn == 'LOVAP':
     456        varvals = ['r', 'water_mixing_ratio', 0., 0.03, 'water|mixing|ratio',        \
     457          'kgkg-1', 'BuPu']
     458    elif varn == 'rsds' or varn == 'SWdnSFC' or varn == 'SWdn at surface' or         \
     459      varn == 'SWDOWN':
     460        varvals=['rsds', 'surface_downwelling_shortwave_flux_in_air',  0., 1200.,    \
     461          'downward|SW|surface|radiation', 'Wm-2' ,'Reds']
     462    elif varn == 'rsdsacc':
     463        varvals=['rsdsacc', 'accumulated_surface_downwelling_shortwave_flux_in_air', \
     464          0., 1200., 'accumulated|downward|SW|surface|radiation', 'Wm-2' ,'Reds']
     465    elif varn == 'rvor' or varn == 'WRFrvor':
     466        varvals = ['rvor', 'air_relative_vorticity', -2.5E-3, 2.5E-3,                \
     467          'air|relative|vorticity', 's-1', 'seismic']
     468    elif varn == 'rvors' or varn == 'WRFrvors':
     469        varvals = ['rvors', 'surface_air_relative_vorticity', -2.5E-3, 2.5E-3,       \
     470          'surface|air|relative|vorticity', 's-1', 'seismic']
     471    elif varn == 's' or varn == 'QSNOW':
     472        varvals = ['s', 'snow_mixing_ratio', 0., 0.0003, 'snow|mixing|ratio',        \
     473          'kgkg-1', 'Purples']
     474    elif varn == 'stherm' or varn == 'LS_THERM':
     475        varvals = ['stherm', 'thermals_excess', 0., 0.8, 'thermals|excess', 'K',     \
     476          'Reds']
     477    elif varn == 'ta' or varn == 'WRFt' or varn == 'temp' or varn == 'LTEMP' or      \
     478      varn == 'Air temperature':
     479        varvals = ['ta', 'air_temperature', 195., 320., 'air|temperature', 'K',      \
     480          'YlOrRd']
     481    elif varn == 'tah' or varn == 'theta' or varn == 'LTHETA':
     482        varvals = ['tah', 'potential_air_temperature', 195., 320.,                   \
     483          'potential|air|temperature', 'K', 'YlOrRd']
     484    elif varn == 'tas' or varn == 'T2' or varn == 't2m' or varn == 'T2M' or          \
     485      varn == 'Temperature 2m':
     486        varvals = ['tas', 'air_temperature', 240., 310., 'air|temperature|at|2m', '  \
     487          K', 'YlOrRd']
     488    elif varn == 'tds' or varn == 'TH2':
     489        varvals = ['tds', 'air_dew_point_temperature', 240., 310.,                   \
     490          'air|dew|point|temperature|at|2m', 'K', 'YlGnBu']
     491    elif varn == 'tke' or varn == 'TKE' or varn == 'tke' or varn == 'LTKE':
     492        varvals = ['tke', 'turbulent_kinetic_energy', 0., 0.003,                     \
     493          'turbulent|kinetic|energy', 'm2/s2', 'Reds']
     494    elif varn == 'time'or varn == 'time_counter':
     495        varvals = ['time', 'time', 0., 1000., 'time',                                \
     496          'hours|since|1949/12/01|00:00:00', 'Reds']
     497    elif varn == 'tmla' or varn == 's_pblt' or varn == 'LS_PBLT':
     498        varvals = ['tmla', 'atmosphere_top_boundary_layer_temperature', 250., 330.,  \
     499          'atmosphere|top|boundary|layer|temperature', 'K', 'Reds']
     500    elif varn == 'ua' or varn == 'vitu' or varn == 'U' or varn == 'Zonal wind' or    \
     501      varn == 'LVITU':
     502        varvals = ['ua', 'eastward_wind', -30., 30., 'eastward|wind', 'ms-1',        \
     503          'seismic']
     504    elif varn == 'uas' or varn == 'u10m' or varn == 'U10' or varn =='Vent zonal 10m':
     505        varvals = ['uas', 'eastward_wind', -30., 30., 'eastward|2m|wind',    \
     506          'ms-1', 'seismic']
     507    elif varn == 'va' or varn == 'vitv' or varn == 'V' or varn == 'Meridional wind'  \
     508      or varn == 'LVITV':
     509        varvals = ['va', 'northward_wind', -30., 30., 'northward|wind', 'ms-1',      \
     510          'seismic']
     511    elif varn == 'vas' or varn == 'v10m' or varn == 'V10' or                         \
     512      varn =='Vent meridien 10m':
     513        varvals = ['vas', 'northward_wind', -30., 30., 'northward|2m|wind', 'ms-1',  \
     514          'seismic']
     515    elif varn == 'wakedeltaq' or varn == 'wake_deltaq' or varn == 'lwake_deltaq' or  \
     516      varn == 'LWAKE_DELTAQ':
     517        varvals = ['wakedeltaq', 'wake_delta_vapor', -0.003, 0.003,                  \
     518          'wake|delta|mixing|ratio', '-', 'seismic']
     519    elif varn == 'wakedeltat' or varn == 'wake_deltat' or varn == 'lwake_deltat' or  \
     520      varn == 'LWAKE_DELTAT':
     521        varvals = ['wakedeltat', 'wake_delta_temp', -0.003, 0.003,                   \
     522          'wake|delta|temperature', '-', 'seismic']
     523    elif varn == 'wakeh' or varn == 'wake_h' or varn == 'LWAKE_H':
     524        varvals = ['wakeh', 'wake_height', 0., 1000., 'height|of|the|wakes', 'm',    \
     525          'YlOrRd']
     526    elif varn == 'wakeomg' or varn == 'wake_omg' or varn == 'lwake_omg' or           \
     527      varn == 'LWAKE_OMG':
     528        varvals = ['wakeomg', 'wake_omega', 0., 3., 'wake|omega', \
     529          '-', 'BuGn']
     530    elif varn == 'wakes' or varn == 'wake_s' or varn == 'LWAKE_S':
     531        varvals = ['wakes', 'wake_area_fraction', 0., 0.5, 'wake|spatial|fraction',  \
     532          '1', 'BuGn']
     533    elif varn == 'wa' or varn == 'W' or varn == 'Vertical wind':
     534        varvals = ['wa', 'upward_wind', -10., 10., 'upward|wind', 'ms-1',            \
     535          'seismic']
     536    elif varn == 'wap' or varn == 'vitw' or varn == 'LVITW':
     537        varvals = ['wap', 'upward_wind', -3.e-10, 3.e-10, 'upward|wind', 'mPa-1',    \
     538          'seismic']
     539    elif varn == 'wss' or varn == 'SPDUV':
     540        varvals = ['wss', 'air_velocity',  0., 30., 'surface|horizontal|wind|speed', \
     541          'ms-1', 'Reds']
     542    elif varn == 'xtime' or varn == 'XTIME':
     543        varvals = ['xtime', 'time',  0., 1.e5, 'time',                               \
     544          'minutes|since|simulation|start', 'Reds']
     545    elif varn == 'x' or varn == 'X':
     546        varvals = ['x', 'x',  0., 100., 'x', '-', 'Reds']
     547    elif varn == 'y' or varn == 'Y':
     548        varvals = ['y', 'y',  0., 100., 'y', '-', 'Blues']
     549    elif varn == 'z' or varn == 'Z':
     550        varvals = ['z', 'z',  0., 100., 'z', '-', 'Greens']
     551    elif varn == 'zg' or varn == 'WRFght' or varn == 'Geopotential height' or        \
     552      varn == 'geop' or varn == 'LGEOP':
     553        varvals = ['zg', 'geopotential_height', 0., 80000., 'geopotential|height',   \
     554          'm2s-2', 'rainbow']
     555    elif varn == 'zmaxth' or varn == 'zmax_th'  or varn == 'LZMAX_TH':
     556        varvals = ['zmaxth', 'thermal_plume_height', 0., 4000.,                     \
     557          'maximum|thermals|plume|height', 'm', 'YlOrRd']
     558    elif varn == 'zmla' or varn == 's_pblh' or varn == 'LS_PBLH':
     559        varvals = ['zmla', 'atmosphere_boundary_layer_thickness', 0., 2500.,         \
     560          'atmosphere|boundary|layer|thickness', 'm', 'Blues']
     561    else:
     562        print errormsg
     563        print '  ' + fname + ': variable ' + varn + ' not defined !!!'
     564        quit(-1)
     565
     566    return varvals
     567
    145568
    146569####### ###### ##### #### ### ## #
     
    1135011773#file_oper_alongdims('time:-1|z:-1|x:-1|y:-1,time:y,mean,pressure:lat', '/home/lluis/etudes/WRF_LMDZ/WaquaL/WRF_LMDZ/AR40/vertical_interpolation_WRFp.nc', 'WRFt')
    1135111774
    11352 
    11353 def variables_values(varName):
    11354     """ Function to provide values to plot the different variables
    11355     variables_values(varName)
    11356       [varName]= name of the variable
    11357         return: [var name], [std name], [minimum], [maximum],
    11358           [long name]('|' for spaces), [units], [color palette] (following:
    11359           http://matplotlib.org/1.3.1/examples/color/colormaps_reference.html)
    11360      [varn]: original name of the variable
    11361        NOTE: It might be better doing it with an external ASII file. But then we
    11362          got an extra dependency...
    11363     >>> variables_values('WRFght')
    11364     ['z', 'geopotential_height', 0.0, 80000.0, 'geopotential|height', 'm2s-2', 'rainbow']
    11365     """
    11366     fname='variables_values'
    11367 
    11368     if varName == 'h':
    11369         print fname + '_____________________________________________________________'
    11370         print variables_values.__doc__
    11371         quit()
    11372 
    11373 # Variable name might come with a statistical surname...
    11374     stats = ['min','max','mean','stdv','turb']
    11375     statsLong = {'min':'minimum', 'max':'maximum', 'mean':'mean',                    \
    11376       'stdv':'standard deviation', 'turb':'turbulence'}
    11377 
    11378     ifst = False
    11379     for st in stats:
    11380         if varName.find(st) > -1:
    11381             print '    '+ fname + ": varibale '" + varName + "' with a statistical "+\
    11382               " surname: '",st,"' !!"
    11383             Lst = len(st)
    11384             LvarName = len(varName)
    11385             varn = varName[0:LvarName - Lst]
    11386             ifst = True
    11387             stname = st
    11388             break
    11389     if not ifst:
    11390         varn = varName
    11391 
    11392     if varn[0:6] == 'varDIM':
    11393 # Variable from a dimension (all with 'varDIM' prefix)
    11394         Lvarn = len(varn)
    11395         varvals = [varn[6:Lvarn+1], varn[6:Lvarn+1], 0., 1.,                         \
    11396           "variable|from|size|of|dimension|'" + varn[6:Lvarn+1] + "'", '1', 'rainbox']
    11397     elif varn == 'a_tht' or varn == 'LA_THT':
    11398         varvals = ['a_th', 'total_thermal_plume_cover', 0., 1.,                      \
    11399         'total|column|thermal|plume|cover', '1', 'YlGnBu']
    11400     elif varn == 'bils' or varn == 'LBILS':
    11401         varvals = ['bils', 'surface_total_heat_flux', -100., 100.,                   \
    11402           'surface|total|heat|flux', 'Wm-2', 'seismic']
    11403     elif varn == 'landcat' or varn == 'category':
    11404         varvals = ['landcat', 'land_categories', 0., 22., 'land|categories', '1',    \
    11405           'rainbow']
    11406     elif varn == 'c' or varn == 'QCLOUD' or varn == 'oliq' or varn == 'OLIQ':
    11407         varvals = ['c', 'condensed_water_mixing_ratio', 0., 3.e-4,                   \
    11408           'condensed|water|mixing|ratio', 'kgkg-1', 'BuPu']
    11409     elif varn == 'clt' or varn == 'CLT' or varn == 'cldt' or                         \
    11410       varn == 'Total cloudiness':
    11411         varvals = ['clt', 'cloud_area_fraction', 0., 1., 'total|cloud|cover', '1',   \
    11412           'gist_gray']
    11413     elif varn == 'cll' or varn == 'cldl' or varn == 'LCLDL' or                       \
    11414       varn == 'Low-level cloudiness':
    11415         varvals = ['cll', 'low_level_cloud_area_fraction', 0., 1.,                   \
    11416           'low|level|(p|>|680|hPa)|cloud|fraction', '1', 'gist_gray']
    11417     elif varn == 'clm' or varn == 'cldm' or varn == 'LCLDM' or                       \
    11418       varn == 'Mid-level cloudiness':
    11419         varvals = ['clm', 'mid_level_cloud_area_fraction', 0., 1.,                   \
    11420           'medium|level|(440|<|p|<|680|hPa)|cloud|fraction', '1', 'gist_gray']
    11421     elif varn == 'clh' or varn == 'cldh' or varn == 'LCLDH' or                       \
    11422       varn == 'High-level cloudiness':
    11423         varvals = ['clh', 'high_level_cloud_area_fraction', 0., 1.,                  \
    11424           'high|level|(p|<|440|hPa)|cloud|fraction', '1', 'gist_gray']
    11425     elif varn == 'dqajs' or varn == 'LDQAJS':
    11426         varvals = ['dqajs', 'dry_adjustment_water_vapor_tendency', -0.0003, 0.0003,  \
    11427         'dry|adjustment|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11428     elif varn == 'dqcon' or varn == 'LDQCON':
    11429         varvals = ['dqcon', 'convective_water_vapor_tendency', -3e-8, 3.e-8,         \
    11430         'convective|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11431     elif varn == 'dqdyn' or varn == 'LDQDYN':
    11432         varvals = ['dqdyn', 'dynamics_water_vapor_tendency', -3.e-7, 3.e-7,          \
    11433         'dynamics|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11434     elif varn == 'dqeva' or varn == 'LDQEVA':
    11435         varvals = ['dqeva', 'evaporation_water_vapor_tendency', -3.e-6, 3.e-6,       \
    11436         'evaporation|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11437     elif varn == 'dqlscst' or varn == 'LDQLSCST':
    11438         varvals = ['dqlscst', 'stratocumulus_water_vapor_tendency', -3.e-7, 3.e-7,   \
    11439         'stratocumulus|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11440     elif varn == 'dqlscth' or varn == 'LDQLSCTH':
    11441         varvals = ['dqlscth', 'thermals_water_vapor_tendency', -3.e-7, 3.e-7,        \
    11442         'thermal|plumes|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11443     elif varn == 'dqlsc' or varn == 'LDQLSC':
    11444         varvals = ['dqlsc', 'condensation_water_vapor_tendency', -3.e-6, 3.e-6,      \
    11445         'condensation|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11446     elif varn == 'dqphy' or varn == 'LDQPHY':
    11447         varvals = ['dqphy', 'physics_water_vapor_tendency', -3.e-7, 3.e-7,           \
    11448         'physics|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11449     elif varn == 'dqthe' or varn == 'LDQTHE':
    11450         varvals = ['dqthe', 'thermals_water_vapor_tendency', -3.e-7, 3.e-7,          \
    11451         'thermal|plumes|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11452     elif varn == 'dqvdf' or varn == 'LDQVDF':
    11453         varvals = ['dqvdf', 'vertical_difussion_water_vapor_tendency', -3.e-8, 3.e-8,\
    11454         'vertical|difussion|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11455     elif varn == 'dqwak' or varn == 'LDQWAK':
    11456         varvals = ['dqwak', 'wake_water_vapor_tendency', -3.e-7, 3.e-7,              \
    11457         'wake|water|vapor|tendency', 'kg/kg/s', 'seismic']
    11458     elif varn == 'dtajs' or varn == 'LDTAJS':
    11459         varvals = ['dtajs', 'dry_adjustment_thermal_tendency', -3.e-5, 3.e-5,        \
    11460         'dry|adjustment|thermal|tendency', 'K/s', 'seismic']
    11461     elif varn == 'dtcon' or varn == 'LDTCON':
    11462         varvals = ['dtcon', 'convective_thermal_tendency', -3.e-5, 3.e-5,            \
    11463         'convective|thermal|tendency', 'K/s', 'seismic']
    11464     elif varn == 'dtdyn' or varn == 'LDTDYN':
    11465         varvals = ['dtdyn', 'dynamics_thermal_tendency', -3.e-4, 3.e-4,              \
    11466         'dynamics|thermal|tendency', 'K/s', 'seismic']
    11467     elif varn == 'dteva' or varn == 'LDTEVA':
    11468         varvals = ['dteva', 'evaporation_thermal_tendency', -3.e-3, 3.e-3,           \
    11469         'evaporation|thermal|tendency', 'K/s', 'seismic']
    11470     elif varn == 'dtlscst' or varn == 'LDTLSCST':
    11471         varvals = ['dtlscst', 'stratocumulus_thermal_tendency', -3.e-4, 3.e-4,       \
    11472         'stratocumulus|thermal|tendency', 'K/s', 'seismic']
    11473     elif varn == 'dtlscth' or varn == 'LDTLSCTH':
    11474         varvals = ['dtlscth', 'thermals_thermal_tendency', -3.e-4, 3.e-4,            \
    11475         'thermal|plumes|thermal|tendency', 'K/s', 'seismic']
    11476     elif varn == 'dtlsc' or varn == 'LDTLSC':
    11477         varvals = ['dtlsc', 'condensation_thermal_tendency', -3.e-3, 3.e-3,          \
    11478         'condensation|thermal|tendency', 'K/s', 'seismic']
    11479     elif varn == 'dtphy' or varn == 'LDTPHY':
    11480         varvals = ['dtphy', 'physics_thermal_tendency', -3.e-4, 3.e-4,               \
    11481         'physics|thermal|tendency', 'K/s', 'seismic']
    11482     elif varn == 'dtthe' or varn == 'LDTTHE':
    11483         varvals = ['dtthe', 'thermals_thermal_tendency', -3.e-4, 3.e-4,              \
    11484         'thermal|plumes|thermal|tendency', 'K/s', 'seismic']
    11485     elif varn == 'dtvdf' or varn == 'LDTVDF':
    11486         varvals = ['dtvdf', 'vertical_difussion_thermal_tendency', -3.e-5, 3.e-5,    \
    11487         'vertical|difussion|thermal|tendency', 'K/s', 'seismic']
    11488     elif varn == 'dtwak' or varn == 'LDTWAK':
    11489         varvals = ['dtwak', 'wake_thermal_tendency', -3.e-4, 3.e-4,                  \
    11490         'wake|thermal|tendency', 'K/s', 'seismic']
    11491     elif varn == 'evspsbl' or varn == 'LEVAP' or varn == 'evap':
    11492         varvals = ['evspsbl', 'water_evaporation_flux', 0., 1.5e-4,                  \
    11493           'water|evaporation|flux', 'kgm-2s-1', 'Blues']
    11494     elif varn == 'h2o' or varn == 'LH2O':
    11495         varvals = ['h2o', 'water_mass_fraction', 0., 3.e-2,                          \
    11496           'mass|fraction|of|water', '1', 'Blues']
    11497     elif varn == 'hfls' or varn == 'LH' or varn == 'LFLAT' or varn == 'flat':
    11498         varvals = ['hfls', 'surface_upward_latent_heat_flux', -400., 400.,           \
    11499           'upward|latnt|heat|flux|at|the|surface', 'Wm-2', 'seismic']
    11500     elif varn == 'hfss' or varn == 'LSENS' or varn == 'sens':
    11501         varvals = ['hfss', 'surface_upward_sensible_heat_flux', -150., 150.,         \
    11502           'upward|sensible|heat|flux|at|the|surface', 'Wm-2', 'seismic']
    11503     elif varn == 'hus' or varn == 'WRFrh' or varn == 'LMDZrh' or varn == 'rhum' or   \
    11504       varn == 'LRHUM':
    11505         varvals = ['hus', 'specific_humidity', 0., 1., 'specific|humidty', '1',      \
    11506           'BuPu']
    11507     elif varn == 'huss' or varn == 'WRFrhs' or varn == 'LMDZrhs' or varn == 'rh2m' or\
    11508       varn == 'LRH2M':
    11509         varvals = ['huss', 'specific_humidity', 0., 1., 'specific|humidty|at|2m',    \
    11510           '1', 'BuPu']
    11511     elif varn == 'lat' or varn == 'XLAT' or varn == 'XLAT_M' or varn == 'latitude':
    11512         varvals = ['lat', 'latitude', -90., 90., 'latitude', 'degrees North',        \
    11513           'seismic']
    11514     elif varn == 'lon' or varn == 'XLONG' or varn == 'XLONG_M':
    11515         varvals = ['lon', 'longitude', -180., 180., 'longitude', 'degrees East',     \
    11516           'seismic']
    11517     elif varn == 'longitude':
    11518         varvals = ['lon', 'longitude', 0., 360., 'longitude', 'degrees East',        \
    11519           'seismic']
    11520     elif varn == 'orog' or varn == 'HGT' or varn == 'HGT_M':
    11521         varvals = ['orog', 'orography',  0., 3000., 'surface|altitude', 'm','terrain']
    11522     elif varn == 'pr' or varn == 'RAINTOT' or varn == 'precip' or                    \
    11523       varn == 'LPRECIP' or varn == 'Precip Totale liq+sol':
    11524         varvals = ['pr', 'precipitation_flux', 0., 1.e-4, 'precipitation|flux',      \
    11525           'kgm-2s-1', 'BuPu']
    11526     elif varn == 'pracc' or varn == 'ACRAINTOT':
    11527         varvals = ['pracc', 'precipitation_amount', 0., 100.,                        \
    11528           'accumulated|precipitation', 'kgm-2', 'BuPu']
    11529     elif varn == 'prc' or varn == 'LPLUC' or varn == 'pluc' or varn == 'WRFprc':
    11530         varvals = ['prc', 'convective_precipitation_flux', 0., 2.e-4,                \
    11531           'convective|precipitation|flux', 'kgm-2s-1', 'Blues']
    11532     elif varn == 'pres' or varn == 'presnivs' or varn == 'pressure':
    11533         varvals = ['pres', 'air_pressure', 0., 103000., 'air|pressure', 'Pa',        \
    11534           'Blues']
    11535     elif varn == 'prls' or varn == 'WRFprls' or varn == 'LPLUL' or varn == 'plul':
    11536         varvals = ['prls', 'large_scale_precipitation_flux', 0., 2.e-4,              \
    11537           'large|scale|precipitation|flux', 'kgm-2s-1', 'Blues']
    11538     elif varn == 'prsn' or varn == 'SNOW' or varn == 'snow' or varn == 'LSNOW':
    11539         varvals = ['prsn', 'snowfall', 0., 1.e-4, 'snowfall|flux', 'kgm-2s-1', 'BuPu']
    11540     elif varn == 'prw' or varn == 'WRFprh':
    11541         varvals = ['prw', 'atmosphere_water_vapor_content', 0., 10.,                 \
    11542           'water|vapor"path', 'kgm-2', 'Blues']
    11543     elif varn == 'ps' or varn == 'psfc' or varn =='PSFC' or varn == 'psol' or        \
    11544       varn == 'Surface Pressure':
    11545         varvals=['ps', 'surface_air_pressure', 85000., 105400., 'surface|pressure',  \
    11546           'hPa', 'cool']
    11547     elif varn == 'psl' or varn == 'mslp' or varn =='WRFmslp':
    11548         varvals=['psl', 'air_pressure_at_sea_level', 85000., 104000.,                \
    11549           'mean|sea|level|pressure', 'Pa', 'Greens']
    11550     elif varn == 'q_th':
    11551         varvals = ['q_th', 'thermal_plume_total_water_content', 0., 25.,             \
    11552           'total|water|cotent|in|thermal|plume', 'mm', 'YlOrRd']
    11553     elif varn == 'r' or varn == 'QVAPOR' or varn == 'ovap' or varn == 'LOVAP':
    11554         varvals = ['r', 'water_mixing_ratio', 0., 0.03, 'water|mixing|ratio',        \
    11555           'kgkg-1', 'BuPu']
    11556     elif varn == 'rsds' or varn == 'SWdnSFC' or varn == 'SWdn at surface' or         \
    11557       varn == 'SWDOWN':
    11558         varvals=['rsds', 'surface_downwelling_shortwave_flux_in_air',  0., 1200.,    \
    11559           'downward|SW|surface|radiation', 'Wm-2' ,'Reds']
    11560     elif varn == 'rsdsacc':
    11561         varvals=['rsdsacc', 'accumulated_surface_downwelling_shortwave_flux_in_air', \
    11562           0., 1200., 'accumulated|downward|SW|surface|radiation', 'Wm-2' ,'Reds']
    11563     elif varn == 'rvor' or varn == 'WRFrvor':
    11564         varvals = ['rvor', 'air_relative_vorticity', -2.5E-3, 2.5E-3,                \
    11565           'air|relative|vorticity', 's-1', 'seismic']
    11566     elif varn == 'rvors' or varn == 'WRFrvors':
    11567         varvals = ['rvors', 'surface_air_relative_vorticity', -2.5E-3, 2.5E-3,       \
    11568           'surface|air|relative|vorticity', 's-1', 'seismic']
    11569     elif varn == 's_therm' or varn == 'LS_THERM':
    11570         varvals = ['s_therm', 'thermals_excess', 0., 0.8, 'thermals|excess', 'K',    \
    11571           'Reds']
    11572     elif varn == 's_therm' or varn == 'LS_THERM':
    11573         varvals = ['s_therm', 'thermals_excess', 0., 0.8, 'thermals|excess', 'K',    \
    11574           'Reds']
    11575     elif varn == 'ta' or varn == 'WRFt' or varn == 'temp' or varn == 'LTEMP' or      \
    11576       varn == 'Air temperature':
    11577         varvals = ['ta', 'air_temperature', 195., 320., 'air|temperature', 'K',      \
    11578           'YlOrRd']
    11579     elif varn == 'tas' or varn == 'T2' or varn == 't2m' or varn == 'T2M' or          \
    11580       varn == 'Temperature 2m':
    11581         varvals = ['tas', 'air_temperature', 240., 310., 'air|temperature|at|2m', '  \
    11582           K', 'YlOrRd']
    11583     elif varn == 'tds' or varn == 'TH2':
    11584         varvals = ['tds', 'air_dew_point_temperature', 240., 310.,                   \
    11585           'air|dew|point|temperature|at|2m', 'K', 'YlGnBu']
    11586     elif varn == 'time'or varn == 'time_counter':
    11587         varvals = ['time', 'time', 0., 1000., 'time',                                \
    11588           'hours|since|1949/12/01|00:00:00', 'Reds']
    11589     elif varn == 'ua' or varn == 'vitu' or varn == 'U' or varn == 'Zonal wind' or    \
    11590       varn == 'LVITU':
    11591         varvals = ['ua', 'eastward_wind', -30., 30., 'eastward|wind', 'ms-1',        \
    11592           'seismic']
    11593     elif varn == 'uas' or varn == 'u10m' or varn == 'U10' or varn =='Vent zonal 10m':
    11594         varvals = ['uas', 'eastward_wind', -30., 30., 'eastward|2m|wind',    \
    11595           'ms-1', 'seismic']
    11596     elif varn == 'va' or varn == 'vitv' or varn == 'V' or varn == 'Meridional wind'  \
    11597       or varn == 'LVITV':
    11598         varvals = ['va', 'northward_wind', -30., 30., 'northward|wind', 'ms-1',      \
    11599           'seismic']
    11600     elif varn == 'vas' or varn == 'v10m' or varn == 'V10' or                         \
    11601       varn =='Vent meridien 10m':
    11602         varvals = ['vas', 'northward_wind', -30., 30., 'northward|2m|wind', 'ms-1',  \
    11603           'seismic']
    11604     elif varn == 'wake_h' or varn == 'LWAKE_H':
    11605         varvals = ['wake_h', 'wake_height', 0., 1000., 'height|of|the|wakes', 'm',   \
    11606           'YlOrRd']
    11607     elif varn == 'wake_s' or varn == 'LWAKE_S':
    11608         varvals = ['wake_s', 'wake_area_fraction', 0., 0.5, 'wake|spatial|fraction', \
    11609           '1', 'BuGn']
    11610     elif varn == 'wa' or varn == 'W' or varn == 'Vertical wind':
    11611         varvals = ['wa', 'upward_wind', -10., 10., 'upward|wind', 'ms-1',            \
    11612           'seismic']
    11613     elif varn == 'wap' or varn == 'vitw' or varn == 'LVITW':
    11614         varvals = ['wap', 'upward_wind', -3.e-10, 3.e-10, 'upward|wind', 'mPa-1',    \
    11615           'seismic']
    11616     elif varn == 'wss' or varn == 'SPDUV':
    11617         varvals = ['wss', 'air_velocity',  0., 30., 'surface|horizontal|wind|speed', \
    11618           'ms-1', 'Reds']
    11619     elif varn == 'xtime' or varn == 'XTIME':
    11620         varvals = ['xtime', 'time',  0., 1.e5, 'time',                               \
    11621           'minutes|since|simulation|start', 'Reds']
    11622     elif varn == 'x' or varn == 'X':
    11623         varvals = ['x', 'x',  0., 100., 'x', '-', 'Reds']
    11624     elif varn == 'y' or varn == 'Y':
    11625         varvals = ['y', 'y',  0., 100., 'y', '-', 'Blues']
    11626     elif varn == 'z' or varn == 'Z':
    11627         varvals = ['z', 'z',  0., 100., 'z', '-', 'Greens']
    11628     elif varn == 'zg' or varn == 'WRFght' or varn == 'Geopotential height' or        \
    11629       varn == 'geop' or varn == 'LGEOP':
    11630         varvals = ['zg', 'geopotential_height', 0., 80000., 'geopotential|height',   \
    11631           'm2s-2', 'rainbow']
    11632     elif varn == 'zmax_th' or varn == 'LZMAX_TH':
    11633         varvals = ['zmax_th', 'thermal_plume_height', 0., 4000.,                     \
    11634           'maximum|thermals|plume|height', 'm', 'YlOrRd']
    11635     elif varn == 'zmla' or varn == 's_pblh' or varn == 'LS_PBLH':
    11636         varvals = ['zmla', 'atmosphere_boundary_layer_thickness', 0., 2500.,         \
    11637           'atmosphere|boundary|layer|thickness', 'm', 'Blues']
    11638     else:
    11639         print errormsg
    11640         print '  ' + fname + ': variable ' + varn + ' not defined !!!'
    11641         quit(-1)
    11642 
    11643     if ifst:
    11644       varvals[0] = varvals[0] + stname
    11645 ## Should be already there
    11646 #      varvals[4] = varvals[4] + statsLong[stname]
    11647 
    11648     return varvals
    11649 
    1165011775def WRF_CFtime_creation(values, ncfile, varn):
    1165111776    """ Function to add a CF-convention time unit in a WRF file
Note: See TracChangeset for help on using the changeset viewer.