baseclass class#

class pycif.utils.classes.baseclass.Plugin(plg_orig=None, orig_name='', **kwargs)[source]#

Bases: object

The Plugin class is the parent class of all other pyCIF classes. It is used to store all information about sub-parts of pyCIF and loads if needed sub-modules.

classmethod childclass_factory(plg_orig, child_type=None, parent_plg=None, overwrite=False)[source]#

Generates an instance of one of Plugin’s child classes. Transfers all existing attributes in the argument plugin to the output child-class instance

Args:

plg_orig (Plugin): the plugin to turn into a child-class instance child_type (str): sub-class type to generate if not available in

plg_orig.plugin.type

overwrite (bool): overwrite the class type of the origin plugin

Return:

child_plg: a plugin with all the attributes from plg_orig, but as a child-class instance

classmethod dump_incorrect(file_dump)[source]#

Dump incorrect arguments from the Yaml into a file

Parameters:

file_dump – File where to dump

Returns:

classmethod flushall()[source]#
classmethod from_dict(def_dict, orig_name='', convert_none=False, **kwargs)[source]#

Loads a recursive dictionary structure into a Plugin

Args:

def_dict (dict): the definition dictionary orig_dict (dict): the definition dictionary used at level 0

Returns:

Plugin

classmethod from_yaml(def_file)[source]#

Generates a dictionary including all pyCIF parameters

Args:
def_file (string)Path to the definition file

Handles both absolute and relative paths

Returns:

config_dict (dictionary): Dictionary populated with all pyCIF parameters

classmethod get_loaded(name, version, plugin_type, subtype='')[source]#

Get the correct loaded plugin, given its name, version and type (and optionally subtype)

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin

Returns:

Plugin: plugin module for plugin version

classmethod get_registered(name, version, plugin_type, subtype='')[source]#

Get the correct registered plugin, given its name, version and type

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin

Returns:

Plugin: plugin module for plugin version

classmethod get_subclass(plg_type, plg_subtype='')[source]#

Get the plugin class template from a given type

Args:

plg_type (str): the plugin type to load plg_subtype (str): the plugin sub-type to load

Returns:

Empty instance of the correct class type

initiate(plg_type=None)[source]#

Initializes a Plugin, i.e., loads functions from registered plugins

Args:

plg_type (str): the type of plugin to load; this should correspond to one of the defined child-classes

Return:

module: a python module as registered in pyCIF

initiate_template(plg_type=None, default_functions={})[source]#

Initializes a Plugin template, with methods from the corresponding module.

Args:

self: the plugin to initialize plg_type: the type of the plugin to initialize default_functions (dict[str, bool]):

functions to load from the module and to attach to the plugin. Each key names the function and each value is a boolean to determine whether the corresponding function is a class method (with a reflective self as argument) or a classical static function

classmethod is_allowed(plugin_type)[source]#

Check whether a plugin type is allowed in pyCIF or not

Args:

plugin_type (str): type of plugin

Returns:

bool: True if allowed plugin

classmethod is_allowed_as_subtype(plugin_type)[source]#

Check whether a plugin type is allowed as the sub-type of a main type in pyCIF or not

Args:

plugin_type (str): type of plugin

Returns:

bool: True if allowed plugin

classmethod is_loaded(name, version, plugin_type, subtype='')[source]#

Check whether a plugin is loaded

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin

Returns:

bool

classmethod is_registered(name, version, plugin_type, subtype)[source]#

Check if a plugin is registered

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin

Returns:

bool: True if a parser is registered key: the key of the registered Plugin if registered

classmethod load_registered(name, version, plg_type, plg_subtype='', plg_orig=None)[source]#

Get a sub-class instance of a registered plugin. This can be used to get default required plugins.

Args:

name (str): name of the plugin version (str): version of the plugin plg_type (str): type of plugin plg_subtype (str): sub-type of plugin plg_orig (Plugin): Original plugin from which to copy attributes to the new plugin

Returns:

Plugin: a new plugin of correct type

loaded_instances = {}#
static plugin_key(name, version, plugin_type, subtype)[source]#

Creates the key for a name, version and plugin type

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin

Returns:

set: dict key for a plugin and version

plugin_subtypes = {'chemistry': {'': ''}, 'controlvect': {'': ''}, 'datastream': {'background': '.backgrounds', 'field': '.fields', 'flux': '.fluxes', 'meteo': '.meteos'}, 'datavect': {'': ''}, 'domain': {'': ''}, 'measurements': {'': ''}, 'minimizer': {'': ''}, 'mode': {'': ''}, 'model': {'': ''}, 'obsoperator': {'': ''}, 'obsparser': {'': ''}, 'obsvect': {'': ''}, 'platform': {'': ''}, 'setup': {'': ''}, 'simulator': {'': ''}, 'transform': {'basic': '.basic', 'complex': '.complex', 'system': '.system'}}#
plugin_types = {'chemistry': ['.chemistries', 'Chemistry'], 'controlvect': ['.controlvects', 'ControlVect'], 'datastream': ['.datastreams', 'DataStream'], 'datavect': ['.datavects', 'DataVect'], 'domain': ['.domains', 'Domain'], 'measurements': ['.measurements', 'Measurement'], 'minimizer': ['.minimizers', 'Minimizer'], 'mode': ['.modes', 'Mode'], 'model': ['.models', 'Model'], 'obsoperator': ['.obsoperators', 'ObsOperator'], 'obsparser': ['.obsparsers', 'ObsParser'], 'obsvect': ['.obsvects', 'ObsVect'], 'platform': ['.platforms', 'Platform'], 'setup': ['.setup', 'Setup'], 'simulator': ['.simulators', 'Simulator'], 'transform': ['.transforms', 'Transform']}#
classmethod print_default(plg)[source]#

Print default values if available

classmethod print_registered(print_requirement=False, print_rst=False, types=[], names=[], versions=[], stream=None)[source]#

Print in a user-friendly format the list of available plugins

Args:

print_requirement (bool): for each registered plugin, print its requirements print_rst (bool): print in rst format for automatic use in the documentations types (list): list of types of Plugins to print names (list): list of names of Plugins to print version (list): list of versions of Plugins to print stream: stream to which send the display. By default, stdout is used. A stream to a given file can be used instead.

ref_config = None#
reference_instances = {}#
classmethod register_plugin(name, version, module, plugin_type='', subtype='', **kwargs)[source]#

Register a module for a plugin and version with possibly options

Args:

name (str): name of the plugin version (str): version of the plugin plugin_type (str): type of plugin subtype (str): sub-type of plugin module (types.ModuleType): module defining the interface

between pyCIF and the plugin

**kwargs (dictionary): default options for module

registered = {('4dvar', 'std', 'mode', ''): 'pycif.plugins.modes.variational', ('BCs', 'template', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.bc_plugin_template', ('CAMS', 'netcdf', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.netcdf_cams', ('CHIMERE', 'AEMISSIONS', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.chimere', ('CHIMERE', 'acc', 'model', ''): 'pycif.plugins.models.chimere_acc', ('CHIMERE', 'gasJtab', 'chemistry', ''): 'pycif.plugins.chemistries.chimere', ('CHIMERE', 'icbc', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.chimere_icbc', ('CHIMERE', 'std', 'datastream', 'meteo'): 'pycif.plugins.datastreams.meteos.chimere_meteo', ('CHIMERE', 'std', 'domain', ''): 'pycif.plugins.domains.chimere', ('CHIMERE', 'std', 'model', ''): 'pycif.plugins.models.chimere', ('CMEMS', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.CMEMS', ('CO2M', 'pseudo_data', 'obsparser', ''): 'pycif.plugins.obsparsers.CO2M', ('CarbonMonitor', 'netcdf', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.CarbonMonitor', ('ECMWF', 'ecs', 'platform', ''): 'pycif.plugins.platforms.ecmwf_ecs', ('ECMWF', 'grib2', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.grib2_ecmwf', ('EDGAR', 'v5', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.edgar_v5', ('EDGARv8', 'time_profile', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.EDGARv8_EYECLIMA_nc', ('EMPA', 'daint', 'platform', ''): 'pycif.plugins.platforms.empa_daint', ('ESPRI', 'spirit-nvidia', 'platform', ''): 'pycif.plugins.platforms.espri_spirit_nvidia', ('EnSRF', 'std', 'mode', ''): 'pycif.plugins.modes.ensrf', ('FLEXINVERT', 'std', 'obsoperator', ''): 'pycif.plugins.obsoperators.fp', ('FLEXPART', 'nc', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.flexpart', ('FLEXPART', 'std', 'domain', ''): 'pycif.plugins.domains.flexpart', ('FMI', 'Puhti', 'platform', ''): 'pycif.plugins.platforms.fmi_puhti', ('GCP', '1x1', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.GCP_1x1', ('GCP_N2O', '1x1', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.GCP_1x1_N2O', ('GFED4', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.GFEDv4', ('GridFED', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.GridFED', ('ICON-ART', 'icbc', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.iconart_icbc', ('ICON-ART', 'sflx', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.iconart', ('ICON-ART', 'std', 'chemistry', ''): 'pycif.plugins.chemistries.iconart', ('ICON-ART', 'std', 'domain', ''): 'pycif.plugins.domains.iconart', ('ICON-ART', 'std', 'model', ''): 'pycif.plugins.models.iconart', ('ICOS', 'std', 'obsparser', ''): 'pycif.plugins.obsparsers.icos', ('INS', '2012web', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.ins', ('LAERO', 'nuwa', 'platform', ''): 'pycif.plugins.platforms.laero_nuwa', ('LMDZ', 'SACS', 'chemistry', ''): 'pycif.plugins.chemistries.lmdz', ('LMDZ', 'acc', 'model', ''): 'pycif.plugins.models.lmdz_acc', ('LMDZ', 'bin', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.lmdz_bin', ('LMDZ', 'chemfield', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_chemfield', ('LMDZ', 'chemfield-dynamico', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_chemfield_ico', ('LMDZ', 'chemfield-regular', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_chemfield_reg', ('LMDZ', 'dynamico', 'domain', ''): 'pycif.plugins.domains.lmdz_ico', ('LMDZ', 'ic', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_ic', ('LMDZ', 'inicond-dynamico', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_inicond_ico', ('LMDZ', 'inicond-regular', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_inicond_reg', ('LMDZ', 'mass-fluxes', 'datastream', 'meteo'): 'pycif.plugins.datastreams.meteos.lmdz_massflx', ('LMDZ', 'netcdf-dynamico', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.lmdz_netcdf_ico', ('LMDZ', 'netcdf-regular', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.lmdz_netcdf_reg', ('LMDZ', 'photochem', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_photochem', ('LMDZ', 'prescrconcs', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_prescrconcs', ('LMDZ', 'prodloss3d', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_prodloss3d', ('LMDZ', 'reg-ico', 'model', ''): 'pycif.plugins.models.lmdz_ico', ('LMDZ', 'regular', 'domain', ''): 'pycif.plugins.domains.lmdz_reg', ('LMDZ', 'sflx', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.lmdz_sflx', ('LMDZ', 'std', 'domain', ''): 'pycif.plugins.domains.lmdz', ('LMDZ', 'std', 'model', ''): 'pycif.plugins.models.lmdz_old', ('LMDZ-trajq', 'netcdf', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.lmdz_outfields_nc', ('LSCE', 'obelix', 'platform', ''): 'pycif.plugins.platforms.lsce_obelix', ('LSCE', 'obelix-nvidia', 'platform', ''): 'pycif.plugins.platforms.lsce_obelix_nvidia', ('Lagrangian', 'std', 'model', ''): 'pycif.plugins.models.lagrangian', ('M1QN3', 'std', 'minimizer', ''): 'pycif.plugins.minimizers.m1qn3', ('NOAA', 'glob_avg', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.noaa_glob_avg', ('TGCC-CCRT', 'AMD', 'platform', ''): 'pycif.plugins.platforms.ccrt_amd', ('TGCC-CCRT', 'nvidia', 'platform', ''): 'pycif.plugins.platforms.tgcc_ccrt_nvidia', ('TGCC-CCRT', 'std', 'platform', ''): 'pycif.plugins.platforms.tgcc_ccrt', ('TM5', 'SINK-TIPP', 'chemistry', ''): 'pycif.plugins.chemistries.TM5', ('TM5', 'ic', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.tm5_ic', ('TM5', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.tm5', ('TM5', 'std', 'datastream', 'meteo'): 'pycif.plugins.datastreams.meteos.tm5_meteo', ('TM5', 'std', 'model', ''): 'pycif.plugins.models.TM5', ('TM5-4DVAR', 'rodenbeck', 'datastream', 'background'): 'pycif.plugins.datastreams.backgrounds.tm5_background', ('TNO', 'netcdf', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.TNO_nc', ('TROPOMI', 'CH4-BLENDED', 'obsparser', ''): 'pycif.plugins.obsparsers.tropomi_blended', ('TROPOMI', 'CH4-RPRO', 'obsparser', ''): 'pycif.plugins.obsparsers.tropomi_rpro', ('TROPOMI', 'CH4-SRON', 'obsparser', ''): 'pycif.plugins.obsparsers.tropomi_sron', ('TROPOMI', 'CH4-WFMD', 'obsparser', ''): 'pycif.plugins.obsparsers.tropomi_wfmd', ('TROPOMI', 'CH4-official', 'obsparser', ''): 'pycif.plugins.obsparsers.tropomi_official', ('VERIFY', 'std', 'obsparser', ''): 'pycif.plugins.obsparsers.verify', ('VPRM', 'netcdf', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.VPRM_nc', ('VPRM1km', 'netcdf', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.VPRM1km_nc', ('WDCGG', 'std', 'obsparser', ''): 'pycif.plugins.obsparsers.wdcgg', ('adj-tl_test', 'std', 'mode', ''): 'pycif.plugins.modes.adjtl_test', ('analytic', 'std', 'mode', ''): 'pycif.plugins.modes.analytic', ('array2sampled', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.array2sampled', ('background', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.background', ('becker', 'ocean', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.becker_ocean', ('carboscope', 'std', 'datastream', 'background'): 'pycif.plugins.datastreams.backgrounds.carboscope_bg', ('clipcrop', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.clipcrop', ('conc2ratio', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.conc2ratio', ('congrad', 'std', 'minimizer', ''): 'pycif.plugins.minimizers.congrad', ('diagmet', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.diagmet', ('docker', 'cif', 'platform', ''): 'pycif.plugins.platforms.docker_cif', ('dummy', 'csv', 'datastream', 'meteo'): 'pycif.plugins.datastreams.meteos.dummy_csv', ('dummy', 'nc', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.dummy_nc', ('dummy', 'std', 'domain', ''): 'pycif.plugins.domains.dummy', ('dummy', 'std', 'model', ''): 'pycif.plugins.models.dummy', ('dummy', 'txt', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.dummy_txt', ('dummy_txt', 'std', 'simulator', ''): 'pycif.plugins.simulators.dummy', ('dump2format', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.dump2format', ('dump2inputs', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.dump2inputs', ('dynamico', 'std', 'domain', ''): 'pycif.plugins.domains.dynamico', ('exp', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.exp', ('families', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.families', ('flux', 'template', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.flux_plugin_template', ('footprint', 'std', 'mode', ''): 'pycif.plugins.modes.footprint', ('forward', 'std', 'mode', ''): 'pycif.plugins.modes.forward', ('fromcontrol', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.fromcontrol', ('gausscost', 'FLEXPART', 'simulator', ''): 'pycif.plugins.simulators.gausscost_flexpart', ('gausscost', 'std', 'simulator', ''): 'pycif.plugins.simulators.gausscost', ('gridded_netcdf', 'std', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.gridded_NetCDF_inicond', ('gridded_netcdf', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.gridded_NetCDF', ('gridded_netcdf', 'std', 'domain', ''): 'pycif.plugins.domains.gridded_NetCDF', ('gridded_netcdf', 'unstructured', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.unstructured_NetCDF', ('gridded_netcdf', 'unstructured', 'domain', ''): 'pycif.plugins.domains.unstructured_NetCDF', ('isotopes', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.isotopes', ('loadfromoutputs', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.loadfromoutputs', ('moist2dry', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.moist2dry', ('obspack', 'std', 'obsparser', ''): 'pycif.plugins.obsparsers.obspack', ('oldLMDZ', 'ic', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.oldlmdz_ic', ('oldLMDZ', 'photochem', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.oldlmdz_photochem', ('oldLMDZ', 'prescrconcs', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.oldlmdz_prescrconcs', ('orchidee', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.orchidee', ('point_sources', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.point_sources', ('post-proc', 'std', 'mode', ''): 'pycif.plugins.modes.postproc', ('product', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.product', ('random', 'param', 'measurements', ''): 'pycif.plugins.measurements.random_perparam', ('ratio2conc', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.ratio2conc', ('regrid', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.regrid', ('response-functions', 'std', 'mode', ''): 'pycif.plugins.modes.response_functions', ('run_model', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.run_model', ('satellites', 'std', 'transform', 'complex'): 'pycif.plugins.transforms.complex.satellites', ('satwetch4', 'std', 'model', ''): 'pycif.plugins.models.satwetch4', ('scipy', 'std', 'minimizer', ''): 'pycif.plugins.minimizers.scipy', ('sparse2sample', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.sparse2sample', ('standard', 'std', 'controlvect', ''): 'pycif.plugins.controlvects.standard', ('standard', 'std', 'datavect', ''): 'pycif.plugins.datavects.standard', ('standard', 'std', 'measurements', ''): 'pycif.plugins.measurements.standard', ('standard', 'std', 'obsoperator', ''): 'pycif.plugins.obsoperators.standard', ('standard', 'std', 'obsvect', ''): 'pycif.plugins.obsvects.standard', ('template', 'std', 'model', ''): 'pycif.plugins.models.template', ('template', 'std', 'obsparser', ''): 'pycif.plugins.obsparsers.template', ('time_interpolation', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.time_interpolation', ('toobsvect', 'std', 'transform', 'system'): 'pycif.plugins.transforms.system.toobsvect', ('unit_conversion', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.unit_conversion', ('vertical_interpolation', 'std', 'transform', 'basic'): 'pycif.plugins.transforms.basic.vertical_interpolation', ('wrfchem', 'icbc', 'datastream', 'field'): 'pycif.plugins.datastreams.fields.wrfchem_icbc', ('wrfchem', 'std', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.wrfchem', ('wrfchem', 'std', 'domain', ''): 'pycif.plugins.domains.wrfchem', ('wrfchem', 'std', 'model', ''): 'pycif.plugins.models.wrfchem'}#
classmethod save_loaded(plg)[source]#

Saves all loaded plugins to the class

Args:

plg (Plugin): plugin to save

set_requirements()[source]#

Update requirements depending on the Plugin properties

By default, this method does nothing. It can be included in any new Plugin depending on the developer needs.

Args:

self (Plugin): the Plugin to update

subreference_instances = {}#
classmethod to_dict(plg, exclude_patterns=None, full_output=False, large_to_strings=False)[source]#

Turns a Plugin to a dictionary for easier saving.

Args:

plg (Plugin): a Plugin instance to be saved as a dictionary

classmethod to_yaml(plg, yaml_file, full=True)[source]#

Write a Yaml from a loaded plugin

unauthorized_arguments = {}#