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

Update configuration.py #46

Merged
merged 2 commits into from
Oct 3, 2024
Merged

Update configuration.py #46

merged 2 commits into from
Oct 3, 2024

Conversation

MetNoMarvinK
Copy link
Contributor

Avoid crash in case non-integer TRUNC values are used, e.g. when trunc is set to custom. TRUNC will still be handled as an integer in pysurfex.

Avoid crash in case non-integer TRUNC values are used, e.g. when trunc is set to custom. TRUNC will still be handled as an integer in pysurfex.
@@ -550,7 +550,7 @@ def __init__(self, env, conf):
gsize = float(env["LGSIZE"])
trunc = 2 # linear
if "TRUNC" in env:
trunc = int(env["TRUNC"])
trunc = int(float(env["TRUNC"]))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you remove the int? It should be treated as a float if it's a float. If you convert it to an int the 2.4 value will be truncated to 2. Otherwise I support the change as I have had to do it also myself sometimes recently:-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Of course. I was not sure whether TRUNC should be "allowed" to actually be 2.4 due to the initial int constrain in pysurfex.

TRUNC can now be a float.
@trygveasp
Copy link
Collaborator

Thanks. I'll merge when the checks pass. Remind me if I forget it:-)

@trygveasp trygveasp merged commit 224b426 into metno:master Oct 3, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants