Skip to content

Commit

Permalink
add atmos toml path
Browse files Browse the repository at this point in the history
  • Loading branch information
LenkaNovak committed Oct 4, 2023
1 parent 81ebe3c commit 42f8aff
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/longrun_configs/dyamond_target.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

2 changes: 2 additions & 0 deletions experiments/AMIP/modular/cli_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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`]"
Expand Down
20 changes: 13 additions & 7 deletions experiments/AMIP/modular/components/atmosphere/climaatmos_init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 42f8aff

Please sign in to comment.