Skip to content

Commit 81a1200

Browse files
Further simplifying evaluate_particle loop
1 parent 46f7058 commit 81a1200

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

parcels/kernel.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,8 @@ def evaluate_particle(self, p, endtime):
389389
# if abs(endtime - p.time_nextloop) < abs(p.next_dt) - 1e-6:
390390
# p.next_dt = abs(endtime - p.time_nextloop) * sign_dt
391391
# except AttributeError:
392-
if sign_dt == 1:
393-
if (endtime - p.time_nextloop) <= p.dt:
394-
p.dt = endtime - p.time_nextloop
395-
else:
396-
if (endtime - p.time_nextloop) >= p.dt:
397-
p.dt = -(endtime - p.time_nextloop)
392+
if sign_dt * (endtime - p.time_nextloop) <= p.dt:
393+
p.dt = sign_dt * (endtime - p.time_nextloop)
398394
res = self._pyfunc(p, self._fieldset, p.time_nextloop)
399395

400396
if res is None:

0 commit comments

Comments
 (0)