Skip to content

Commit

Permalink
Merge #136
Browse files Browse the repository at this point in the history
136: Add error if aliases are not unique r=trontrytel a=nefrathenrici

Content
- Adds a check for unique aliases in `get_values`
- Updates the names of parameters for ClimaAtmos

Co-authored-by: nefrathenrici <nat.henrici@gmail.com>
  • Loading branch information
bors[bot] and nefrathenrici authored Sep 13, 2023
2 parents 514be55 + e5b290d commit 5a107b6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CLIMAParameters"
uuid = "6eacf6c3-8458-43b9-ae03-caf5306d3d53"
authors = ["Climate Modeling Alliance"]
version = "0.7.17"
version = "0.7.18"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
13 changes: 13 additions & 0 deletions src/file_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ function get_values(pd::AliasParamDict, aliases::NAMESTYPE)
data = pd.data
# TODO: use map
ret_values = []
unique_aliases = Dict()
for alias in aliases
for (key, val) in data
alias val["alias"] && continue
Expand All @@ -196,6 +197,18 @@ function get_values(pd::AliasParamDict, aliases::NAMESTYPE)
push!(ret_values, Pair(Symbol(alias), elem))
end
end
# Test that no aliases are duplicated
for (key, val) in data
if haskey(unique_aliases, val["alias"])
push!(unique_aliases[val["alias"]], key)
else
unique_aliases[val["alias"]] = [key]
end
end
for (alias, params) in unique_aliases
length(params) > 1 &&
error("Parameters `$params` have the same alias `$alias`")
end
return ret_values
end

Expand Down
23 changes: 14 additions & 9 deletions src/parameters.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1943,38 +1943,43 @@ alias = "avogad"
value = 6.02214076e23
type = "float"

[bulk_transfer_coeff]
[C_E]
alias = "C_E"
value = 0.0044
type = "float"

description = "bulk transfer coefficient"

# Rayleigh Damping

[rayleigh_sponge_vert_velocity_coeff]
[alpha_rayleigh_w]
alias = "alpha_rayleigh_w"
value = 1.0
type = "float"
description = "rayleigh sponge vert velocity coeff"

[rayleigh_sponge_horz_velocity_coeff]
[alpha_rayleigh_uh]
alias = "alpha_rayleigh_uh"
value = 0.0001
type = "float"
description = "rayleigh sponge horizontal velocity coefficient"

[rayleigh_sponge_height]
[zd_rayleigh]
alias = "zd_rayleigh"
value = 15000.0
type = "float"
description = "rayleigh sponge height"

[viscous_sponge_height]
[zd_viscous]
alias = "zd_viscous"
value = 15000.0
type = "float"
description = "viscous sponge height"

[viscous_sponge_coeff]
[kappa_2_sponge]
alias = "kappa_2_sponge"
value = 1.0e6
type = "float"
description = "viscous sponge coefficient"

# Held-Suarez

Expand Down Expand Up @@ -2022,13 +2027,13 @@ description = "Temperature gradient between equator and pole for moist adiabatic

# EDMF

[EDMF_entrainment_coefficient]
[entr_coeff]
alias = "entr_coeff"
value = 1
type = "float"
description = "TODO: Remove this. Constant entrainment coefficient used for testing EDMF"

[EDMF_detrainment_coefficient]
[detr_coeff]
alias = "detr_coeff"
value = 0.001
type = "float"
Expand Down

2 comments on commit 5a107b6

@nefrathenrici
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/91361

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.18 -m "<description of version>" 5a107b6cf94a300f1371e3c153313c5c1388fe0c
git push origin v0.7.18

Please sign in to comment.