src.diagnostic module

Classes representing configuration and status of individual diagnostic scripts (PODs) and variables required by the scripts.

class src.diagnostic.PodDataFileFormat(value)

Bases: src.util.basic.MDTFEnum

An enumeration.

ANY_NETCDF = 1
ANY_NETCDF_CLASSIC = 2
ANY_NETCDF3 = 3
NETCDF3_CLASSIC = 4
NETCDF_64BIT_OFFSET = 5
NETCDF_64BIT_DATA = 6
ANY_NETCDF4 = 7
NETCDF4_CLASSIC = 8
NETCDF4 = 9
class src.diagnostic.VarlistSettings(frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, max_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_duration: str = sentinel.NotSet, max_duration: str = sentinel.NotSet, format: src.diagnostic.PodDataFileFormat = <PodDataFileFormat.ANY_NETCDF_CLASSIC>, rename_variables: bool = False, multi_file_ok: bool = False, dimensions_ordered: bool = False)[source]

Bases: src.diagnostic._VarlistGlobalSettings, src.diagnostic._VarlistTimeSettings

Class to describe options affecting all variables requested by this POD. Corresponds to the “data” section of the POD’s settings.jsonc file.

property global_settings
property time_settings
__init__(frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, max_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_duration: str = sentinel.NotSet, max_duration: str = sentinel.NotSet, format: src.diagnostic.PodDataFileFormat = <PodDataFileFormat.ANY_NETCDF_CLASSIC>, rename_variables: bool = False, multi_file_ok: bool = False, dimensions_ordered: bool = False)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
dimensions_ordered: bool = False
format: src.diagnostic.PodDataFileFormat = 2
frequency = sentinel.NotSet
max_duration = sentinel.NotSet
max_frequency = sentinel.NotSet
min_duration = sentinel.NotSet
min_frequency = sentinel.NotSet
multi_file_ok: bool = False
rename_variables: bool = False
class src.diagnostic.VarlistCoordinateMixin(need_bounds: bool = False)[source]

Bases: object

Base class to describe a single dimension (in the netcdf data model sense) used by one or more variables. Corresponds to list entries in the “dimensions” section of the POD’s settings.jsonc file.

need_bounds: bool = False
__init__(need_bounds: bool = False)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
class src.diagnostic.VarlistCoordinate(need_bounds: bool = False, standard_name: str = sentinel.Mandatory, units: src.units.Units = sentinel.Mandatory, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory)[source]

Bases: src.data_model.DMCoordinate, src.diagnostic.VarlistCoordinateMixin

__init__(need_bounds: bool = False, standard_name: str = sentinel.Mandatory, units: src.units.Units = sentinel.Mandatory, axis: str = 'OTHER', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis: str = 'OTHER'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name: str = sentinel.Mandatory
need_bounds = False
standard_name: str = sentinel.Mandatory
units: src.units.Units = sentinel.Mandatory
value = None
class src.diagnostic.VarlistLongitudeCoordinate(need_bounds: bool = False, standard_name: str = 'longitude', units: src.units.Units = 'degrees_east', axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lon', range: tuple = None)[source]

Bases: src.data_model.DMLongitudeCoordinate, src.diagnostic.VarlistCoordinateMixin

range: tuple = None
__init__(need_bounds: bool = False, standard_name: str = 'longitude', units: src.units.Units = 'degrees_east', axis: str = 'X', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lon', range: tuple = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis = 'X'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name = 'lon'
need_bounds = False
standard_name = 'longitude'
units = 'degrees_east'
value = None
class src.diagnostic.VarlistLatitudeCoordinate(need_bounds: bool = False, standard_name: str = 'latitude', units: src.units.Units = 'degrees_north', axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lat', range: tuple = None)[source]

Bases: src.data_model.DMLatitudeCoordinate, src.diagnostic.VarlistCoordinateMixin

range: tuple = None
__init__(need_bounds: bool = False, standard_name: str = 'latitude', units: src.units.Units = 'degrees_north', axis: str = 'Y', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'lat', range: tuple = None)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis = 'Y'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name = 'lat'
need_bounds = False
standard_name = 'latitude'
units = 'degrees_north'
value = None
class src.diagnostic.VarlistVerticalCoordinate(need_bounds: bool = False, standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory)[source]

Bases: src.data_model.DMVerticalCoordinate, src.diagnostic.VarlistCoordinateMixin

__init__(need_bounds: bool = False, standard_name: str = sentinel.Mandatory, units: src.units.Units = '1', axis: str = 'Z', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, positive: str = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis: str = 'Z'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name: str = sentinel.Mandatory
need_bounds = False
positive: str = sentinel.Mandatory
standard_name: str = sentinel.Mandatory
units: src.units.Units = '1'
value = None
class src.diagnostic.VarlistPlaceholderTimeCoordinate(need_bounds: bool = False, standard_name: str = 'time', units: src.units.Units = '', axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'time', calendar: str = '', range: Any = None, frequency: Any = '', min_frequency: Any = '', max_frequency: Any = '', min_duration: Any = 'any', max_duration: Any = 'any')[source]

Bases: src.data_model.DMGenericTimeCoordinate, src.diagnostic.VarlistCoordinateMixin

frequency: Any = ''
min_frequency: Any = ''
max_frequency: Any = ''
min_duration: Any = 'any'
max_duration: Any = 'any'
standard_name = 'time'
axis = 'T'
__init__(need_bounds: bool = False, standard_name: str = 'time', units: src.units.Units = '', axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = 'time', calendar: str = '', range: Any = None, frequency: Any = '', min_frequency: Any = '', max_frequency: Any = '', min_duration: Any = 'any', max_duration: Any = 'any')None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
calendar = ''
classmethod from_instances(*t_coords)

Create new instance from “union” of attributes of one or more t_coords.

property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

property is_static

Check for time-independent data (‘fx’ in CMIP6 DRS.) Do the comparison by checking date_range against the placeholder value because that’s unique – we may be using a different DateFrequency depending on the data source.

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

name = 'time'
need_bounds = False
range = None
units = ''
value = None
class src.diagnostic.VarlistTimeCoordinate(need_bounds: bool = False, standard_name: str = 'time', units: src.units.Units = sentinel.Mandatory, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, calendar: str = '', range: src.util.datelabel.AbstractDateRange = None, frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, max_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_duration: str = sentinel.NotSet, max_duration: str = sentinel.NotSet)[source]

Bases: src.diagnostic._VarlistTimeSettings, src.data_model.DMTimeCoordinate, src.diagnostic.VarlistCoordinateMixin

__init__(need_bounds: bool = False, standard_name: str = 'time', units: src.units.Units = sentinel.Mandatory, axis: str = 'T', bounds_var: src.data_model.AbstractDMCoordinateBounds = None, value: Union[int, float] = None, name: str = sentinel.Mandatory, calendar: str = '', range: src.util.datelabel.AbstractDateRange = None, frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, max_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet, min_duration: str = sentinel.NotSet, max_duration: str = sentinel.NotSet)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(*args, **kwargs)
axis = 'T'
property bounds

Store bounds_var as a pointer to the actual object representing the bounds variable for this coordinate, but in order to parallel xarray’s syntax define ‘bounds’ to return the name of this variable, not the variable itself.

bounds_var = None
calendar = ''
frequency: src.util.datelabel.DateFrequency = sentinel.NotSet
classmethod from_instances(*t_coords)

Create new instance from “union” of attributes of one or more t_coords.

property has_bounds

Whether the coordinate has an associated bounds variable (bool).

property is_scalar

Whether the coordinate is a scalar coordinate (bool).

property is_static

Check for time-independent data (‘fx’ in CMIP6 DRS.) Do the comparison by checking date_range against the placeholder value because that’s unique – we may be using a different DateFrequency depending on the data source.

make_scalar(new_value)

Returns a copy of the coordinate, converted to a scalar coordinate at value new_value (and coordinate’s current units.)

max_duration: str = sentinel.NotSet
max_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet
min_duration: str = sentinel.NotSet
min_frequency: src.util.datelabel.DateFrequency = sentinel.NotSet
name = sentinel.Mandatory
need_bounds = False
range = None
standard_name = 'time'
units = sentinel.Mandatory
value = None
class src.diagnostic.VarlistEntryRequirement(value)

Bases: src.util.basic.MDTFEnum

util.MDTFEnum used to track whether the DataSource is required to provide data for the VarlistEntry.

REQUIRED = 1
OPTIONAL = 2
ALTERNATE = 3
AUX_COORDINATE = 4
class src.diagnostic.VarlistEntryStage(value)

Bases: src.util.basic.MDTFIntEnum

util.MDTFIntEnum used to track the stages of processing of a VarlistEntry carried out by the DataSource.

NOTSET = 1
INITED = 2
QUERIED = 3
FETCHED = 4
PREPROCESSED = 5
class src.diagnostic.VarlistEntry(*args, **kwargs)[source]

Bases: src.core.MDTFObjectBase, src.data_model.DMVariable, src.diagnostic._VarlistGlobalSettings, src.util.logs.VarlistEntryLoggerMixin

Class to describe data for a single variable requested by a POD. Corresponds to list entries in the “varlist” section of the POD’s settings.jsonc file.

Two VarlistEntries are equal (as determined by the __eq__ method, which compares fields without compare=False) if they specify the same data product, ie if the same output file from the preprocessor can be symlinked to two different locations.

Attributes
  • use_exact_name – see docs

  • env_var – Name of env var which is set to the variable’s name in the provided dataset.

  • path_variable – Name of env var containing path to local data.

  • dest_path – Path to local data.

  • alternates – List of lists of VarlistEntries.

  • translationcore.TranslatedVarlistEntry, populated by DataSource.

  • data – dict mapping experiment_keys to DataKeys. Populated by DataSource.

use_exact_name: bool = False
env_var: str = ''
path_variable: str = ''
dest_path: str = ''
requirement: src.diagnostic.VarlistEntryRequirement = 1
alternates: list
translation: Any = None
data: util.ConsistentDict
stage: src.diagnostic.VarlistEntryStage = 1
__post_init__(coords=None)[source]
property name_in_model
classmethod from_struct(global_settings_d, dims_d, name, parent, **kwargs)[source]

Instantiate from a struct in the varlist section of a POD’s settings.jsonc.

iter_alternates()[source]

Breadth-first traversal of “sets” of alternate VarlistEntries, alternates for those alternates, etc. (“Sets” is in quotes because they’re implemented as lists here, since VarlistEntries aren’t immutable.)

This is a “deep” iterator, yielding alternates of alternates, alternates of those, … etc. until variables with no alternates are encountered or all variables have been yielded. In addition, it yields the “sets” of alternates and not the VarlistEntries themselves.

static alternates_str(alt_list)[source]
debug_str()[source]

String representation with more debugging information.

iter_data_keys(status=None, status_neq=None)[source]

Yield DataKeyBases from v’s data dict, filtering out those DataKeys that have been eliminated via previous failures in fetching or preprocessing.

deactivate_data_key(d_key, exc)[source]

When a DataKey (d_key) has been deactivated during query or fetch, log a message and delete our record of it if we were using it, and deactivate ourselves if we don’t have any viable DataKeys left.

We can’t just use the status attribute on the DataKey, because the VarlistEntry-DataKey relationship is many-to-many.

property local_data

Return sorted list of local file paths corresponding to the selected experiment.

query_attrs(key_synonyms=None)[source]

Returns a dict of attributes relevant for DataSource.query_dataset() (ie, which describe the variable itself and aren’t specific to the MDTF implementation.)

property env_vars

Get env var definitions for:

  • The path to the preprocessed data file for this variable,

  • The name for this variable in that data file,

  • The names for all of this variable’s coordinate axes in that file,

  • The names of the bounds variables for all of those coordinate dimensions, if provided by the data.

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(format: src.diagnostic.PodDataFileFormat = <PodDataFileFormat.ANY_NETCDF_CLASSIC>, rename_variables: bool = False, multi_file_ok: bool = False, dimensions_ordered: bool = False, coords: dataclasses.InitVar = None, name: str = sentinel.Mandatory, standard_name: str = sentinel.Mandatory, units: src.units.Units = '', modifier: str = '', _id: src.util.basic.MDTF_ID = None, _parent: Any = sentinel.Mandatory, status: src.core.ObjectStatus = <ObjectStatus.NOTSET>, use_exact_name: bool = False, env_var: str = '', path_variable: str = '', dest_path: str = '', requirement: src.diagnostic.VarlistEntryRequirement = <VarlistEntryRequirement.REQUIRED>, alternates: list = <factory>, translation: Any = None, data: src.util.basic.ConsistentDict = <factory>, stage: src.diagnostic.VarlistEntryStage = <VarlistEntryStage.NOTSET>)None

Initialize self. See help(type(self)) for accurate signature.

property active
add_scalar(ax, ax_value, **kwargs)

Metadata operation corresponding to taking a slice of a higher-dimensional variable (extracting its values at axis ax = ax_value). The coordinate corresponding to ax is removed from the list of coordinate dimensions and added to the list of scalar coordinates.

property axes

Superset of the dim_axes() dict (whose values contain coordinate dimensions only) that includes axes corresponding to scalar coordinates.

property axes_set

Superset of the dim_axes_set() frozenset (which contains axes labels corresponding to coordinate dimensions only) that includes axes labels corresponding to scalar coordinates.

build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

child_deactivation_handler(child, exc)
child_status_update(exc=None)
coords = None
deactivate(exc, level=None)
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

dimensions_ordered = False
property failed
format = 2
format_log(children=True)

Return contents of log buffer, as well as that of any child objects in child_objs, as a formatted string.

property full_name

Object’s full name, to be used in logging and debugging. Preferred because it eliminates irrelevant information in repr(), which is lengthy.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

init_extra_log_handlers()

Hook used by child classes to add class-specific log handlers.

init_log(fmt=None)

Logger initialization. This is a mixin class, so we don’t define a __init__ method for simplicity.

property is_static

Whether the variable has time dependence (bool).

iter_children(child_type=None, status=None, status_neq=None)

Generator iterating over child objects associated with this object.

Parameters
  • status – None or ObjectStatus, default None. If None, iterates over all child objects, regardless of status. If a ObjectStatus value is passed, only iterates over child objects with that status.

  • status_neq – None or ObjectStatus, default None. If set, iterates over child objects which don’t have the given status. If status is set, this setting is ignored.

property last_exception

Return most recent Exception received by the object.

modifier = ''
multi_file_ok = False
name = sentinel.Mandatory
remove_scalar(ax, position=- 1, **kwargs)

Metadata operation that’s the inverse of add_scalar(). Given an axis label ax that’s currently a scalar coordinate, remove the slice value and add it to the list of dimension coordinates at position (default end of the list.)

rename_variables = False
standard_name = sentinel.Mandatory
status = 1
units = ''
class src.diagnostic.Varlist(coords: dataclasses.InitVar = None, contents: dataclasses.InitVar = sentinel.Mandatory)[source]

Bases: src.data_model.DMDataSet

Class to perform bookkeeping for the model variables requested by a single POD.

classmethod from_struct(d, parent)[source]

Parse the “dimensions”, “data” and “varlist” sections of the POD’s settings.jsonc file when instantiating a new Diagnostic object.

Parameters

d (dict) – Contents of the POD’s settings.jsonc file.

Returns

dict, keys are names of the dimensions in POD’s convention, values are PodDataDimension objects.

find_var(v)[source]

If a variable matching v is already present in the Varlist, return (a reference to) it (so that we don’t try to add duplicates), otherwise return None.

property T

Return T axis dimension coordinate if defined, else None.

property X

Return X axis dimension coordinate if defined, else None.

property Y

Return Y axis dimension coordinate if defined, else None.

property Z

Return Z axis dimension coordinate if defined, else None.

__init__(coords: dataclasses.InitVar = None, contents: dataclasses.InitVar = sentinel.Mandatory)None

Initialize self. See help(type(self)) for accurate signature.

__post_init__(coords=None, contents=None)
add_contents(*vars_)
build_axes(*coords, verify=True)

Constructs a dict mapping axes labels to dimension coordinates (of type AbstractDMCoordinate.)

change_coord(ax_name, new_class=None, **kwargs)

Replace attributes on a given coordinate, but also optionally cast them to new classes.

Parameters
  • ax_name – Name of the coodinate to modify.

  • new_class (optional) – new class to cast the returned coordinate to.

  • kwargs – Set of attribute names and values to replace on the returned copy.

contents: dataclasses.InitVar = sentinel.Mandatory
coords = None
property dim_axes

Retrun dict mapping axes labels (‘X’, ‘Y’, etc.) to corresponding dimension coordinate objects.

property dim_axes_set

Return frozenset of dimension coordinate axes labels.

get_scalar(ax_name)

If the axis label ax_name is a scalar coordinate, return the corresponding AbstractDMCoordinate object, otherwise return None.

property is_static

Whether the variable has time dependence (bool).

iter_contents()

Generator iterating over the full contents of the DataSet (variables, auxiliary coordinates and coordinate bounds.)

iter_vars()

Generator iterating over variables and auxiliary coordinates but excluding coordinate bounds.

vars
coord_bounds
aux_coords
class src.diagnostic.Diagnostic(*args, **kwargs)[source]

Bases: src.core.MDTFObjectBase, src.util.logs.PODLoggerMixin

Class holding configuration for a diagnostic script. Object attributes are read from entries in the settings section of the POD’s settings.jsonc file upon initialization.

See settings file documentation for documentation on attributes.

long_name: str = ''

Test docstring for long_name.

description: str = ''
convention: str = 'CF'
realm: str = ''
driver: str = ''
program: str = ''
runtime_requirements: dict
pod_env_vars: util.ConsistentDict
log_file: io.IOBase = None
nc_largefile: bool = False
varlist: src.diagnostic.Varlist = None
preprocessor: Any = None
POD_CODE_DIR = ''
POD_OBS_DATA = ''
POD_WK_DIR = ''
POD_OUT_DIR = ''
__post_init__()[source]
classmethod from_struct(pod_name, d, parent, **kwargs)[source]

Instantiate a Diagnostic object from the JSON format used in its settings.jsonc file.

classmethod from_config(pod_name, parent)[source]

Usual method of instantiating Diagnostic objects, from the contents of its settings.jsonc file as stored in the ConfigManager.

child_deactivation_handler(failed_v, failed_v_exc)[source]

Update the status of which VarlistEntries are “active” (not failed somewhere in the query/fetch process) based on new information. If the process has failed for a VarlistEntry, try to find a set of alternate VarlistEntries. If successful, activate them; if not, raise a PodDataError.

close_log_file(log=True)[source]
setup(data_source)[source]

Configuration set by the DataSource on the POD (after the POD is initialized, but before pre-run checks.)

setup_pod_directories()[source]

Check and create directories specific to this POD.

set_entry_point()[source]

Locate the top-level driver script for the POD.

Raises: PodRuntimeError if driver script can’t be found.

set_interpreter()[source]

Determine what executable should be used to run the driver script.

Note

Existence of the program on the environment’s $PATH isn’t checked until before the POD runs (see src.environment_manager.)

pre_run_setup()[source]

Perform filesystem operations and checks prior to running the POD.

In order, this 1) sets environment variables specific to the POD, 2) creates POD-specific working directories, and 3) checks for the existence of the POD’s driver script.

Note

The existence of data files is checked with fetchData() and the runtime environment is validated separately as a function of run(). This is because each POD is run in a subprocess (due to the necessity of supporting multiple languages) so the validation must take place in that subprocess.

Raises

PodRuntimeError – is re-raised from the diagnostic.Diagnostic.set_entry_point() and diagnostic.Diagnostic._check_for_varlist_files() subroutines.

__init__(_id: src.util.basic.MDTF_ID = None, name: str = sentinel.Mandatory, _parent: Any = sentinel.Mandatory, status: src.core.ObjectStatus = <ObjectStatus.NOTSET>, long_name: str = '', description: str = '', convention: str = 'CF', realm: str = '', driver: str = '', program: str = '', runtime_requirements: dict = <factory>, pod_env_vars: src.util.basic.ConsistentDict = <factory>, nc_largefile: bool = False, varlist: src.diagnostic.Varlist = None, preprocessor: Any = None)None

Initialize self. See help(type(self)) for accurate signature.

property active
child_status_update(exc=None)
deactivate(exc, level=None)
property failed
format_log(children=True)

Return contents of log buffer, as well as that of any child objects in child_objs, as a formatted string.

property full_name
init_extra_log_handlers()

Hook used by child classes to add class-specific log handlers.

init_log(fmt=None)

Logger initialization. This is a mixin class, so we don’t define a __init__ method for simplicity.

iter_children(child_type=None, status=None, status_neq=None)

Generator iterating over child objects associated with this object.

Parameters
  • status – None or ObjectStatus, default None. If None, iterates over all child objects, regardless of status. If a ObjectStatus value is passed, only iterates over child objects with that status.

  • status_neq – None or ObjectStatus, default None. If set, iterates over child objects which don’t have the given status. If status is set, this setting is ignored.

property last_exception

Return most recent Exception received by the object.

name = sentinel.Mandatory
set_pod_env_vars()[source]

Sets all environment variables for the POD: paths and names of each variable and coordinate. Raise a WormKeyError if any of these definitions conflict.

status = 1