Skip to content

Commit 796626f

Browse files
Merge pull request #1228 from CliMA/ne/hotfix
Prepend coupler pkgdir to all coupler TOML files
2 parents a4d7d7d + caf3763 commit 796626f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ ClimaCoupler.jl Release Notes
66

77
### ClimaCoupler features
88

9+
#### Add support for relative parameter filepaths PR[#1228](https://github.com/CliMA/ClimaCoupler.jl/pull/1228)
10+
Changed TOML parameter file handling to prepend the `pkgdir(ClimaCoupler)`
11+
if no file is found at the relative filepath. Before this change, all files
12+
were assumed to be within the `ClimaCoupler` or `ClimaAtmos` repositories.
13+
914
#### Add support for parameter files in `BucketSimulation` PR[#1217](https://github.com/CliMA/ClimaCoupler.jl/pull/1217)
1015
Add a keyword argument `parameter_files` to `BucketSimulation` to enable
1116
calibration in a coupled simulation, passed via the `"coupler_toml"` argument.

experiments/ClimaEarth/components/atmosphere/climaatmos.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,11 @@ function get_atmos_config_dict(coupler_dict::Dict, job_id::String, atmos_output_
447447
end
448448

449449
# use atmos toml if coupler toml is not defined
450-
atmos_toml = joinpath.(pkgdir(CA), atmos_config["toml"])
451-
coupler_toml = joinpath.(pkgdir(ClimaCoupler), coupler_dict["coupler_toml"])
450+
# If we can't find the file at the relative path, prepend pkgdir(ClimaAtmos)
451+
atmos_toml = map(atmos_config["toml"]) do file
452+
isfile(file) ? file : joinpath(pkgdir(CA), file)
453+
end
454+
coupler_toml = atmos_config["coupler_toml"]
452455
toml = isempty(coupler_toml) ? atmos_toml : coupler_toml
453456
if !isempty(toml)
454457
@info "Overwriting Atmos parameters from input TOML file(s): $toml"

experiments/ClimaEarth/user_io/arg_parsing.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ function get_coupler_args(config_dict::Dict)
5959
FT = config_dict["FLOAT_TYPE"] == "Float64" ? Float64 : Float32
6060

6161
# Vector of TOML files containing model parameters
62-
parameter_files = config_dict["coupler_toml"]
62+
parameter_files = map(config_dict["coupler_toml"]) do file
63+
isfile(file) ? file : joinpath(pkgdir(ClimaCoupler), file)
64+
end
6365

6466
# Time information
6567
t_end = Float64(Utilities.time_to_seconds(config_dict["t_end"]))

0 commit comments

Comments
 (0)