Skip to content

Commit

Permalink
If TOML path is not found, try prepending pkgdir
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Oct 3, 2023
1 parent ef53062 commit e22ac86
Show file tree
Hide file tree
Showing 30 changed files with 43 additions and 34 deletions.
4 changes: 2 additions & 2 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ subsidence:
help: "Subsidence [`nothing` (default), `Bomex`, `LifeCycleTan2018`, `Rico`, `DYCOMS`]"
value: ~
toml:
help: "TOML file(s) used to override model parameters"
value: []
help: "TOML file used to override model parameters"
value: ~
prognostic_tke:
help: "A flag for prognostic TKE [`false` (default), `true`]"
value: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ precip_model: "0M"
rayleigh_sponge: true
forcing: "held_suarez"
job_id: "central_gpu_hs_rhoe_equilmoist_nz63_0M_55km_rs35km"
toml: [toml/longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km.toml]
toml: toml/.*?
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ precip_model: "0M"
rayleigh_sponge: true
forcing: "held_suarez"
job_id: "gpu_hs_rhoe_equilmoist_nz63_0M_55km_rs35km"
toml: [toml/longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km.toml]
toml: toml/longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km.toml
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_aquaplanet_amip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ dt: "10secs"
t_end: "1days"
FLOAT_TYPE: "Float64"
job_id: "longrun_aquaplanet_amip"
toml: [toml/longrun_aquaplanet_amip.toml]
toml: toml/longrun_aquaplanet_amip.toml
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_aquaplanet_dyamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ dt: "50secs"
t_end: "1days"
FLOAT_TYPE: "Float64"
job_id: "longrun_aquaplanet_dyamond"
toml: [toml/longrun_aquaplanet_dyamond.toml]
toml: toml/longrun_aquaplanet_dyamond.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ z_max: 45000.0
precip_model: "0M"
job_id: "longrun_aquaplanet_rhoe_equil_clearsky_highres_hightop_rayleigh35e3_ft64"
moist: "equil"
toml: [toml/longrun_aquaplanet_rhoe_equil_clearsky_highres_hightop_rayleigh35e3_ft64.toml]
toml: toml/longrun_aquaplanet_rhoe_equil_clearsky_highres_hightop_rayleigh35e3_ft64.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ moist: "equil"
rad: "gray"
precip_model: "0M"
job_id: "longrun_aquaplanet_rhoe_equil_gray_55km_nz63_0M"
toml: [toml/longrun_aquaplanet_rhoe_equil_gray_55km_nz63_0M.toml]
toml: toml/longrun_aquaplanet_rhoe_equil_gray_55km_nz63_0M.toml
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_compressible_edmf_trmm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ rayleigh_sponge: true
job_id: "longrun_compressible_edmf_trmm"
dt: "0.2secs"
t_end: "3.8hours"
toml: [longrun_compressible_edmf_trmm.toml]
toml: [longrun_compressible_edmf_trmm.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ forcing: "held_suarez"
dt: "300secs"
rayleigh_sponge: true
job_id: "longrun_hs_rhoe_dry_nz63_55km_rs35km"
toml: [toml/longrun_hs_rhoe_dry_nz63_55km_rs35km.toml]
toml: toml/longrun_hs_rhoe_dry_nz63_55km_rs35km.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ precip_model: "0M"
rayleigh_sponge: true
forcing: "held_suarez"
job_id: "longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km"
toml: [toml/longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km.toml]
toml: toml/longrun_hs_rhoe_equilmoist_nz63_0M_55km_rs35km.toml
2 changes: 1 addition & 1 deletion config/model_configs/bomex_box_rhoe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ z_max: 3000.0
ls_adv: "Bomex"
job_id: "bomex_box_rhoe"
moist: "equil"
toml: [toml/bomex_box_rhoe.toml]
toml: toml/bomex_box_rhoe.toml
2 changes: 1 addition & 1 deletion config/model_configs/diagnostic_edmfx_trmm_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ dt: 10secs
t_end: 6hours
dt_save_to_disk: 10mins
FLOAT_TYPE: "Float64"
toml: [toml/diagnostic_edmfx_trmm_box.toml]
toml: toml/diagnostic_edmfx_trmm_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ dt: 10secs
t_end: 6hours
dt_save_to_disk: 10mins
FLOAT_TYPE: "Float64"
toml: [toml/diagnostic_edmfx_trmm_box.toml]
toml: toml/diagnostic_edmfx_trmm_box.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmf_trmm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ regression_test: true
dt_save_to_sol: "5mins"
job_id: "edmf_trmm"
rad: "TRMM_LBA"
toml: [toml/edmf_trmm.toml]
toml: toml/edmf_trmm.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_adv_test_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ dt: "10secs"
t_end: "3600secs"
dt_save_to_disk: "100secs"
FLOAT_TYPE: "Float64"
toml: [toml/edmfx_box_advection.toml]
toml: toml/edmfx_box_advection.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_bomex_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ perturb_initstate: false
dt: "1secs"
t_end: "10800secs"
dt_save_to_disk: "10secs"
toml: [toml/edmfx_box.toml]
toml: toml/edmfx_box.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_dycoms_rf01_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ z_stretch: false
dt: 1secs
t_end: 2400secs
dt_save_to_disk: 2secs
toml: [toml/edmfx_box.toml]
toml: toml/edmfx_box.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_gabls_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ t_end: "9hours"
dt_save_to_disk: "10mins"
perturb_initstate: false
FLOAT_TYPE: "Float64"
toml: [toml/edmfx_box.toml]
toml: toml/edmfx_box.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_rico_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ perturb_initstate: false
dt: "1secs"
t_end: "10800secs"
dt_save_to_disk: "10secs"
toml: [toml/edmfx_box.toml]
toml: toml/edmfx_box.toml
2 changes: 1 addition & 1 deletion config/model_configs/edmfx_trmm_box.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ dt: 1secs
t_end: 2hours
dt_save_to_disk: 10mins
FLOAT_TYPE: "Float64"
toml: [toml/edmfx_box.toml]
toml: toml/edmfx_box.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ kappa_4: 1.0e6
z_max: 25000.0
topography: "Agnesi"
job_id: "plane_agnesi_mountain_test_stretched"
toml: [toml/plane_agnesi_mountain_test_stretched.toml]
toml: toml/plane_agnesi_mountain_test_stretched.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ kappa_4: 1.0e6
z_max: 25000.0
topography: "Agnesi"
job_id: "plane_agnesi_mountain_test_uniform"
toml: [toml/plane_agnesi_mountain_test_uniform.toml]
toml: toml/plane_agnesi_mountain_test_uniform.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ kappa_4: 5.0e7
z_max: 25000.0
topography: "Schar"
job_id: "plane_schar_mountain_test_stretched"
toml: [toml/plane_schar_mountain_test_stretched.toml]
toml: toml/plane_schar_mountain_test_stretched.toml
2 changes: 1 addition & 1 deletion config/model_configs/plane_schar_mountain_test_uniform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ kappa_4: 5.0e7
z_max: 25000.0
topography: "Schar"
job_id: "plane_schar_mountain_test_uniform"
toml: [toml/plane_schar_mountain_test_uniform.toml]
toml: toml/plane_schar_mountain_test_uniform.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ regression_test: true
surface_temperature: "ZonallyAsymmetric"
job_id: "sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric"
moist: "equil"
toml: [toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric.toml]
toml: toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_raw_zonallyasymmetric.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ precip_model: "0M"
regression_test: true
job_id: "sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res"
moist: "equil"
toml: [toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.toml]
toml: toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ dt: "40secs"
t_end: "12hours"
job_id: "sphere_baroclinic_wave_rhoe_equilmoist_expvdiff"
moist: "equil"
toml: [toml/sphere_baroclinic_wave_rhoe_equilmoist_expvdiff.toml]
toml: toml/sphere_baroclinic_wave_rhoe_equilmoist_expvdiff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ regression_test: true
viscous_sponge: true
job_id: "sphere_held_suarez_rhoe_equilmoist_hightop_sponge"
moist: "equil"
toml: [toml/sphere_held_suarez_rhoe_equilmoist_hightop_sponge.toml]
toml: toml/sphere_held_suarez_rhoe_equilmoist_hightop_sponge.toml
output_default_diagnostics: true
2 changes: 1 addition & 1 deletion config/perf_configs/flame/perf_gw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ z_max: 45000.0
precip_model: "0M"
job_id: "flame_perf_gw"
moist: "equil"
toml: [toml/flame_perf_gw.toml]
toml: toml/flame_perf_gw.toml
17 changes: 13 additions & 4 deletions src/solver/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -444,10 +444,18 @@ function AtmosConfig(;
default_config_dict()
end
FT = config["FLOAT_TYPE"] == "Float64" ? Float64 : Float32
toml_dict = CP.create_toml_dict(
FT;
override_file = CP.merge_toml_files(config["toml"]),
)

# Check that config["toml"] is a filepath and the file does not exist
if config["toml"] isa AbstractString && !isfile(config["toml"])
@info "Could not find TOML file at path $(joinpath(pwd(), config["toml"]))"
prepend_path = joinpath(dirname(@__FILE__), "..", "..", config["toml"])
if isfile(prepend_path)
@info "Prepending `pkgdir(CA)` to relative TOML file path"
config["toml"] = prepend_path
end
end
toml_dict = CP.create_toml_dict(FT; override_file = config["toml"])

# TODO: is there a better way? We need a better
# mechanism on the ClimaCore side.
if config["trunc_stack_traces"]
Expand All @@ -469,6 +477,7 @@ function AtmosConfig(;
PA = typeof(config)
return AtmosConfig{FT, TD, PA, C}(toml_dict, config, comms_ctx)
end

Base.eltype(::AtmosConfig{FT}) where {FT} = FT

# In order to specify C2F operator boundary conditions with 0 instead of FT(0),
Expand Down

0 comments on commit e22ac86

Please sign in to comment.