melodies_monet.driver

Drive the entire analysis package via the analysis class.

Classes

analysis()

The analysis class.

model()

The model class.

observation()

The observation class.

pair()

The pair class.

class melodies_monet.driver.analysis

The analysis class.

The analysis class is the highest level class and stores all information about the analysis. It reads and stores information from the input yaml file and defines overarching analysis information like the start and end time, which models and observations to pair, etc.

__init__()

Initialize an analysis object.

concat_pairs()

Read and concatenate all observation and model time interval pair data, populating the paired dict.

Returns

None

open_models(time_interval=None)

Open all models listed in the input yaml file and create a model object for each of them, populating the models dict.

Parameters

time_interval (optional, default None) ([pandas.Timestamp, pandas.Timestamp]) – If not None, restrict models to datetime range spanned by time interval [start, end].

Returns

None

open_obs(time_interval=None)

Open all observations listed in the input yaml file and create an observation instance for each of them, populating the obs dict.

Parameters

time_interval (optional, default None) ([pandas.Timestamp, pandas.Timestamp]) – If not None, restrict obs to datetime range spanned by time interval [start, end].

Returns

None

pair_data(time_interval=None)

Pair all observations and models in the analysis class (i.e., those listed in the input yaml file) together, populating the paired dict.

Parameters

time_interval (optional, default None) ([pandas.Timestamp, pandas.Timestamp]) – If not None, restrict pairing to datetime range spanned by time interval [start, end].

Returns

None

plotting()

Cycle through all the plotting groups (e.g., plot_grp1) listed in the input yaml file and create the plots.

This routine loops over all the domains and model/obs pairs specified in the plotting group (.control_dict['plots']) for all the variables specified in the mapping dictionary listed in paired.

Creates plots stored in the file location specified by output_dir in the analysis section of the yaml file.

Returns

None

read_analysis()

Read all previously saved analysis attributes listed in analysis section of input yaml file.

Returns

None

read_control(control=None)

Read the input yaml file, updating various analysis instance attributes.

Parameters

control (str) – Input yaml file path. If provided, control will be set to this value.

Returns

None

save_analysis()

Save all analysis attributes listed in analysis section of input yaml file.

Returns

None

stats()

Calculate statistics specified in the input yaml file.

This routine loops over all the domains and model/obs pairs for all the variables specified in the mapping dictionary listed in paired.

Creates a csv file storing the statistics and optionally a figure visualizing the table.

Returns

None

models

Models, set by open_models().

Type

dict

obs

Observations, set by open_obs().

Type

dict

paired

Paired data, set by pair_data().

Type

dict

class melodies_monet.driver.model

The model class.

A class with information and data from model results.

__init__()

Initialize a model object.

glob_files()

Convert the model file location string read in by the yaml file into a list of files containing all model data.

Returns

None

mask_and_scale()

Mask and scale model data including unit conversions.

Returns

None

open_model_files(time_interval=None)

Open the model files, store data in model instance attributes, and apply mask and scaling.

Models supported are cmaq, wrfchem, rrfs, and gsdchem. If a model is not supported, MELODIES-MONET will try to open the model data using a generic reader. If you wish to include new models, add the new model option to this module.

Parameters

time_interval (optional, default None) ([pandas.Timestamp, pandas.Timestamp]) – If not None, restrict models to datetime range spanned by time interval [start, end].

Returns

None

class melodies_monet.driver.observation

The observation class.

A class with information and data from an observational dataset.

__init__()

Initialize an observation object.

filter_obs()

Filter observations based on filter_dict.

Returns

None

mask_and_scale()

Mask and scale observations, including unit conversions and setting detection limits.

Returns

None

obs_to_df()

Convert and reformat observation object (obj) to dataframe.

Returns

None

open_obs(time_interval=None)

Open the observational data, store data in observation pair, and apply mask and scaling.

Parameters

time_interval (optional, default None) ([pandas.Timestamp, pandas.Timestamp]) – If not None, restrict obs to datetime range spanned by time interval [start, end].

Returns

None

obj

The data object (pandas.DataFrame or xarray.Dataset).

class melodies_monet.driver.pair

The pair class.

The pair class pairs model data directly with observational data along time and space.

__init__()

Initialize a pair object.

fix_paired_xarray(dset)

Reformat the paired dataset.

Parameters

dset (xarray.Dataset)

Returns

xarray.Dataset – Reformatted paired dataset.