Skip to content
Snippets Groups Projects
Commit 67c1f170 authored by tomrink's avatar tomrink
Browse files

snapshot...

parent 3325c933
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, 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()
......
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