From c6817f364400fcb75d2da57b8dfbbbb7b68339c4 Mon Sep 17 00:00:00 2001 From: Julia Sloan Date: Tue, 19 Nov 2024 14:37:31 -0800 Subject: [PATCH] rename diagnostics -> extra_atmos_diagnostics --- config/benchmark_configs/climaatmos_diagedmf_io.yml | 2 +- config/ci_configs/slabplanet_atmos_diags.yml | 2 +- config/ci_configs/slabplanet_default.yml | 2 +- experiments/ClimaEarth/cli_options.jl | 8 ++++---- .../ClimaEarth/components/atmosphere/climaatmos.jl | 10 ++++++---- experiments/ClimaEarth/run_cloudless_aquaplanet.jl | 2 +- experiments/ClimaEarth/run_cloudy_aquaplanet.jl | 2 +- experiments/ClimaEarth/run_cloudy_slabplanet.jl | 2 +- experiments/ClimaEarth/run_dry_held_suarez.jl | 2 +- experiments/ClimaEarth/run_moist_held_suarez.jl | 2 +- experiments/ClimaEarth/user_io/arg_parsing.jl | 7 ++++--- 11 files changed, 22 insertions(+), 19 deletions(-) diff --git a/config/benchmark_configs/climaatmos_diagedmf_io.yml b/config/benchmark_configs/climaatmos_diagedmf_io.yml index 506cafec76..a9a5cc8a3c 100644 --- a/config/benchmark_configs/climaatmos_diagedmf_io.yml +++ b/config/benchmark_configs/climaatmos_diagedmf_io.yml @@ -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 diff --git a/config/ci_configs/slabplanet_atmos_diags.yml b/config/ci_configs/slabplanet_atmos_diags.yml index d8a6d4e00b..d43a77b052 100644 --- a/config/ci_configs/slabplanet_atmos_diags.yml +++ b/config/ci_configs/slabplanet_atmos_diags.yml @@ -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 diff --git a/config/ci_configs/slabplanet_default.yml b/config/ci_configs/slabplanet_default.yml index c0a0977c82..3dd0d678c6 100644 --- a/config/ci_configs/slabplanet_default.yml +++ b/config/ci_configs/slabplanet_default.yml @@ -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 diff --git a/experiments/ClimaEarth/cli_options.jl b/experiments/ClimaEarth/cli_options.jl index 944fc29f82..b25d1d27eb 100644 --- a/experiments/ClimaEarth/cli_options.jl +++ b/experiments/ClimaEarth/cli_options.jl @@ -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`]" @@ -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`]" diff --git a/experiments/ClimaEarth/components/atmosphere/climaatmos.jl b/experiments/ClimaEarth/components/atmosphere/climaatmos.jl index 13148a7afc..3face210f9 100644 --- a/experiments/ClimaEarth/components/atmosphere/climaatmos.jl +++ b/experiments/ClimaEarth/components/atmosphere/climaatmos.jl @@ -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 diff --git a/experiments/ClimaEarth/run_cloudless_aquaplanet.jl b/experiments/ClimaEarth/run_cloudless_aquaplanet.jl index d7053a7678..cacecf3b28 100644 --- a/experiments/ClimaEarth/run_cloudless_aquaplanet.jl +++ b/experiments/ClimaEarth/run_cloudless_aquaplanet.jl @@ -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"], diff --git a/experiments/ClimaEarth/run_cloudy_aquaplanet.jl b/experiments/ClimaEarth/run_cloudy_aquaplanet.jl index ed1e7a9d5b..ae98a79009 100644 --- a/experiments/ClimaEarth/run_cloudy_aquaplanet.jl +++ b/experiments/ClimaEarth/run_cloudy_aquaplanet.jl @@ -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"], diff --git a/experiments/ClimaEarth/run_cloudy_slabplanet.jl b/experiments/ClimaEarth/run_cloudy_slabplanet.jl index de42760e05..4faa4c28e4 100644 --- a/experiments/ClimaEarth/run_cloudy_slabplanet.jl +++ b/experiments/ClimaEarth/run_cloudy_slabplanet.jl @@ -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"], diff --git a/experiments/ClimaEarth/run_dry_held_suarez.jl b/experiments/ClimaEarth/run_dry_held_suarez.jl index a068318993..497461f845 100644 --- a/experiments/ClimaEarth/run_dry_held_suarez.jl +++ b/experiments/ClimaEarth/run_dry_held_suarez.jl @@ -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"], diff --git a/experiments/ClimaEarth/run_moist_held_suarez.jl b/experiments/ClimaEarth/run_moist_held_suarez.jl index 60b34e9982..1789030e70 100644 --- a/experiments/ClimaEarth/run_moist_held_suarez.jl +++ b/experiments/ClimaEarth/run_moist_held_suarez.jl @@ -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"], diff --git a/experiments/ClimaEarth/user_io/arg_parsing.jl b/experiments/ClimaEarth/user_io/arg_parsing.jl index bd587c50ec..d4e457795d 100644 --- a/experiments/ClimaEarth/user_io/arg_parsing.jl +++ b/experiments/ClimaEarth/user_io/arg_parsing.jl @@ -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