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

Warnings vs ValueErrors with user provided params #1691

Open
VeckoTheGecko opened this issue Sep 5, 2024 · 2 comments
Open

Warnings vs ValueErrors with user provided params #1691

VeckoTheGecko opened this issue Sep 5, 2024 · 2 comments
Milestone

Comments

@VeckoTheGecko
Copy link
Contributor

VeckoTheGecko commented Sep 5, 2024

We have some warnings along the lines of

Parcels/parcels/field.py

Lines 232 to 238 in 5fff42c

if self.time_periodic is not False and self.allow_time_extrapolation:
warnings.warn(
"allow_time_extrapolation and time_periodic cannot be used together. allow_time_extrapolation is set to False",
FieldSetWarning,
stacklevel=2,
)
self.allow_time_extrapolation = False

Thoughts on just raising a ValueError instead? Its incorrect usage of the API, and I think explicitly failing would be nicer than implicitly working under different settings

@VeckoTheGecko
Copy link
Contributor Author

I don't think its a major thing either way. Perhaps worth it only for v4

@erikvansebille
Copy link
Member

Yes, good point that a ValueError would be more appropriate and cleaner here; the code then also don't need to implicitly decide that time_periodic is a more important setting than allow_time_interpolation

@VeckoTheGecko VeckoTheGecko added this to the Parcels 4 milestone Sep 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants