-
Notifications
You must be signed in to change notification settings - Fork 10
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
add state NaN checker #970
base: main
Are you sure you want to change the base?
Conversation
8a8e505
to
39a4e0e
Compare
Adds a function that quantitatively checks how many NaNs are present in the state, and displays this information to the user. This can be used to inspect sol.u[end] after a simulation has run, to see if any NaNs were produced at the end of the simulation. If no NaNs are found, this information is logged in an info statement. If NaNs are found, this information is logged in a warn statement.
39a4e0e
to
49206ad
Compare
src/shared_utilities/utils.jl
Outdated
return nothing | ||
end | ||
|
||
function count_nans_state(state::ClimaCore.Fields.Field) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would we like to make this also take the land mask as a second argument?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you want to also add this to our global runs in this PR? soil, soil canopy, soil canopy snow? perhaps we can add it as a callback to check every month e.g.
dcec968
to
42d41d2
Compare
src/shared_utilities/utils.jl
Outdated
for pn in propertynames(state) | ||
state_new = getproperty(state, pn) | ||
@info "Checking NaNs in $pn" | ||
count_nans_state(state_new, mask) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
any(isnan, state)
works
42d41d2
to
27d961f
Compare
27d961f
to
a5fffc5
Compare
a5fffc5
to
bba26da
Compare
Purpose
closes #969
Adds a function that quantitatively checks how many NaNs are present in the state, and displays this information to the user. This can be used to inspect
sol.u[end]
after a simulation has run, to see if any NaNs were produced at the end of the simulation.If no NaNs are found, this information is logged in an
info
statement. If NaNs are found, this information is logged in awarn
statement.To-do