Skip to content

Commit cc67d06

Browse files
Implementing reviewer suggestion
1 parent 5d5e4d5 commit cc67d06

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

parcels/particleset.py

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -845,18 +845,20 @@ def _warn_outputdt_release_desync(outputdt: float, starttime: float, release_tim
845845

846846

847847
def _warn_particle_times_outside_fieldset_time_bounds(release_times: np.ndarray, time: TimeInterval):
848-
if any(not np.isnat(t) for t in release_times):
849-
if isinstance(time.left, np.datetime64) and isinstance(release_times[0], np.timedelta64):
850-
release_times = np.array([t + time.left for t in release_times])
851-
if np.any(release_times < time.left):
852-
warnings.warn(
853-
"Some particles are set to be released outside the FieldSet's executable time domain.",
854-
ParticleSetWarning,
855-
stacklevel=2,
856-
)
857-
if np.any(release_times > time.right):
858-
warnings.warn(
859-
"Some particles are set to be released after the fieldset's last time and the fields are not constant in time.",
860-
ParticleSetWarning,
861-
stacklevel=2,
862-
)
848+
if np.isnat(release_times).all():
849+
return
850+
851+
if isinstance(time.left, np.datetime64) and isinstance(release_times[0], np.timedelta64):
852+
release_times = np.array([t + time.left for t in release_times])
853+
if np.any(release_times < time.left):
854+
warnings.warn(
855+
"Some particles are set to be released outside the FieldSet's executable time domain.",
856+
ParticleSetWarning,
857+
stacklevel=2,
858+
)
859+
if np.any(release_times > time.right):
860+
warnings.warn(
861+
"Some particles are set to be released after the fieldset's last time and the fields are not constant in time.",
862+
ParticleSetWarning,
863+
stacklevel=2,
864+
)

0 commit comments

Comments
 (0)