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(newdir, origdir)

Checks that the data in the new files match the data in the old files newdir: the directory containing the newly-written files

(new_all_varlist, new_some_varlist)

origdir: dir containing the old files to check against

(all_varlist, some_varlist)

Parameters for the 2 tests differ based off the variable list from test_split_file_run:

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

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

Checks that the metadata in the new files match the metadata in the old files newdir: the directory containing the newly-written files

(new_all_varlist, new_some_varlist)

origdir: dir containing the old files to check against

(all_varlist, some_varlist)

Parameters for the 2 tests differ based off the variable list from test_split_file_run:

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

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

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

infile: netcdf file to split into single-var files outfiledir: directory to which to write the split netcdf files

(new_all_varlist, new_some_varlist, new_none_varlist)

varlist: comma-separated string specifying which variables to write

(“all”, some_varlist, none_varlist)

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

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

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.