-
Notifications
You must be signed in to change notification settings - Fork 9
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
Integrate calibration pipeline into ClimaLand #621
base: main
Are you sure you want to change the base?
Conversation
2a4b8d3
to
197737c
Compare
509a136
to
5e733a7
Compare
4579aab
to
c2add9d
Compare
This commit adds a simple calibration example, with detailed explanations. We calibrate two parameters, g1 and g0, on canopy transpiration data target, using EnsembleKalmanProcesses.jl. We use a single site model, at the ozark site, and calibrate on simulation output, with the goal of demonstrating the ability to recover the original parameters and demonstrate a simple calibration framework.
f395e2b
to
423c5b7
Compare
# Packages | ||
import ClimaLandSimulations.Fluxnet as CLS # to run the model | ||
import EnsembleKalmanProcesses as EKP # to perform the calibration | ||
import Random # we need it for ... |
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.
Can update this
params = CLS.ozark_default_params(; conductance = CLS.conductance_ozark(; g1 = g1, g0 = g0)), | ||
)[1]; | ||
|
||
inputs = CLS.make_inputs_df("US-MOz")[1]; |
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 are these inputs and outputs? Can we access transpiration directly from sv
?
|
||
simulation_output = CLS.make_output_df("US-MOz", sv, inputs); | ||
|
||
transpiration = simulation_output.transpiration .* 1e9 # 1e9 because very small otherwise |
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.
Why the 1e9? Is there an issue with floating point precision, or is there an error in the output?
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 also changes the float type
|
||
# parameters prior | ||
prior_g1 = EKP.constrained_gaussian("g1", 221, 100, 0, Inf) # mean of 221 sqrt(Pa) = 7 sqrt(kPa), std of 100 (3 kPa) | ||
# Ollie: why does it return μ=5.3, σ=0.4? Are the values transformed? Is this to be of same order of magnitude? |
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.
is this ok now?
# generate the initial ensemble and set up the ensemble Kalman inversion | ||
N_ensemble = 5 | ||
N_iterations = 5 | ||
rng_seed = 41 # Ollie: why 41? |
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.
can erase? I dont think this matters too much
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.
In general - maybe should remove "Ollie" questions for now?
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.
Sorry I should've left a comment - this PR is not ready to be merged as I want to discuss these fews questions with Ollie first, but I think he is away at the moment.
But I still thought it would be valuable to review at this stage
theta_true = [141.0, 0.0001] | ||
fig = Figure() | ||
ax = Axis(fig[1, 1]) | ||
trange = 1:1:length(transpiration_target) |
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.
could note that this is not a physical time? "trange"
@@ -0,0 +1,96 @@ | |||
# This script describes the simplest possible calibration of ClimaLand, |
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.
Should we add this to buildkite? and upload plots
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.
or this could be a tutorial?
|
||
|
||
# Plot | ||
using GLMakie |
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.
Can we use CairoMakie? It is the more robust backend
This PR adds calibration experiments, starting with a minimal working example.