Skip to content

Conversation

@andrew-s28
Copy link
Contributor

Does what it says on the tin: removes the default 1s time step for ParticleSet.execute() and now requires the user specify a dt argument when calling the function.

Addresses #2136 as a part of #2261. Happy hackathon :)

@andrew-s28
Copy link
Contributor Author

Oops - forgot to run tests prior to PR. Needs some more work to make sure tests don't break.

@andrew-s28
Copy link
Contributor Author

Okay, this one was a little more involved than it initially looked, but I think I have things working now.

In order to keep allowing dt as a kwarg after the kernel argument (as a lot of existing Parcels code is written, e.g., pset.execute(AdvectionRK4, dt=...)), it's necessary to remove the default from the pyfunc argument, as an argument without a default can't follow an argument with a default.

I personally think that requiring the pyfunc argument as well as the dt argument is actually better than not; I couldn't find a single example in the documentation that didn't have kernels explicitly specified when calling ParticleSet.execute() (so as far as I can tell, this wouldn't break any examples). But this does go beyond the original issue #2136, so feedback welcome.

@andrew-s28 andrew-s28 marked this pull request as ready for review October 2, 2025 00:10
Copy link
Member

@erikvansebille erikvansebille left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; also agree to make pyfunc a required argument too; this is what users would do anyways

Only one question below

@VeckoTheGecko
Copy link
Contributor

Thanks for the contribution @andrew-s28 ! 🚀

@erikvansebille erikvansebille merged commit 43fbf59 into Parcels-code:v4-dev Oct 2, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from Backlog to Done in Parcels development Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants