-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76aa8d1
commit 1fcf2ab
Showing
6 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ using Test | |
|
||
include("test_init.jl") | ||
include("test_atmos_config.jl") | ||
include("test_emulate_sample.jl") |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
["equator_pole_temperature_gradient_wet"] | ||
prior = "Parameterized(Normal(4.779568,0.31223328))" | ||
constraint = "[bounded_below(0)]" | ||
type = "float" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import JLD2 | ||
import Statistics: mean | ||
|
||
using CalibrateEmulateSample.Emulators | ||
using CalibrateEmulateSample.MarkovChainMonteCarlo | ||
import EnsembleKalmanProcesses as EKP | ||
using EnsembleKalmanProcesses.ParameterDistributions | ||
using EnsembleKalmanProcesses.TOMLInterface | ||
|
||
import CalibrateAtmos as CAL | ||
|
||
y_obs = [261.5493] | ||
y_noise_cov = [0.02619;;] | ||
ekp = JLD2.load_object(joinpath("test_case_inputs", "eki_test.jld2")) | ||
init_params = [EKP.get_u_final(ekp)[1]] | ||
|
||
prior_path = joinpath("test_case_inputs", "sphere_hs_rhoe.toml") | ||
|
||
prior = CAL.get_prior(prior_path) | ||
|
||
input_output_pairs = CAL.get_input_output_pairs(ekp) | ||
|
||
@test input_output_pairs.inputs.stored_data == | ||
hcat([ekp.u[i].stored_data for i in 1:(length(ekp.u) - 1)]...) | ||
@test input_output_pairs.outputs.stored_data == | ||
hcat([ekp.g[i].stored_data for i in 1:length(ekp.g)]...) | ||
|
||
emulator = CAL.gp_emulator(input_output_pairs, y_noise_cov) | ||
|
||
|
||
(; mcmc, chain) = CAL.sample(emulator, y_obs, prior, init_params) | ||
@test mean(chain.value[1:100000]) ≈ 4.19035299 | ||
|
||
constrained_posterior = CAL.save_samples(mcmc, chain, prior) | ||
@test mean(constrained_posterior["equator_pole_temperature_gradient_wet"]) ≈ | ||
66.046965013381 |