Skip to content

Commit

Permalink
Add slurm_calibration func
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Apr 19, 2024
1 parent 8964bc4 commit 0bb82e4
Show file tree
Hide file tree
Showing 12 changed files with 135 additions and 321 deletions.
File renamed without changes.
28 changes: 14 additions & 14 deletions experiments/surface_fluxes_perfect_model/postprocessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ using Statistics

using CalibrateAtmos

experiment_id = "surface_fluxes_perfect_model"
experiment_dir = dirname(Base.active_project())
experiment_config = CalibrateAtmos.ExperimentConfig(experiment_dir)
output_dir = experiment_config.output_dir
experiment_id = experiment_config.id
N_iter = experiment_config.n_iterations
N_mem = experiment_config.ensemble_size

function convergence_plot(
eki,
prior,
theta_star_vec,
param_names,
output_dir = "output",
output_dir = experiment_config.output_dir,
)

# per parameter
Expand Down Expand Up @@ -92,10 +97,7 @@ function convergence_plot(
Makie.lines!.(ax, tuple(0.0:(length(phi_series[1]) - 1)), phi_series)
Makie.hlines!(ax, [theta_star], color = :red, linestyle = :dash)

Makie.save(
joinpath(output_dir, experiment_id, "convergence_$param_name.png"),
f,
)
Makie.save(joinpath(output_dir, "convergence_$param_name.png"), f)
end
end

Expand All @@ -104,17 +106,14 @@ pkg_dir = pkgdir(CalibrateAtmos)
model_config = YAML.load_file(
joinpath(pkg_dir, "experiments", experiment_id, "model_config.yml"),
)
ekp_config = ExperimentConfig(experiment_id)
N_iter = ekp_config.n_iterations
N_mem = ekp_config.ensemble_size

eki_path = joinpath(
joinpath(pkg_dir, model_config["output_dir"]),
"iteration_$(lpad(N_iter, 3, '0'))",
CalibrateAtmos.path_to_iteration(output_dir, N_iter),
"eki_file.jld2",
);
eki = JLD2.load_object(eki_path);
EKP.get_u(eki)
prior = ekp_config.prior
prior = experiment_config.prior

theta_star_vec =
(; coefficient_a_m_businger = 4.7, coefficient_a_h_businger = 4.7)
Expand All @@ -130,7 +129,7 @@ convergence_plot(
# Plot the convergence of the model observable: ustar
using Pkg
FT = Float32
include(joinpath(pkgdir(CalibrateAtmos), "model_interface.jl"))
include(joinpath(experiment_dir, "model_interface.jl"))

f = Makie.Figure()
ax = Makie.Axis(f[1, 1], xlabel = "Iteration", ylabel = "Model Ustar")
Expand All @@ -148,7 +147,8 @@ for iter in 0:N_iter
model_config["toml"] = [
joinpath(
pkg_dir,
"output/$experiment_id/iteration_$(lpad(iter, 3, '0'))/member_$(lpad(i, 3, '0'))/parameters.toml",
CalibrateAtmos.path_to_ensemble_member(output_dir, iter, i),
"parameters.toml",
),
]
ustar_mod =
Expand Down
27 changes: 0 additions & 27 deletions slurm/initialize.sbatch

This file was deleted.

17 changes: 0 additions & 17 deletions slurm/model_run.jl

This file was deleted.

21 changes: 0 additions & 21 deletions slurm/model_run.sbatch

This file was deleted.

89 changes: 0 additions & 89 deletions slurm/parse_commandline.sh

This file was deleted.

12 changes: 0 additions & 12 deletions slurm/update.jl

This file was deleted.

15 changes: 0 additions & 15 deletions slurm/update.sbatch

This file was deleted.

123 changes: 0 additions & 123 deletions slurm_pipeline.jl

This file was deleted.

1 change: 1 addition & 0 deletions src/CalibrateAtmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module CalibrateAtmos

include("ekp_interface.jl")
include("model_interface.jl")
include("slurm_interface.jl")
include("emulate_sample.jl")

end # module CalibrateAtmos
Loading

0 comments on commit 0bb82e4

Please sign in to comment.