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

snapshot...

parent e6b3c8c2
No related branches found
No related tags found
No related merge requests found
import numpy as np
import h5py
from util.util import get_grid_values_all
def acspo_validate(oper_file, cspp_file):
h5f_oper = h5py.File(oper_file, 'r')
h5f_cspp = h5py.File(cspp_file, 'r')
lon_cspp = get_grid_values_all(h5f_cspp, 'lon')
lat_cspp = get_grid_values_all(h5f_cspp, 'lat')
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]
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')
cntr_lon_oper = lon_oper[:, c_idx]
cntr_lat_oper = lat_oper[:, 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, ]
# generate a ndarray of boolean
cspp_clear = (l2p_flags_cspp & (1 << 15)) != 0
oper_clear = (l2p_flags_oper & (1 << 15)) != 0
idxs_lat = np.isin(cntr_lat_oper, cntr_lat_cspp, assume_unique=True)
idxs_lon = np.isin(cntr_lon_oper, cntr_lon_cspp, assume_unique=True)
print(np.sum(idxs_lon), np.sum(idxs_lat))
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