Skip to content
Snippets Groups Projects
Commit 2f563f1e authored by rink's avatar rink
Browse files

add option to pass in absolute tolerance

parent 35458ced
No related branches found
No related tags found
No related merge requests found
......@@ -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'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment