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

new methods

parent e9aa3b90
No related branches found
No related tags found
No related merge requests found
......@@ -4,7 +4,7 @@ import glob
import numpy as np
import xarray as xr
from netCDF4 import Dataset
from aeolus.geos_nav import GEOSNavigation
from aeolus.geos_nav import GEOSNavigation, get_navigation
from aeolus.datasource import get_datasource
from util.util import haversine_np, LatLonTuple, GenericException
from amv.intercompare import best_fit, bin_data_by, get_press_bin_ranges, spd_dir_from_uv, uv_from_spd_dir, \
......@@ -1416,6 +1416,58 @@ def get_cloud_layers_dict_s(aeolus_files_dir, lon360=False):
return cld_lyr_dct
def match_aeolus_to_clavrx(aeolus_dict, clvrx_files):
nav = get_navigation()
#clvrx_params = clvrx_files.get_parameters()
clrvx_params = ['cld_height_acha', 'cld_press_acha', 'cld_temp_acha']
match_dict = {}
keys = list(aeolus_dict.keys())
last_f_idx = -1
cnt = 0
param_nd = None
for key in keys:
fname, ftime, f_idx = clvrx_files.get_file_containing_time(key)
if f_idx is None:
continue
prof_s = aeolus_dict.get(key)
if prof_s is None:
continue
if f_idx != last_f_idx:
last_f_idx = f_idx
ds = Dataset(fname)
param_s = []
for param in amv_params:
param_s.append(ds[param][:,:])
param_nd = np.vstack(param_s)
ds.close()
for prof in prof_s:
lat = prof[0, 0]
lon = prof[0, 1]
cc, ll = nav.earth_to_lc(lon, lat)
if cc < 0:
continue
# c_rng, l_rng = get_search_box(nav, lon, lat)
# if c_rng is None:
# continue
param_nd = param_nd[:, cc-6:cc+7, ll-6:ll+7]
match_dict[cnt] = (key, cc, ll, f_idx, prof, param_nd)
cnt += 1
return match_dict
def get_search_box(nav, lon, lat):
cc, ll = nav.earth_to_lc(lon, lat)
if cc is None:
......
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