Skip to content
Snippets Groups Projects
Commit 42487408 authored by rink's avatar rink
Browse files

add distance from aeolus prof loc to each amv loc

parent b5d5dc0a
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ import glob
import numpy as np
from netCDF4 import Dataset, Dimension, Variable
from aeolus.geos_nav import GEOSNavigation
from util.util import haversine_np
amv_file_duration = 60 # minutes
......@@ -210,6 +211,10 @@ def get_aeolus_time_dict_s(filenames, lon360=False, do_sort=True):
return t_dct
def run_amv_aeolus_best_fit(match_dict):
return None
def get_search_box(nav, lon, lat):
cc, ll = nav.earth_to_lc(lon, lat)
if cc is None:
......@@ -301,7 +306,8 @@ def match_amvs_to_aelous(aeolus_dict, amv_files_path, amv_source='OPS', band='14
num_amvs = np.sum(in_box)
if num_amvs == 0:
continue
match_dict[key] = (amv_lons[in_box], amv_lats[in_box], amv_pres[in_box], amv_spd[in_box], amv_dir[in_box])
dist = haversine_np(lon, lat, amv_lons[in_box], amv_lats[in_box])
match_dict[key] = (amv_lons[in_box], amv_lats[in_box], amv_pres[in_box], amv_spd[in_box], amv_dir[in_box], dist)
return match_dict
......@@ -319,7 +325,7 @@ def create_file(filename, aeolus_to_amv_dct, aeolus_dct):
namvs = 0
nlevs = 0
for key in keys:
lons, lats, pres, spd, dir = aeolus_to_amv_dct.get(key)
lons, lats, pres, spd, dir, _ = aeolus_to_amv_dct.get(key)
num_amvs.append(len(lons))
namvs += len(lons)
......@@ -369,7 +375,7 @@ def create_file(filename, aeolus_to_amv_dct, aeolus_dct):
i_b = i_a + namvs
i_d = i_c + nlevs
lons, lats, pres, spd, dir = aeolus_to_amv_dct.get(key)
lons, lats, pres, spd, dir, _ = aeolus_to_amv_dct.get(key)
amv_lon[i_a:i_b] = lons[:]
amv_lat[i_a:i_b] = lats[:]
amv_spd[i_a:i_b] = spd[:]
......
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