From d26813810ad17728617f8b90489b5deb13fabcee Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Sun, 22 Dec 2024 10:40:33 -0600 Subject: [PATCH] snapshot... --- modules/util/acspo_validate.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/util/acspo_validate.py b/modules/util/acspo_validate.py index 48bb24c5..3b0a3ae8 100644 --- a/modules/util/acspo_validate.py +++ b/modules/util/acspo_validate.py @@ -12,22 +12,48 @@ def acspo_validate(oper_file, cspp_file, rel_tol=0.001, outfile_nc=None): lon_cspp = get_grid_values_all(h5f_cspp, 'lon') lat_cspp = get_grid_values_all(h5f_cspp, 'lat') + if np.any(np.isnan(lat_cspp)) or np.any(np.isnan(lon_cspp)): + print('Invalid lat') + if np.min(lat_cspp) < -90 or np.max(lat_cspp) > 90: + print('Invalid lat') + if np.min(lon_cspp) < -180 or np.max(lon_cspp) > 180: + print('Invalid lon') + + # ----* Investigate: CSPP and OPER time values don't seem to ever match *------------------- + # dtime_cspp = get_grid_values_all(h5f_cspp, 'sst_dtime')[0, ] + # ref_time_cspp = get_grid_values_all(h5f_cspp, 'time')[0] print('cspp shape: ', lat_cspp.shape) c_idx = lat_cspp.shape[1] // 2 + cntr_lon_cspp = lon_cspp[:, c_idx] cntr_lat_cspp = lat_cspp[:, c_idx] - + # cntr_dtime_cspp = dtime_cspp[::16, c_idx] sst_cspp = get_grid_values_all(h5f_cspp, 'sea_surface_temperature')[0, ] l2p_flags_cspp = get_grid_values_all(h5f_cspp, 'l2p_flags')[0, ] lon_oper = get_grid_values_all(h5f_oper, 'lon') lat_oper = get_grid_values_all(h5f_oper, 'lat') + if np.any(np.isnan(lat_cspp)) or np.any(np.isnan(lon_cspp)): + print('Invalid lat') + if np.min(lat_cspp) < -90 or np.max(lat_cspp) > 90: + print('Invalid lat') + if np.min(lon_cspp) < -180 or np.max(lon_cspp) > 180: + print('Invalid lon') + + # --* See note above on issue with time *------------------------------------- + # dtime_oper = get_grid_values_all(h5f_oper, 'sst_dtime')[0, ] + # ref_time_oper = get_grid_values_all(h5f_oper, 'time')[0] + cntr_lon_oper = lon_oper[:, c_idx] cntr_lat_oper = lat_oper[:, c_idx] + # cntr_dtime_oper = dtime_oper[::16, c_idx] print('oper shape: ', lat_oper.shape) sst_oper = get_grid_values_all(h5f_oper, 'sea_surface_temperature')[0, ] l2p_flags_oper = get_grid_values_all(h5f_oper, 'l2p_flags')[0, ] + # cntr_time_cspp = cntr_dtime_cspp + ref_time_cspp + # cntr_time_oper = cntr_dtime_oper + ref_time_oper + # generate a ndarray of boolean, True: clear or probably clear cspp_clear = (l2p_flags_cspp & (1 << 15)) == 0 oper_clear = (l2p_flags_oper & (1 << 15)) == 0 -- GitLab