baseclass class#
- class pycif.utils.classes.baseclass.Plugin(plg_orig=None, orig_name='', **kwargs)[source]#
Bases:
objectBase class for all pyCIF plugin objects.
Stores plugin identity (type, name, version, subtype), manages the global registry of available plugins, and provides the machinery for loading, initialising and wiring plugin instances from YAML configuration.
- plugin_types#
Mapping of recognised plugin-type names to their module path and class name.
- Type:
dict
- plugin_subtypes#
Mapping of plugin types to their allowed subtypes.
- Type:
dict
- registered#
Registry of all registered plugin modules, keyed by (name, version, type, subtype).
- Type:
dict
- loaded_instances#
Cache of all instantiated plugins.
- Type:
dict
- reference_instances#
Level-0 plugin instances from the setup file.
- Type:
dict
- subreference_instances#
All sub-level plugin instances.
- Type:
dict
- unauthorized_arguments#
Arguments found in the YAML that are not declared in any plugin’s
input_arguments.- Type:
dict
- ref_config#
Reference configuration (set once at load time).
- 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']}#
- 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'}}#
- 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', ('CAMSREG', 'netcdf', 'datastream', 'flux'): 'pycif.plugins.datastreams.fluxes.CAMSREG_nc', ('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', ('ECMWF', 'grib2', 'domain', ''): 'pycif.plugins.domains.grib_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', ('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', ('JEAN-ZAY', 'std', 'platform', ''): 'pycif.plugins.platforms.jean_zay', ('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_mass_fluxes', ('LMDZ', 'mass-fluxes-acc', 'datastream', 'meteo'): 'pycif.plugins.datastreams.meteos.lmdz_massflx_old', ('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', ('co2mvs', 'std', 'mode', ''): 'pycif.plugins.modes.co2mvs', ('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', ('docker', 'nvidia', 'platform', ''): 'pycif.plugins.platforms.docker_nvidia', ('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', ('random', 'std', 'obsoperator', ''): 'pycif.plugins.obsoperators.random', ('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', 'conjugate', 'minimizer', ''): 'pycif.plugins.minimizers.scipy_conjugate', ('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'}#
- loaded_instances = {}#
- reference_instances = {}#
- subreference_instances = {}#
- unauthorized_arguments = {}#
- ref_config = None#
- static plugin_key(name, version, plugin_type, subtype)[source]#
Creates the key for a name, version and plugin type
- Parameters:
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:
dict key for a plugin and version
- Return type:
set
- 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
- Parameters:
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.
- classmethod is_registered(name, version, plugin_type, subtype)[source]#
Check if a plugin is registered
- Parameters:
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:
True if a parser is registered key: the key of the registered Plugin if registered
- Return type:
bool
- classmethod is_allowed(plugin_type)[source]#
Check whether a plugin type is allowed in pyCIF or not
- Parameters:
plugin_type (str) – type of plugin
- Returns:
True if allowed plugin
- Return type:
bool
- 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
- Parameters:
plugin_type (str) – type of plugin
- Returns:
True if allowed plugin
- Return type:
bool
- classmethod is_loaded(name, version, plugin_type, subtype='')[source]#
Check whether a plugin is loaded
- Parameters:
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 register_plugin(name, version, module, plugin_type='', subtype='', **kwargs)[source]#
Register a module for a plugin and version with possibly options
- Parameters:
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
- classmethod get_registered(name, version, plugin_type, subtype='')[source]#
Get the correct registered plugin, given its name, version and type
- Parameters:
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 module for plugin version
- Return type:
- classmethod get_loaded(name, version, plugin_type, subtype='')[source]#
Get the correct loaded plugin, given its name, version and type (and optionally subtype)
- Parameters:
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 module for plugin version
- Return type:
- classmethod get_subclass(plg_type, plg_subtype='')[source]#
Get the plugin class template from a given type
- Parameters:
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
- 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.
- classmethod save_loaded(plg)[source]#
Saves all loaded plugins to the class
- Parameters:
plg (Plugin) – plugin to save
- classmethod from_dict(def_dict, orig_name='', convert_none=False, **kwargs)[source]#
Load a recursive dictionary structure into a Plugin.
Each key of
def_dictbecomes an attribute of the returned Plugin. Nested dicts are loaded recursively into child Plugin instances.- Parameters:
def_dict (dict) – The definition dictionary to load.
orig_name (str) – Name label assigned to the returned plugin (stored as
plg.orig_name). Defaults to"".convert_none (bool) – If True, YAML keys whose value is
Noneare initialised as emptyPlugin()objects instead ofNone. Defaults to False.**kwargs – Forwarded to recursive calls; not used directly.
- Returns:
Plugin instance populated with the dictionary contents.
- Return type:
- classmethod to_dict(plg, exclude_patterns=None, full_output=False, large_to_strings=False, exclude_default=True)[source]#
Convert a Plugin instance to a plain nested dictionary.
- Parameters:
plg (Plugin) – Plugin instance to serialise.
exclude_patterns (list[str], optional) – Additional attribute names to exclude. The default exclusion list (
logfile,datei,datef,workdir,verbose) is always appended unlessexclude_defaultis False.full_output (bool) – If True, include large array-like attributes in full rather than summarising them as type/shape strings. Defaults to False.
large_to_strings (bool) – If True, replace arrays/dicts/lists with more than 10 elements by a short descriptive string. Defaults to False.
exclude_default (bool) – If True (default), always exclude the standard set of runtime attributes (dates, workdir, …).
- Returns:
Nested dictionary representation of the plugin.
- Return type:
dict
- classmethod to_yaml(plg, yaml_file, full=True)[source]#
Serialise a Plugin to a YAML configuration file.
- classmethod from_yaml(def_file)[source]#
Generates a dictionary including all pyCIF parameters
- Parameters:
def_file (string) – Path to the definition file Handles both absolute and relative paths
- Returns:
Dictionary populated with all pyCIF parameters
- Return type:
config_dict (dictionary)
- classmethod print_default(plg)[source]#
Print default parameter values for a plugin, if available.
- Parameters:
plg (Plugin) – Plugin instance whose
default_valuesto display.
- 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
- Parameters:
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
- Returns:
a plugin with all the attributes from plg_orig, but as a child-class instance
- Return type:
child_plg
- initiate_template(plg_type=None, default_functions={})[source]#
Initialise a Plugin template by loading functions from the registered module.
Calls
initiate()to fetch the module, then attaches the functions listed indefault_functionstoself, either as bound methods or as plain function references. Also attachesset_requirementsif defined in the module.- Parameters:
plg_type (str, optional) – Plugin type passed to
initiate(). Defaults to None (inferred fromself.plugin.type).default_functions (dict[str, bool]) – Mapping of function name →
Trueif the function should be bound as a method (receivesselfas first argument),Falsefor a static attachment.
- initiate(plg_type=None)[source]#
Initializes a Plugin, i.e., loads functions from registered plugins
- Parameters:
plg_type (str) – the type of plugin to load; this should
child-classes (correspond to one of the defined)
- Returns:
a python module as registered in pyCIF
- Return type:
module
- classmethod flushall()[source]#
Reset all class-level plugin caches.
Clears
loaded_instances,reference_instancesandsubreference_instances. Useful between independent simulation runs or in test suites to avoid cross-contamination between setups.
- 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.
- Parameters:
self (Plugin) – the Plugin to update
- classmethod dump_incorrect(file_dump)[source]#
Dump undeclared YAML arguments to a text file for inspection.
Writes one line per plugin tree path listing the argument names that were found in the YAML but are not declared in the plugin’s
input_arguments.- Parameters:
file_dump (str) – Path to the output file.