improve io checks
This commit is contained in:
@@ -416,6 +416,9 @@ class RunSelector:
|
|||||||
|
|
||||||
nums.sort()
|
nums.sort()
|
||||||
|
|
||||||
|
if len(nums) == 0:
|
||||||
|
return []
|
||||||
|
|
||||||
# -- Select either the first or last output from the list, or all the valid ones --
|
# -- Select either the first or last output from the list, or all the valid ones --
|
||||||
if in_nums == "first":
|
if in_nums == "first":
|
||||||
i = 0
|
i = 0
|
||||||
@@ -424,7 +427,7 @@ class RunSelector:
|
|||||||
if i < len(nums):
|
if i < len(nums):
|
||||||
nums = [nums[i]]
|
nums = [nums[i]]
|
||||||
else:
|
else:
|
||||||
nums = []
|
return []
|
||||||
elif in_nums == "last":
|
elif in_nums == "last":
|
||||||
i = len(nums) - 1
|
i = len(nums) - 1
|
||||||
while i >= 0 and not try_load_info(nums[i]):
|
while i >= 0 and not try_load_info(nums[i]):
|
||||||
@@ -432,7 +435,7 @@ class RunSelector:
|
|||||||
if i >= 0:
|
if i >= 0:
|
||||||
nums = [nums[i]]
|
nums = [nums[i]]
|
||||||
else:
|
else:
|
||||||
nums = []
|
return []
|
||||||
|
|
||||||
# Be sure we have a namelist
|
# Be sure we have a namelist
|
||||||
if self.fallback_nml and run not in self.namelist:
|
if self.fallback_nml and run not in self.namelist:
|
||||||
@@ -466,13 +469,13 @@ class RunSelector:
|
|||||||
if imin is not None:
|
if imin is not None:
|
||||||
nums = nums[imin:]
|
nums = nums[imin:]
|
||||||
else:
|
else:
|
||||||
nums = []
|
return []
|
||||||
if time_max is not None and len(nums) > 0:
|
if time_max is not None and len(nums) > 0:
|
||||||
imax = search(nums, time_max, "left")
|
imax = search(nums, time_max, "left")
|
||||||
if imax is not None:
|
if imax is not None:
|
||||||
nums = nums[: imax + 1]
|
nums = nums[: imax + 1]
|
||||||
else:
|
else:
|
||||||
nums = []
|
return []
|
||||||
|
|
||||||
if time is not None and len(nums) > 0:
|
if time is not None and len(nums) > 0:
|
||||||
filtered_nums = []
|
filtered_nums = []
|
||||||
|
|||||||
Reference in New Issue
Block a user