-
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
Bucket diagnostics #628
Bucket diagnostics #628
Conversation
b94eca3
to
6478bb0
Compare
Do you know why ClimaLandSimulations CI fail?
But if I run
locally, it works just fine |
Maybe you have to add ClimaDiagnostics to the Project.toml for ClimaLandSimulations? |
123c8d2
to
8830f45
Compare
605fe5a
to
0f19f60
Compare
d76adf3
to
044171a
Compare
@kmdeck Could you just look at Thank you!! |
|
@@ -19,13 +19,13 @@ jobs: | |||
- uses: julia-actions/setup-julia@latest | |||
with: | |||
version: '1.10' | |||
- uses: julia-actions/cache@v2 | |||
# - uses: julia-actions/cache@v2 |
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.
You can try uncommenting this
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.
Let's go back to this at some point, as discussed, this still doesn't work
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 leave a comment on why this is commented out
error_diagnostic_variable(variable, land_model::T) where {T} = | ||
error("Cannot compute $variable with model = $T") | ||
|
||
macro generate_error_functions(function_names...) |
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.
Did this work?
Let's add tests to check that it works and let's add comments to explain how this works.
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.
the test didn't work, let's discuss this when we meet
We should try to have more isolated unit tests that test the various functions, instead of a full experiment. |
Artifacts.toml
Outdated
[land_albedo] | ||
git-tree-sha1 = "5f7141a13994d5b334f1240e1bd5474ad44d96c4" |
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.
This should probably not be here
src/Diagnostics/diagnostic.jl
Outdated
Return a `DiagnosticVariable` from its `short_name`, if it exists. | ||
""" | ||
function get_diagnostic_variable(short_name) | ||
haskey(ALL_DIAGNOSTICS, short_name) || |
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.
For your reference, as discussed
@test_throws ErrorException get_diagnostic_variable("bob")
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.
I added that test, BUT, currently we do not call define_diagnostics!
inside src (only in docs), so get_diagnostic_variable
would throw an error with any variable...
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.
You can call define_diagnostics in your test
end | ||
|
||
@generate_error_functions "albedo" "net_radiation" "surface_temperature" "surface_specific_humidity" "latent_heat_flux" "aerodynamic_resistance" "sensible_heat_flux" "vapor_flux" "surface_air_density" "soil_temperature" "subsurface_water_storage" "surface_water_content" "snow_water_equivalent" | ||
|
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.
To test this
@test_throws ErrorException("cannot albedo with nothing") compute_albedo!(_, _, _, _, nothing)
Also check that compute_albedo!
is defined
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.
julia> using Test
julia> using ClimaLand
julia> @test isdefined(ClimaLand.Diagnostics, :compute_albedo!)
Test Passed
julia> @test_throws ErrorException("cannot albedo with nothing") ClimaLand.Diagnostics.comput
e_albedo!(_, _, _, _, nothing)
ERROR: syntax: all-underscore identifier used as rvalue around REPL[9]:1
Stacktrace:
[1] top-level scope
@ REPL[9]:1
``` | ||
|
||
Your diagnostics have now been written in netcdf files in your output folder. | ||
|
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.
What if I want to compute some existing diagnostics but with different Writers? Or with different frequencies?
aec723a
to
1de8b6a
Compare
864db92
to
e52329e
Compare
Let's discuss the Bucket experiment a bit, we want to use an existing experiment, but it would be good if variables vary in space at least... I am not sure it is the case with |
Let's not forget about the issue on |
d72d877
to
558c18c
Compare
558c18c
to
0a4f1b3
Compare
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.
Some work is left for a future PR, but this looks good!
Thank you very much!
95b0f07
to
daa9ded
Compare
This PR adds diagnostics to ClimaLand, as a new module in /src. This module is built on ClimaDiagnostics.jl, which is also used by ClimaAtmos. It contains default diagnostics methods for different ClimaLand models (for now, BucketModel and SoilCanopyModel), those diagnostics contains metadata such as where diagnostics variables are stored in those models, what is there names (short, long, standard) and physical units, with additional comments. It creates a Dict of those variables, and also default Scheduling methods, such as hourly average or monthly maximum. Users can define their own diagnostic variables or scheduling, and developers can add defaults. More information is available in the documentation.
The tests were only comparing the albedo function job
daa9ded
to
d3274bb
Compare
Purpose
This PR adds diagnostics to ClimaLand, as a new module in /src.
This module is built on ClimaDiagnostics.jl, which is also used by
ClimaAtmos. It contains default diagnostics methods for different
ClimaLand models (for now, BucketModel and SoilCanopyModel), those
diagnostics contains metadata such as where diagnostics variables are
stored in those models, what is there names (short, long, standard)
and physical units, with additional comments. It creates a Dict of those
variables, and also default Scheduling methods, such as hourly average
or monthly maximum. Users can define their own diagnostic variables or
scheduling, and developpers can add defaults. More information are
available in the documentation.