fre.cmor.cmor_helpers module

fre.cmor.cmor_helpers.check_dataset_for_ocean_grid(ds)

checks netCDF4.Dataset ds for ocean grid origin, and throws an error if it finds one. accepts one argument. this function has no return.

ds: netCDF4.Dataset object containing variables with associated dimensional information.

fre.cmor.cmor_helpers.create_lev_bnds(bound_these=None, with_these=None)
fre.cmor.cmor_helpers.create_tmp_dir(outdir, json_exp_config=None)

creates a tmp_dir based on targeted output directory root. returns the name of the tmp dir. accepts one argument:

outdir: string, representing the final output directory root for the cmor modules netcdf

file output. tmp_dir will be slightly different depending on the output directory targeted

fre.cmor.cmor_helpers.find_statics_file(bronx_file_path)
fre.cmor.cmor_helpers.from_dis_gimme_dis(from_dis, gimme_dis)
gives you gimme_dis from from_dis. accepts two arguments, both mandatory.

from_dis: the target netCDF4.Dataset object to try reading from gimme_dis: what from_dis is hopefully gonna have and you’re gonna get

fre.cmor.cmor_helpers.get_iso_datetimes(var_filenames, iso_datetime_arr=None)
appends iso datetime strings found amongst filenames to iso_datetime_arr.
var_filenames: non-empty list of strings representing filenames. some of which presumably

contain datetime strings

iso_datetime_arr: list of strings, empty or non-empty, representing datetimes found in

var_filenames entries. the objet pointed to by the reference iso_datetime_arr is manipulated, and so need-not be returned

fre.cmor.cmor_helpers.get_var_filenames(indir, var_filenames=None, local_var=None)
appends files ending in .nc located within indir to list var_filenames accepts three arguments

indir: string, representing a path to a directory containing files ending in .nc extension var_filenames: list of strings, empty or non-empty, to append discovered filenames to. the

object pointed to by the reference var_filenames is manipulated, and so need not be returned.

local_var: string, optional, if not None, will be used for ruling out filename targets

fre.cmor.cmor_helpers.get_vertical_dimension(ds, target_var)

determines the vertical dimensionality of target_var within netCDF4 Dataset ds. accepts two arguments and returns an object represnting the vertical dimensions assoc with the target_var.

ds: netCDF4.Dataset object containing variables with associated dimensional information. target_var: string, representating a variable contained within the netCDF4.Dataset ds

fre.cmor.cmor_helpers.print_data_minmax(ds_variable=None, desc=None)

prints the min/max of numpy.ma.core.MaskedArray (ds_variable) and the name/description (desc) of the data