fre.pp.tests.test_split_netcdf module

Tests split-netcdf, parse_yaml from split_netcdf_script.py

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 :param workdir: dir that all operations are relative to :type workdir: string :param newdir: the directory containing the newly-written files (new_all_ts_varlist, new_some_ts_varlist) :type newdir: string :param origdir: dir containing the old files to check against (all_ts_varlist, some_ts_varlist) :type origdir: string

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 :param workdir: dir that all operations are relative to :type workdir: string :param newdir: the directory containing the newly-written files (new_all_ts_varlist, new_some_ts_varlist) :type newdir: string :param origdir: dir containing the old files to check against (all_ts_varlist, some_ts_varlist) :type origdir: string

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

Parameters:
  • workdir (string) – subdir all operations are relative to

  • infile (string) – netcdf file to split into single-var files

  • outfiledir (string) – directory to which to write the split netcdf files (new_all_ts_varlist, new_some_ts_varlist, new_none_ts_varlist)

  • varlist (string) – comma-separated string specifying which variables to write (“all”, some_ts_varlist, none_ts_varlist)

Parameters for the 5 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.

fre.pp.tests.test_split_netcdf.test_variable_filtering_bug_fix()

Test that variables with names containing short metadata var names are not excluded.

This test verifies the fix for a bug where the matching logic was incorrectly applied to both known patterns and the list of short variable names (e.g., “a”, “b”), causing variables like “drybc” to be excluded because they contain “b”.

The bug was that short vars were treated as patterns instead of exact matches.