lib.adf_diag module

Location of the “AdfDiag” object, which is used to store all relevant data and info needed for generating CAM/ADF diagnostics, including info on the averaging, regridding, and plotting methods themselves.

class lib.adf_diag.AdfDiag(config_file, debug=False)[source]

Bases: AdfWeb

Main ADF diagnostics object.

This object is initalized using an ADF diagnostics configure (YAML) file, which specifies various user inputs, including CAM history file names and locations, years being analyzed, types of averaging, regridding, and other post-processing options being used, and the type of plots that will be created.

This object also contains various methods used to actually generate the plots and post-processed data.

create_climo()[source]

Temporally average CAM time series data in order to generate CAM climatologies.

The actual averaging is done using the scripts listed under “time_averaging_scripts” as specified in the config file. This is done so that the user can specify the precise kinds of averaging that are done (e.g. weighted vs. non-weighted averaging).

create_plots()[source]

Generate ADF diagnostic plots. The actual plotting is done using the scripts listed under “plotting_scripts” as specified in the config file. This is done so that the user can add their own plotting script(s) without having to modify the main ADF diagnostics routines.

create_time_series(baseline=False)[source]

Generate time series versions of the CAM history file data.

derive_variables(res=None, hist_str=None, vars_to_derive=None, ts_dir=None, constit_dict=None, overwrite=None)[source]

Derive variables acccording to steps given here. Since derivations will depend on the variable, each variable to derive will need its own set of steps below.

Caution: this method assumes that there will be one time series file per variable

If the file for the derived variable exists, the kwarg overwrite determines whether to overwrite the file (true) or exit with a warning message.

move_tsfiles_for_mdtf(verbose)[source]

Move ts files to the directory structure and names required by MDTF Should change with data catalogues

perform_analyses()[source]

Performs statistical and other analyses as specified by the user. This currently only includes the AMWG table generation.

This method also assumes that the analysis scripts require model inputs in a time series format.

property plotting_scripts

Return a copy of the ‘__plotting_scripts’ string list to user if requested.

regrid_climo()[source]

Re-grid CAM climatology files to observations or baseline climatologies, in order to allow for direct comparisons.

The actual regridding is done using the scripts listed under “regridding_scripts” as specified in the config file. This is done so that the user can specify the precise kinds of re-gridding that are done (e.g. bilinear vs. nearest-neighbor regridding).

setup_run_cvdp()[source]

Create CVDP directory tree, generate namelist file and edit driver.ncl needed to run CVDP. Submit CVDP diagnostics.

setup_run_mdtf()[source]

Create MDTF directory tree, generate input settings jsonc file Submit MDTF diagnostics. Returns mdtf_proc for sub-process control (waits for it to finish in run_adf_diag)

lib.adf_diag.construct_index_info(page_dict, fnam, opf)[source]

Helper function for generating web pages. d : dictionary for the index page information fnam : the image filename, img.stem –> then decompose the img file’s parts. opf: outputfile for the image