Skip to content

Commit 63896ac

Browse files
Implementing review suggestion
1 parent e479387 commit 63896ac

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/parcels/_core/particleset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from parcels._core.statuscodes import StatusCode
1616
from parcels._core.utils.time import (
1717
TimeInterval,
18-
float_to_datetime,
18+
float_to_datelike,
1919
timedelta_to_float,
2020
)
2121
from parcels._core.warnings import ParticleSetWarning
@@ -523,7 +523,7 @@ def execute(
523523
next_output += outputdt * sign_dt
524524

525525
if verbose_progress:
526-
pbar.set_description("Integration time: " + str(float_to_datetime(time, self.fieldset.time_interval)))
526+
pbar.set_description("Integration time: " + str(float_to_datelike(time, self.fieldset.time_interval)))
527527
pbar.update(next_time - time)
528528

529529
time = next_time

src/parcels/_core/utils/time.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def timedelta_to_float(dt: float | timedelta | np.timedelta64) -> float:
163163
return float(dt)
164164

165165

166-
def float_to_datetime(dt: float, time_interval) -> np.datetime64:
167-
"""Convert a float time (in seconds from the start of the time_interval) to a datetime"""
166+
def float_to_datelike(dt: float, time_interval) -> np.datetime64 | np.timedelta64:
167+
"""Convert a float time (in seconds from the start of the time_interval) to a datetime (if time_interval is a datetime object) or timedelta (otherwise)"""
168168
if time_interval:
169169
return np.timedelta64(int(dt), "s") + time_interval.left
170170
else:

0 commit comments

Comments
 (0)