Skip to content

Commit

Permalink
rename diagnostics -> extra_atmos_diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Nov 20, 2024
1 parent 330b87e commit c6817f3
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 19 deletions.
2 changes: 1 addition & 1 deletion config/benchmark_configs/climaatmos_diagedmf_io.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ output_default_diagnostics: false
prescribe_ozone: true
aerosol_radiation: true
prescribed_aerosols: ["CB1", "CB2", "DST01", "OC1", "OC2", "SO4", "SSLT01"]
diagnostics:
extra_atmos_diagnostics:
- short_name: [pfull, rsut, rlut, pr, hus, rv]
period: 10hours
2 changes: 1 addition & 1 deletion config/ci_configs/slabplanet_atmos_diags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ precip_model: "0M"
rad: "gray"
t_end: "10days"
vert_diff: "true"
diagnostics:
extra_atmos_diagnostics:
- short_name: [mse, lr, edt, evu, ts, mass_strf, stab, vt, egr, toa_fluxes_net]
reduction_time: average
period: 1days
2 changes: 1 addition & 1 deletion config/ci_configs/slabplanet_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ rad: "gray"
t_end: "10days"
vert_diff: "true"
output_default_diagnostics: false
diagnostics:
extra_atmos_diagnostics:
- short_name: [mse, lr, edt, evu, hfes, evspsbl, ts]
period: 1days
8 changes: 4 additions & 4 deletions experiments/ClimaEarth/cli_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ function argparse_settings()
help = "Boolean flag indicating whether to compute and output coupler diagnostics [`true` (default), `false`]"
arg_type = Bool
default = true
"--diagnostics"
help = "List of dictionaries containing diagnostic information [nothing (default)]"
arg_type = Vector{Dict{Any, Any}}
default = nothing
# Physical simulation information
"--evolving_ocean"
help = "Boolean flag indicating whether to use a dynamic slab ocean model, as opposed to constant surface temperatures [`true` (default), `false`]"
Expand Down Expand Up @@ -144,6 +140,10 @@ function argparse_settings()
help = "The repository containing the ClimaAtmos configuration file to use [`ClimaAtmos` (default), `ClimaCoupler`]"
arg_type = String
default = "ClimaAtmos"
"--extra_atmos_diagnostics"
help = "List of dictionaries containing information about additional atmosphere diagnostics to output [nothing (default)]"
arg_type = Vector{Dict{Any, Any}}
default = []
### ClimaLand specific
"--land_domain_type"
help = "Type of land domain. [`sphere` (default), `single_column`]"
Expand Down
10 changes: 6 additions & 4 deletions experiments/ClimaEarth/components/atmosphere/climaatmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -353,15 +353,17 @@ function get_atmos_config_dict(coupler_dict::Dict, job_id::String)
atmos_config = merge(atmos_config, Dict("toml" => [toml_file]))
end

# specify atmos output directory to be inside the coupler output directory
# Specify atmos output directory to be inside the coupler output directory
atmos_output_dir = joinpath(coupler_dict["coupler_output_dir"], job_id, "clima_atmos")
atmos_config["output_dir"] = atmos_output_dir

# Access extra atmosphere diagnostics from coupler so we can rename for atmos code
atmos_config["diagnostics"] = coupler_dict["extra_atmos_diagnostics"]

# merge configs
# (if there are common keys, the last dictionary in the `merge` arguments takes precedence)
# The Atmos `get_simulation` function expects the atmos config to contains its timestep size
# in the `dt` field. If there is a `dt_atmos` field in coupler_dict, we add it to the atmos config as `dt`
dt_atmos = haskey(coupler_dict, "dt_atmos") ? coupler_dict["dt_atmos"] : coupler_dict["dt"]
atmos_config = merge(atmos_config, Dict("output_dir" => atmos_output_dir, "dt" => dt_atmos))
atmos_config["dt"] = dt_atmos

# set restart file to the initial file saved in this location if it is not nothing
# TODO this is hardcoded and should be fixed once we have a better restart system
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudless_aquaplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ config_dict = Dict(
"surface_setup" => "PrescribedSurface",
# diagnostic (nested with period and short_name)
"output_default_diagnostics" => false,
"diagnostics" => [
"extra_atmos_diagnostics" => [
Dict(
"short_name" =>
["mse", "lr", "mass_strf", "stab", "vt", "egr", "ua", "va", "wa", "ta", "rhoa", "pfull"],
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudy_aquaplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ config_dict = Dict(
"surface_setup" => "PrescribedSurface",
# diagnostic (nested with period and short_name)
"output_default_diagnostics" => false,
"diagnostics" => [
"extra_atmos_diagnostics" => [
Dict(
"short_name" =>
["mse", "lr", "mass_strf", "stab", "vt", "egr", "ua", "va", "wa", "ta", "rhoa", "pfull"],
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_cloudy_slabplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ config_dict = Dict(
"surface_setup" => "PrescribedSurface",
# diagnostic (nested with period and short_name)
"output_default_diagnostics" => false,
"diagnostics" => [
"extra_atmos_diagnostics" => [
Dict(
"short_name" =>
["mse", "lr", "mass_strf", "stab", "vt", "egr", "ua", "va", "wa", "ta", "rhoa", "pfull"],
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_dry_held_suarez.jl
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ config_dict = Dict(
"surface_setup" => "PrescribedSurface",
# diagnostic (nested with period and short_name)
"output_default_diagnostics" => false,
"diagnostics" => [
"extra_atmos_diagnostics" => [
Dict(
"short_name" =>
["mse", "lr", "mass_strf", "stab", "vt", "egr", "ua", "va", "wa", "ta", "rhoa", "pfull"],
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/run_moist_held_suarez.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ config_dict = Dict(
"surface_setup" => "PrescribedSurface",
# diagnostic (nested with period and short_name)
"output_default_diagnostics" => false,
"diagnostics" => [
"extra_atmos_diagnostics" => [
Dict(
"short_name" =>
["mse", "lr", "mass_strf", "stab", "vt", "egr", "ua", "va", "wa", "ta", "rhoa", "pfull"],
Expand Down
7 changes: 4 additions & 3 deletions experiments/ClimaEarth/user_io/arg_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@ function get_coupler_args!(config_dict::Dict)
@info "Using default AMIP diagnostics"
(period, calendar_dt) = get_diag_period(t_start, t_end)

# when is this used? config_dict["diagnostics"] never accessed
!haskey(config_dict, "diagnostics") && (config_dict["diagnostics"] = Vector{Dict{Any, Any}}())
# Additional atmosphere diagnostics
!haskey(config_dict, "extra_atmos_diagnostics") &&
(config_dict["extra_atmos_diagnostics"] = Vector{Dict{Any, Any}}())
push!(
config_dict["diagnostics"],
config_dict["extra_atmos_diagnostics"],
Dict("short_name" => ["toa_fluxes_net"], "reduction_time" => "average", "period" => period),
)
end
Expand Down

0 comments on commit c6817f3

Please sign in to comment.