The validate API¶
This section describes the validate Application Programming Interface (API).
data_loader¶
THis module contains functions that will load data from netCDF files needed to produce plots. It uses various cdo commands to manipulate the netCDF files if they need to be processed before the data is extracted.
-
validate.data_loader.
dataload
(ifile, var, dates, realm='atmos', scale=1, shift=0, remapf='remapdis', remapgrid='r360x180', seasons=None, datatype='full', depthneeded=None, section=False, fieldmean=False, gridweights=False, cdostring=None, yearmean=False, external_function=None, external_function_args={})[source]¶ - Manipulates a file used a series of cdo commands which produce intermediate files,
- and returns data about the the final file produced based on the specified parameters.
Parameters: - ifile : string
the name of the original input file
- var : string
variable name
- dates : dictionary of the date range as strings of the form ‘yyyy-mm’
start_date and end_date keys should be specified
- realm : string
realm category (used for masking data) default : ‘atmos’
- scale : float
scales the data by this value default : 1
- shift : float
shifts the data by this valee default : 0
- remapf : string
name of the cdo remapping default : remapdis
- remapgrid : string
grid to remap the data to default : ‘r360x180
- seasons : list of strings
seasons to be selected out of [‘DJF’, ‘MAM’, ‘JJA’, ‘SON’] None will select all of the seasons default : None
- datatype : string
cdo operation to perform all the time axis options are ‘climatology’, ‘trends’, ‘detrend’ anything else not perform any cdo operation default ‘full’
- depthneeded : list of floats
list of the depths to interpolate the data to in z-axis default : None
- section : boolean
set to True to take a zonal mean of the data default : False
- fieldmean : boolean
set to True to take a fieldmean of the data default : False
- gridweights : boolean
set to True to calculate the area weights of each grid cell
- cdostring : string
custom to cdo string to be applied to the input file default : None
- yearmean : boolean
take an annual mean of the data before manipulating default : False
- external_function : string
name of external function to call default : None
- external_function_args : dictionary
keyword arguments to pass to the external function
Returns: - numpy array of final data
- numpy array of longitudinal cooridinates
- numpy array of latitudinal coordinates
- numpy array of depths
- string of the units
- numpy array of the time axis
- numpy area of the area weights of the grid cells
-
validate.data_loader.
get_external_function
(name)[source]¶ Returns a function from the external module based on the function name.
-
validate.data_loader.
get_remap_function
(remap)[source]¶ Returns a cdo function from string of the same name.
-
validate.data_loader.
silent_remove
(name)[source]¶ Removes a file if it exists and does nothing if it doesn’t exist
defaults¶
This module fills the plots with values specified in defaults and fills the remaining options with placeholders so that existence checks will not be needed later.
..moduleauthor:: David Fallis
-
validate.defaults.
fill
(plots, run, experiment, cmip6_verification=False, defaults={})[source]¶ Fills the blank spaces in plots with default values.
Parameters: - plots : list of dictionaries
- model_run : string
run ID
- experiment : string
experiment name
- defaults : dictionary
values to fill plots
Returns: - list of dictionaries
pdf_organizer¶
This module contains tools to produce a multipage pdf in an organized and labelled format specific to model plots.
-
validate.pdf_organizer.
arrange
(plotnames)[source]¶ - Outputs a pdf named plots/joined.pdf with all of the plots
- organized and bookmarked
Parameters: - plotnames : list of tuples
(name of plot, plot dictionary, plot type)
taylor¶
-
class
validate.taylor.
TaylorDiagram
(refstd, fig=None, rect=111, label='_', srange=(0, 1.5))[source]¶ Bases:
object
Taylor diagram.
Plot model standard deviation and correlation to reference (data) sample in a single-quadrant polar plot, with r=stddev and theta=arccos(correlation).
Methods
add_contours
(self[, levels])Add constant centered RMS difference contours, defined by levels. add_grid
(self, \*args, \*\*kwargs)Add a grid. add_sample
(self, stddev, corrcoef, \*args, …)Add sample (stddev,*corrcoeff*) to the Taylor diagram.