From 6ac8096dcb520a46b68660c1c3fa1333dbf680cf Mon Sep 17 00:00:00 2001
From: rink <rink@ssec.wisc.edu>
Date: Mon, 5 Oct 2020 16:40:28 -0500
Subject: [PATCH] fix bug

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

diff --git a/modules/aeolus/aeolus_amv.py b/modules/aeolus/aeolus_amv.py
index e2a4db41..b7d34707 100644
--- a/modules/aeolus/aeolus_amv.py
+++ b/modules/aeolus/aeolus_amv.py
@@ -461,10 +461,14 @@ def get_subset(match_file, dt_str_0, dt_str_1):
     p_hht_v = rootgrp['prof_hht']
 
     dto = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
+    dto.replace(tzinfo=timezone.utc)
     t_0 = dto.timestamp()
     dto = datetime.datetime.strptime(dt_str_1, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
+    dto.replace(tzinfo=timezone.utc)
     t_1 = dto.timestamp()
 
+    print(t_0, t_1)
+
     if t_1 < t_0:
         t = t_0
         t_1 = t_0
@@ -479,16 +483,16 @@ def get_subset(match_file, dt_str_0, dt_str_1):
     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]])
 
-    mx_namvs = np.max(n_amvs_per_prof[amv_idx_start:amv_idx_start+n_times])
-    mx_nlevs = np.max(n_levs_per_prof[prf_idx_start:prf_idx_start+n_times])
+    mx_namvs = np.max(n_amvs_per_prof[time_idxs[0]:time_idxs[0]+n_times])
+    mx_nlevs = np.max(n_levs_per_prof[time_idxs[0]:time_idxs[0]+n_times])
 
     amvs = np.zeros((n_times, mx_namvs, 4))
     profs = np.zeros((n_times, mx_nlevs, 4))
     amvs.fill(np.nan)
     profs.fill(np.nan)
 
-    accum_prf = 0
-    accum_amv = 0
+    accum_prf = prf_idx_start
+    accum_amv = amv_idx_start
     for idx, t_i in enumerate(time_idxs):
         n_amvs = n_amvs_per_prof[t_i]
         n_levs = n_levs_per_prof[t_i]
-- 
GitLab