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

Added invalid_fill_value to ScaleNegativeTracers #170

Merged
merged 11 commits into from
Mar 28, 2024

Conversation

jagoosw
Copy link
Collaborator

@jagoosw jagoosw commented Mar 22, 2024

This PR adds a parameter invalid_fill_value to ScaleNegativeTracers so that when the total cell content is less than 0 it doesn't have to be filled with NaNs. While even less ideal this seems to be the easiest way to keep complex models positive (e.g. the near global model), and is akin to how lots of earth system models do it.

Copy link
Collaborator

@navidcy navidcy left a comment

Choose a reason for hiding this comment

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

lgtm

only thing I think it'd be nice to mention the caveat in the docstring

Comment on lines 67 to 68
`invalid_fill_value` specifies the value to set the total cell content to if the total is less than 0
(meaning that total tracer conservation can not be enforced).
Copy link
Collaborator

Choose a reason for hiding this comment

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

perhaps we elaborate a bit more here... eg mention the caveat you included in the first comment in the PR? also, if other models follow similar practice perhaps mention 1-2 here?

@jagoosw
Copy link
Collaborator Author

jagoosw commented Mar 26, 2024

Thanks for sorting @navidcy, I'm going to bump the patch number and they merge

@jagoosw jagoosw merged commit 12cfa7f into main Mar 28, 2024
5 checks passed
@jagoosw jagoosw deleted the jsw/optional-naning-for-negativity-protection branch March 28, 2024 14:59
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