Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix warn_outputdt_release_desync for NaN release times #1744

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions parcels/particleset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@
outputdt = output_file.outputdt if output_file else np.inf
if isinstance(outputdt, timedelta):
outputdt = outputdt.total_seconds()
if outputdt is not None:
if np.isfinite(outputdt) is not None:

Check warning on line 1081 in parcels/particleset.py

View check run for this annotation

Codecov / codecov/patch

parcels/particleset.py#L1081

Added line #L1081 was not covered by tests
erikvansebille marked this conversation as resolved.
Show resolved Hide resolved
_warn_outputdt_release_desync(outputdt, self.particledata.data["time_nextloop"])

if isinstance(callbackdt, timedelta):
Expand Down Expand Up @@ -1235,7 +1235,7 @@

def _warn_outputdt_release_desync(outputdt: float, release_times: Iterable[float]):
"""Gives the user a warning if the release time isn't a multiple of outputdt."""
if any(t % outputdt != 0 for t in release_times):
if any((np.isfinite(t) and t % outputdt != 0) for t in release_times):

Check warning on line 1238 in parcels/particleset.py

View check run for this annotation

Codecov / codecov/patch

parcels/particleset.py#L1238

Added line #L1238 was not covered by tests
VeckoTheGecko marked this conversation as resolved.
Show resolved Hide resolved
warnings.warn(
"Some of the particles have a start time that is not a multiple of outputdt. "
"This could cause the first output to be at a different time than expected.",
Expand Down
Loading