polaris.validate.compare_variables

polaris.validate.compare_variables(variables, filename1, filename2, logger, l1_norm=0.0, l2_norm=0.0, linf_norm=0.0, quiet=True)[source]

compare variables in the two files

Parameters:
  • variables (list) – A list of variable names to compare

  • filename1 (str) – The relative path to a file within the work_dir. If filename2 is also given, comparison will be performed with variables in that file. If a baseline directory was provided when setting up the test case, the variables will be compared between this test case and the same relative filename in the baseline version of the test case.

  • filename2 (str) – The relative path to another file within the work_dir if comparing between files within the current test case. If a baseline directory was provided, the variables from this file will also be compared with those in the corresponding baseline file.

  • logger (logging.Logger) – The logger to log validation output to

  • l1_norm (float, optional) – The maximum allowed L1 norm difference between the variables in filename1 and filename2. To skip L1 norm check, pass None.

  • l2_norm (float, optional) – The maximum allowed L2 norm difference between the variables in filename1 and filename2. To skip L2 norm check, pass None.

  • linf_norm (float, optional) – The maximum allowed L-Infinity norm difference between the variables in filename1 and filename2. To skip Linf norm check, pass None.

  • quiet (bool, optional) – Whether to print detailed information. If quiet is False, the norm tolerance values being compared against will be printed when the comparison is made. This is generally desirable when using nonzero norm tolerance values.

Returns:

all_pass (bool) – Whether all variables passed the validation checks