fre.cmor.cmor_helpers module
file holding helper functions for the cmor_mixer in this submodule
- 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)
creates a (2, len(bound_these)) shaped array with values assigned from with_these and returns that array
- 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)
given a FRE-bronx-style file path, attempt to find the corresponding statics file based on the dir structure
- 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 object pointed to by the reference iso_datetime_arr is manipulated, and so need-not be returned
- fre.cmor.cmor_helpers.get_json_file_data(json_file_path=None)
returns loaded data from a json file pointed to by arg json_file_path (string, required)
- 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 representing the vertical dimensions assoc with the target_var.
ds: netCDF4.Dataset object containing variables with associated dimensional information. target_var: string, representing a variable contained within the netCDF4.Dataset ds
- fre.cmor.cmor_helpers.print_data_minmax(ds_variable=None, desc=None)
outputs the the min/max of numpy.ma.core.MaskedArray (ds_variable) and the name/description (desc) of the data to the screen if there’s a verbose flag, and just to logger otherwise