[run_selector] better handling of no snapshot
This commit is contained in:
+8
-5
@@ -96,9 +96,6 @@ class RunSelector:
|
||||
self.namelist = {}
|
||||
self.runs = self.get_runs(in_runs, filter_name, filter_nml, sort_run_by)
|
||||
|
||||
if len(self.runs) == 0:
|
||||
raise ValueError("No runs found")
|
||||
|
||||
self.info = {}
|
||||
for run in self.runs:
|
||||
self.info[run] = {}
|
||||
@@ -119,11 +116,17 @@ class RunSelector:
|
||||
time,
|
||||
)
|
||||
|
||||
for i, run in enumerate(self.runs):
|
||||
i = 0
|
||||
for run in self.runs.copy():
|
||||
if len(self.nums[run]) == 0:
|
||||
print(f"[WARNING] No snapshot found for run {run}")
|
||||
del self.runs[i]
|
||||
del self.nums[run]
|
||||
else:
|
||||
i += 1
|
||||
|
||||
if len(self.runs) == 0:
|
||||
raise ValueError("No runs found")
|
||||
|
||||
def select(
|
||||
self,
|
||||
@@ -328,7 +331,7 @@ class RunSelector:
|
||||
if time_max is not None:
|
||||
nums = list(filter(lambda n: self.info[run][n]["time"] <= time_max, nums))
|
||||
|
||||
if time is not None:
|
||||
if time is not None and len(nums) > 0:
|
||||
filtered_nums = []
|
||||
if not isinstance(time, list):
|
||||
time = [time]
|
||||
|
||||
Reference in New Issue
Block a user