diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py index 832b270b7641ee87d18550ec7ca1d79ff1714657..ca31851f1b00b16fa0bff3e0f2249a0c76084435 100644 --- a/modules/aeolus/aeolus_amv.py +++ b/modules/aeolus/aeolus_amv.py @@ -133,11 +133,12 @@ def match_amvs_to_raobs(raob_dict, raob_time, amv_ds, time_window=10, filepath=N lat = key.lat lon = key.lon - - c_rng, l_rng = get_search_box(nav, lon, lat) - if c_rng is None: + cc_raob, ll_raob = nav.earth_to_lc(lon, lat) + if cc_raob is None or ll_raob is None: continue + c_rng, l_rng = get_search_box(cc_raob, ll_raob) + in_cc = np.logical_and(cc > c_rng[0], cc < c_rng[1]) in_ll = np.logical_and(ll > l_rng[0], ll < l_rng[1]) in_box = np.logical_and(in_cc, in_ll) @@ -1528,9 +1529,6 @@ def match_aeolus_to_clavrx(aeolus_dict, clvrx_files): continue if cc - 4 < 0 or ll - 4 < 0 or cc + 5 >= num_elems or ll + 5 >= num_lines: continue - # c_rng, l_rng = get_search_box(nav, lon, lat) - # if c_rng is None: - # continue data = [] for param in clvrx_params: @@ -1662,10 +1660,7 @@ def create_aeolus_clavrx_match_file(match_dct, filename, clvrx_params): rootgrp.close() -def get_search_box(nav, lon, lat): - cc, ll = nav.earth_to_lc(lon, lat) - if cc is None: - return None, None +def get_search_box(cc, ll): c_rng = [cc - half_width, cc + half_width] l_rng = [ll - half_width, ll + half_width] @@ -1744,9 +1739,7 @@ def match_amvs_to_aeolus_fast(aeolus_dict, amv_files_path, amv_source='OPS', ban if cc_prf is None or ll_prf is None: continue - c_rng, l_rng = get_search_box(nav, lon, lat) - if c_rng is None: - continue + c_rng, l_rng = get_search_box(cc_prf, ll_prf) in_cc = np.logical_and(cc > c_rng[0], cc < c_rng[1]) in_ll = np.logical_and(ll > l_rng[0], ll < l_rng[1]) @@ -1812,9 +1805,10 @@ def match_amvs_to_aeolus(aeolus_dict, amv_files_path, amv_source='OPS', band='14 for prof in profs: lat = prof[0, 0] lon = prof[0, 1] - c_rng, l_rng = get_search_box(nav, lon, lat) - if c_rng is None: + cc_prf, ll_prf = nav.earth_to_lc(lon, lat) + if cc_prf is None or ll_prf is None: continue + c_rng, l_rng = get_search_box(cc_prf, ll_prf) in_cc = np.logical_and(cc > c_rng[0], cc < c_rng[1]) in_ll = np.logical_and(ll > l_rng[0], ll < l_rng[1])