diff --git a/modules/util/acspo_validate.py b/modules/util/acspo_validate.py index fba92dc0c68bdbaa1fe1f101ddf0497595a07ab0..2dd946ab123a0ffdf48f0f68b14d81aa70b4f3ce 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, outfile_nc=None): +def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None): h5f_oper = h5py.File(oper_file, 'r') h5f_cspp = h5py.File(cspp_file, 'r') @@ -60,8 +60,8 @@ def acspo_validate(oper_file, cspp_file, outfile_nc=None): print('overlap shape, size: ', overlap_shape, np.size(lon_cspp)) # check lon/lat arrays - print(np.sum(np.isclose(lon_cspp, lon_oper, rtol=0.001))) - print(np.sum(np.isclose(lat_cspp, lat_oper, rtol=0.001))) + print(np.sum(np.isclose(lon_cspp, lon_oper, rtol=rel_tol))) + print(np.sum(np.isclose(lat_cspp, lat_oper, rtol=rel_tol))) sst_cspp_2d = sst_cspp[start_idx_cspp:stop_idx_cspp, :] sst_oper_2d = sst_oper[start_idx_oper:stop_idx_oper, :] @@ -106,7 +106,7 @@ def acspo_validate(oper_file, cspp_file, outfile_nc=None): xarray_data.to_netcdf('/Users/tomrink/outfile_nc') print('fraction approx equal: ', - np.sum(np.isclose(valid_sst_cspp, valid_sst_oper, rtol=0.001))/np.sum(both_valid)) + np.sum(np.isclose(valid_sst_cspp, valid_sst_oper, rtol=rel_tol))/np.sum(both_valid)) # print(np.histogram((sst_cspp[both_valid] - sst_oper[both_valid]), bins=10)) h5f_oper.close()