From 42f8aff83bdc64a4e687a0a6500ffcb4fd4d7843 Mon Sep 17 00:00:00 2001 From: LenkaNovak Date: Tue, 3 Oct 2023 18:49:41 -0700 Subject: [PATCH] add atmos toml path --- config/longrun_configs/dyamond_target.yml | 2 +- experiments/AMIP/modular/cli_options.jl | 2 ++ .../components/atmosphere/climaatmos_init.jl | 20 ++++++++++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/config/longrun_configs/dyamond_target.yml b/config/longrun_configs/dyamond_target.yml index 0c8748408e..bd574b1cc0 100644 --- a/config/longrun_configs/dyamond_target.yml +++ b/config/longrun_configs/dyamond_target.yml @@ -10,5 +10,5 @@ dt_save_to_sol: "0.5days" dt_save_to_disk: "0.5days" turb_flux_partition: "CombinedStateFluxes" atmos_config_file: "config/longrun_configs/longrun_aquaplanet_dyamond.yml" +atmos_toml_file: "toml/longrun_aquaplanet_dyamond.toml" monthly_checkpoint: false - diff --git a/experiments/AMIP/modular/cli_options.jl b/experiments/AMIP/modular/cli_options.jl index f6b83656ae..bdc66d342c 100644 --- a/experiments/AMIP/modular/cli_options.jl +++ b/experiments/AMIP/modular/cli_options.jl @@ -59,6 +59,8 @@ function argparse_settings() default = "PrescribedSurface" "--atmos_config_file" help = "A yaml file used to set the atmospheric model configuration. If nothing is specified, the default configuration is used." + "--atmos_toml_file" + help = "A toml file used to overwrite the atmospheric model parameters. If nothing is specified, the default parameters are used." # ClimaLSM specific "--land_albedo_type" help = "Access land surface albedo information from data file. [`function`, `map_static`, `map_temporal`]" diff --git a/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl b/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl index 967176e957..94c119cfd6 100644 --- a/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl +++ b/experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl @@ -28,19 +28,25 @@ Returns the specified atmospheric configuration (`atmos_config_dict`) overwitten in the coupler dictionary (`config_dict`). """ function get_atmos_config(coupler_dict) - atmos_file = coupler_dict["atmos_config_file"] + atmos_config_file = coupler_dict["atmos_config_file"] # override default or specified configs with coupler arguments, and set the correct atmos config_file - if isnothing(atmos_file) + if isnothing(atmos_config_file) @info "Using Atmos default configuration" - merge(CA.default_config_dict(), coupler_dict, Dict("config_file" => atmos_file)) + atmos_config = merge(CA.default_config_dict(), coupler_dict, Dict("config_file" => atmos_config_file)) else - @info "Using Atmos configuration from $atmos_file" - merge( - CA.override_default_config(joinpath(pkgdir(CA), atmos_file)), + @info "Using Atmos configuration from $atmos_config_file" + atmos_config = merge( + CA.override_default_config(joinpath(pkgdir(CA), atmos_config_file)), coupler_dict, - Dict("config_file" => atmos_file), + Dict("config_file" => atmos_config_file), ) end + atmos_toml_file = coupler_dict["atmos_toml_file"] + if !isnothing(atmos_toml_file) + @info "Overwriting Atmos parameters from $atmos_toml_file" + atmos_config = merge(atmos_config, Dict("toml" => [joinpath(pkgdir(CA), atmos_toml_file)])) + end + return atmos_config end function atmos_init(::Type{FT}, atmos_config_dict::Dict) where {FT}