fre.pp.tests.test_split_netcdf module

Tests split-netcdf, parse_yaml from split_netcdf_script.py

fre.pp.tests.test_split_netcdf.test_parse_yaml(component, compdir, varlist, hist_source)

Tests parsing yaml for the variable_list we need for splitting component: string corresponding to a component in the yaml compdir: directory in which to look for the yaml (all use same filename) varlist: list of variables expected to match what we get from the yaml hist_source: optional, string corresponding to a hist_source that should be under the component in the yaml

Parameters for the tests are based off of the following:

parses the yaml, does not find a varlist, gets the right default parses the yaml, finds a varlist and it matches the orig results parses the yaml, does not find the component and throws an error parses the yaml, finds the varlist, but does not find a history_file

under sources that matches the hist_source

fre.pp.tests.test_split_netcdf.test_split_file_cleanup()

Cleaning up files and dirs created for this set of tests. Deletes all netcdf files (.nc) and all dirs created for this test (new_)

fre.pp.tests.test_split_netcdf.test_split_file_data(workdir, newdir, origdir)

Checks that the data in the new files match the data in the old files workdir: dir that all operations are relative to newdir: the directory containing the newly-written files

(new_all_ts_varlist, new_some_ts_varlist)

origdir: dir containing the old files to check against

(all_ts_varlist, some_ts_varlist)

Parameters for the tests differ based off the variable list from test_split_file_run
and the type of file being split:

all: “all”, the default, processes all variables in the input some: processes a list of variables, some of which are and some of

which are not in the input; includes one duplicate var

ts: timeseries files static: static files

fre.pp.tests.test_split_netcdf.test_split_file_metadata(workdir, newdir, origdir)

Checks that the metadata in the new files match the metadata in the old files workdir: dir that all operations are relative to newdir: the directory containing the newly-written files

(new_all_ts_varlist, new_some_ts_varlist)

origdir: dir containing the old files to check against

(all_ts_varlist, some_ts_varlist)

Parameters for the tests differ based off the variable list from test_split_file_run
and the type of file being split:

all: “all”, the default, processes all variables in the input some: processes a list of variables, some of which are and some of

which are not in the input; includes one duplicate var

ts: timeseries files static: static files

fre.pp.tests.test_split_netcdf.test_split_file_run(workdir, infile, outfiledir, varlist)

Checks that split-netcdf will run when called from the command line

workdir: subdir all operations are relative to infile: netcdf file to split into single-var files outfiledir: directory to which to write the split netcdf files

(new_all_ts_varlist, new_some_ts_varlist, new_none_ts_varlist)

varlist: comma-separated string specifying which variables to write

(“all”, some_ts_varlist, none_ts_varlist)

Parameters for the 3 tests are based off of the list of variables to filter

on plus the type of file: all: “all”, the default, processes all variables in the input some: processes a list of variables, some of which are and some of

which are not in the input; includes one duplicate var

none: processes a list of variables, none of which are in the input;

should produce no files

ts: timeseries files static: static files

fre.pp.tests.test_split_netcdf.test_split_file_setup()

Sets up the files we need in order to test variable splitting. Mostly ncgen3 commands.