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

snapshot...

parent 339b54e3
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
cspp_clear = (l2p_flags_cspp & (1 << 15)) == 0
oper_clear = (l2p_flags_oper & (1 << 15)) == 0
# Find the overlap Track indexes relative to each ------------------------
start_idx_oper, stop_idx_oper = -1, -1
start_idx_cspp, stop_idx_cspp = -1, -1
......@@ -47,6 +48,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
print('oper start, stop ', start_idx_oper, stop_idx_oper)
print('cspp start, stop ', start_idx_cspp, stop_idx_cspp)
# --------------------------------------------------------------------------
lon_cspp = lon_cspp[start_idx_cspp:stop_idx_cspp, :]
lat_cspp = lat_cspp[start_idx_cspp:stop_idx_cspp, :]
......@@ -58,8 +60,8 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, 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=rel_tol)))
print(np.sum(np.isclose(lat_cspp, lat_oper, rtol=rel_tol)))
print('num of close overlap lons: ', np.sum(np.isclose(lon_cspp, lon_oper, rtol=rel_tol)))
print('num of close overlap lats: ', 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, :]
......@@ -75,6 +77,7 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
lat_cspp = lat_cspp.flatten()
lon_oper = lon_oper.flatten()
lat_oper = lat_oper.flatten()
both_clear = oper_clear & cspp_clear
sst_cspp = sst_cspp[both_clear]
sst_oper = sst_oper[both_clear]
......@@ -82,9 +85,10 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
lat_cspp = lat_cspp[both_clear]
lon_oper = lon_oper[both_clear]
lat_oper = lat_oper[both_clear]
print('number of clear pixels in both: ', np.sum(both_clear))
both_valid = np.invert(np.isnan(sst_cspp)) & np.invert(np.isnan(sst_oper))
print('number of clear and valid SSTs in both: ', np.sum(both_valid))
print('number of clear pixels with valid SSTs in both: ', np.sum(both_valid))
valid_sst_cspp = sst_cspp[both_valid]
valid_sst_oper = sst_oper[both_valid]
valid_lon_cspp = lon_cspp[both_valid]
......@@ -105,7 +109,6 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None):
print('fraction approx equal: ',
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()
h5f_cspp.close()
......@@ -122,11 +125,13 @@ def analyze_plot():
h5f_e = h5py.File('/Users/tomrink/20241107171000.nc', 'r')
h5f_f = h5py.File('/Users/tomrink/20241107202000.nc', 'r')
h5f_g = h5py.File('/Users/tomrink/20241107203000.nc', 'r')
import numpy as np
sst_cspp_all = np.concatenate([h5f_a['sst_cspp'][0, :], h5f_b['sst_cspp'][0, :], h5f_c['sst_cspp'][0, :], h5f_d['sst_cspp'][0, :], h5f_e['sst_cspp'][0, :], h5f_f['sst_cspp'][0, :], h5f_g['sst_cspp'][0, :]])
sst_cspp_all.shape
print(sst_cspp_all.shape)
sst_oper_all = np.concatenate([h5f_a['sst_oper'][0, :], h5f_b['sst_oper'][0, :], h5f_c['sst_oper'][0, :], h5f_d['sst_oper'][0, :], h5f_e['sst_oper'][0, :], h5f_f['sst_oper'][0, :], h5f_g['sst_oper'][0, :]])
sst_oper_all.shape
print(sst_oper_all.shape)
diff = sst_cspp_all - sst_oper_all
import matplotlib.pyplot as plt
plt.hist(diff, bins=40)
......
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