Simplification for adding or removing CLaMS parameters

Issue #12 resolved
Jens-Uwe Grooß created an issue

As it is written now, the chemical species or parameters in the CLaMS output are repeated seven times for

  • defining the data_organisation table in class CLAMSDataAccess
  • define the Netcdf variables used in CFVariableIdentifier
  • define the default value range in horizontal and vertical plots
  • create the classes "HS_ChemStyle_PL_xxx" and "VS_ChemStyle_PL_xxx"

It would be easier to read these from one location with the syntax like

clams_config = {
 u'CO': {'levels': {50: (0., 20),
                    500: (0, 200.0)},
         'limits': (0., 200.),
         'units': u'ppbv',
         'cfidentifier': 'CO_volume_mixing_ratio',
         'long_name': 'CO_volume_mixing_ratio',
    }
...
}

This construct should be known everywhere the loops over the CLaMS species are needed. It should rather be a configuration file than a python programme. With this it should be very easy to add or remove chemical parameters.

Potentially the information besides the limits/levels could be also derived from the NetCDF files this would make it even easier to add/remove parameters.

Current locations where CLaMS chemical species are incorporated:

mslib/mss_config.py, line 456ff

    for ent in [u'CH4', u'CO', u'F11', u'F12', u'H2O', u'N2O',
        _data_organisation_table[ent + "_volume_mixing_ratio"] = {"pl": "PRESSURE_LEVELS"}

mslib/netCDF4tools.py, line 348ff

for ent in [u'CH4', u'CO', u'F11', u'F12', u'H2O', u'N2O',
            u'O3', u'SEA', u'ECH', u'NIN', u'SIN', u'ICH']:
     CFVariableIdentifier[ent + "_volume_mixing_ratio"] = [
        ("var_name", ent),
        ("standard_name", ent),
        ("long_name", ent + "_volume_mixing_ratio")
     ]

mswms/mpl_hsec_styles.py: line 525 ff

CLAMS_CONFIG = {
[...]
u'CO': {'levels': {50: (0., 20),
                    500: (0, 200.0)},
          'units': u'ppbv'},
[...]
}

line 790ff:

for ent in [u'CH4', u'CO', u'F11', u'F12', u'H2O', u'N2O',
            u'O3', u'SEA', u'ECH', u'NIN', u'SIN', u'ICH']:
        globals()["HS_ChemStyle_PL_" + ent] = make_clams_chem_class(ent)

mswms/mpl_vsec_styles.py: line 124ff:

CLAMS_CONFIG = {
[...]
u'CO': {'limits': (0., 150.), 'units': u'ppbv'},
[...]
}

mswms/mss_wms_settings.py, line 58ff:

for ent in [u'CH4', u'CO', u'F11', u'F12', u'H2O', u'N2O',
            u'O3', u'SEA', u'ECH', u'NIN', u'SIN', u'ICH']:
    register_horizontal_layers.append(
        (getattr(mpl_hsec_styles, "HS_ChemStyle_PL_" + ent), ["clams_INDIA"])
    )

line 87ff:

for ent in [u'CH4', u'CO', u'F11', u'F12', u'H2O', u'N2O',
            u'O3', u'SEA', u'ECH', u'NIN', u'SIN', u'ICH']:
    register_vertical_layers.append(
        (getattr(mpl_vsec_styles, "VS_ChemStyle_PL_" + ent), ["clams_INDIA"])
    )

Comments (6)

  1. Log in to comment