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

snapshot...

parent 48ce2248
No related branches found
No related tags found
No related merge requests found
......@@ -80,8 +80,10 @@ def get_parameters_fmwk_amvs(filename='/ships19/cloud/scratch/4TH_AMV_INTERCOMPA
class Files:
def __init__(self, files_path, file_time_span, pattern):
self.flist = []
self.ftimes = []
self.dto_s = []
if os.path.isdir(files_path):
# for path in Path(files_path).rglob(pattern):
for path in glob.glob(files_path + pattern, recursive=True):
self.flist.append(path)
elif fnmatch.fnmatch(os.path.basename(files_path), pattern): # check if this single file matches pattern
......@@ -89,7 +91,6 @@ class Files:
if len(self.flist) == 0:
raise GenericException('no matching files found in: ' + files_path + ' matching: ' + pattern)
self.ftimes = []
self.span_seconds = datetime.timedelta(minutes=file_time_span).seconds
for pname in self.flist:
......@@ -97,12 +98,17 @@ class Files:
dto_start = dto
dto_end = dto + datetime.timedelta(minutes=file_time_span)
self.ftimes.append((dto_start.timestamp(), dto_end.timestamp()))
self.dto_s.append(dto)
self.ftimes = np.array(self.ftimes)
self.flist = np.array(self.flist)
sidxs = np.argsort(self.ftimes[:, 0])
self.dto_s = np.array(self.dto_s)
sidxs = np.argsort(self.ftimes[:, 0]) # sort on start time
self.ftimes = self.ftimes[sidxs, :]
self.flist = self.flist[sidxs]
self.dto_s = self.dto_s[sidxs]
self._current_index = 0
......
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