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

snapshot...

parent b1d1103a
No related branches found
No related tags found
No related merge requests found
...@@ -438,8 +438,11 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non ...@@ -438,8 +438,11 @@ def create_amv_to_aeolus_match_file(aeolus_files_dir, amv_files_dir, outfile=Non
create_file(outfile, m_d, a_d) create_file(outfile, m_d, a_d)
def get_subset(pathname, t_0, t_1): # match_file: pathname for the product file
rootgrp = Dataset(pathname, 'r', format='NETCDF4') # dt_str_0: start time (YYYY-MM-DD_HH:MM)
# dt_str_1: end time (YYYY-MM-DD_HH:MM)
def get_subset(match_file, dt_str_0, dt_str_1):
rootgrp = Dataset(match_file, 'r', format='NETCDF4')
all_dims = rootgrp.dimensions all_dims = rootgrp.dimensions
t_var = rootgrp['time'] t_var = rootgrp['time']
...@@ -457,6 +460,16 @@ def get_subset(pathname, t_0, t_1): ...@@ -457,6 +460,16 @@ def get_subset(pathname, t_0, t_1):
p_hhb_v = rootgrp['prof_hhb'] p_hhb_v = rootgrp['prof_hhb']
p_hht_v = rootgrp['prof_hht'] p_hht_v = rootgrp['prof_hht']
dto = datetime.datetime.strptime(dt_str_0, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
t_0 = dto.timestamp()
dto = datetime.datetime.strptime(dt_str_1, '%Y-%m-%d_%H:%M').replace(tzinfo=timezone.utc)
t_1 = dto.timestamp()
if t_1 < t_0:
t = t_0
t_1 = t_0
t_0 = t
times = t_var[:] times = t_var[:]
time_idxs = np.arange(n_profs) time_idxs = np.arange(n_profs)
valid = np.logical_and(times >= t_0, times < t_1) valid = np.logical_and(times >= t_0, times < t_1)
......
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