From c0931f9b0673fa4e16efaebce2aa8dc664db1ae2 Mon Sep 17 00:00:00 2001
From: rink <rink@ssec.wisc.edu>
Date: Tue, 6 Oct 2020 11:04:53 -0500
Subject: [PATCH] snapshot..

---
 modules/aeolus/aeolus_amv.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index abd8f2ec..19eabafa 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -445,6 +445,7 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
 # dt_str_1: end time (YYYY-MM-DD_HH:MM)
 # returns:
 # amvs[ntimes, max_num_amvs_per_prof, num_of_params], profs[ntimes, max_num_levs_per_prof, num_of_params], times[ntimes]
+# longitude, latitude
 def subset_by_time(match_file, dt_str_0, dt_str_1):
     rootgrp = Dataset(match_file, 'r', format='NETCDF4')
     all_dims = rootgrp.dimensions
@@ -459,6 +460,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
     a_dst_v = rootgrp['amv_dist']
     a_prs_v = rootgrp['amv_pres']
 
+    p_lon_v = rootgrp['prof_longitude']
+    p_lat_v = rootgrp['prof_latitude']
     p_azm_v = rootgrp['prof_azm']
     p_spd_v = rootgrp['prof_spd']
     p_hhb_v = rootgrp['prof_hhb']
@@ -482,6 +485,9 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
     time_idxs = time_idxs[valid]
     n_times = time_idxs.shape[0]
 
+    lons = p_lon_v[:]
+    lats = p_lat_v[:]
+
     prf_idx_start = np.sum(n_levs_per_prof[0:time_idxs[0]])
     amv_idx_start = np.sum(n_amvs_per_prof[0:time_idxs[0]])
 
@@ -505,7 +511,7 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
         c = accum_prf
         d = accum_prf + n_levs
 
-        amvs[idx:, 0:n_amvs, 0] = a_spd_v[a:b]
+        amvs[idx, 0:n_amvs, 0] = a_spd_v[a:b]
         amvs[idx, 0:n_amvs, 1] = a_dir_v[a:b]
         amvs[idx, 0:n_amvs, 2] = a_prs_v[a:b]
         amvs[idx, 0:n_amvs, 3] = a_dst_v[a:b]
@@ -518,6 +524,8 @@ def subset_by_time(match_file, dt_str_0, dt_str_1):
         accum_amv += n_amvs
         accum_prf += n_levs
 
-    return amvs, profs, times[time_idxs]
+    prof_times_locs = np.hstack((times[time_idxs], lons[time_idxs], lats[time_idxs]))
+
+    return profs, amvs, prof_times_locs
 
 
-- 
GitLab