From 2f563f1e866d1954acb1967d79010af47c72b451 Mon Sep 17 00:00:00 2001 From: rink <rink@ssec.wisc.edu> Date: Thu, 6 Mar 2025 16:09:25 -0600 Subject: [PATCH] add option to pass in absolute tolerance --- modules/util/acspo_validate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/util/acspo_validate.py b/modules/util/acspo_validate.py index e61cb5c6..cef0ac0c 100644 --- a/modules/util/acspo_validate.py +++ b/modules/util/acspo_validate.py @@ -5,7 +5,7 @@ import xarray as xr from util.util import get_grid_values_all -def acspo_validate(oper_file, cspp_file, rel_tol=0.005, deg_tol=0.0002, outfile_nc=None): +def acspo_validate(oper_file, cspp_file, rel_tol=0.0, abs_tol=0.01, deg_tol=0.0002, outfile_nc=None): h5f_oper = h5py.File(oper_file, 'r') h5f_cspp = h5py.File(cspp_file, 'r') @@ -123,7 +123,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.005, deg_tol=0.0002, outfile_ valid_lat_oper = lat_oper[both_clear] print('fraction SSTs approx equal: ', - np.sum(np.isclose(valid_sst_cspp, valid_sst_oper, rtol=rel_tol))/np.sum(both_clear)) + np.sum(np.isclose(valid_sst_cspp, valid_sst_oper, rtol=rel_tol, atol=abs_tol))/np.sum(both_clear)) xarray_data = xr.Dataset({ 'sst_cspp': xr.DataArray(valid_sst_cspp, coords=None, dims=None, name='sst_cspp'), -- GitLab