using ICOW.EAD
config = EADConfig()
# Metadata: (symbol, category, units, description)
meta = Dict(
:V_city => (raw"$V_{\text{city}}$", "Geometry", "USD", "Total replacement value of all city infrastructure and buildings"),
:H_bldg => (raw"$H_{\text{bldg}}$", "Geometry", "m", "Average building height, used to normalize resistance costs per floor"),
:H_city => (raw"$H_{\text{city}}$", "Geometry", "m", "Total elevation change from the seawall to the highest point of the city"),
:D_city => (raw"$D_{\text{city}}$", "Geometry", "m", "Horizontal distance from the seawall to the city's peak elevation"),
:W_city => (raw"$W_{\text{city}}$", "Geometry", "m", "Length of the coastline along which the seawall and dike are built"),
:H_seawall => (raw"$H_{\text{seawall}}$", "Geometry", "m", "Height of the existing seawall; surges below this cause no flooding"),
:D_startup => (raw"$D_{\text{startup}}$", "Dike", "m", "Minimum effective dike height representing fixed mobilization costs (added to D)"),
:w_d => (raw"$w_d$", "Dike", "m", "Width of the flat top of the dike cross-section"),
:s_dike => (raw"$s$", "Dike", "m/m", raw"Dike side slope parameter (horizontal run per unit rise = $1/s^2$)"),
:c_d => (raw"$c_d$", "Dike", "USD/m³", "Unit cost of dike construction per cubic meter"),
:r_prot => (raw"$r_{\text{prot}}$", "Zones", "--", "Value multiplier for dike-protected land (Zone 3)"),
:r_unprot => (raw"$r_{\text{unprot}}$", "Zones", "--", "Value multiplier for unprotected land (Zones 1--2)"),
:f_w => (raw"$f_w$", "Withdrawal", "--", "Scales the cost of relocating buildings and infrastructure from the withdrawn zone"),
:f_l => (raw"$f_l$", "Withdrawal", "--", "Fraction of city value permanently lost per meter of withdrawal height"),
:f_adj => (raw"$f_{\text{adj}}$", "Resistance", "--", "Overall multiplier on resistance costs (present in C++ but not prominent in paper)"),
:f_lin => (raw"$f_{\text{lin}}$", "Resistance", "--", raw"Weight of the linear component of resistance cost as a function of $P$"),
:f_exp => (raw"$f_{\text{exp}}$", "Resistance", "--", raw"Weight of the exponential component that makes high $P$ values increasingly expensive"),
:t_exp => (raw"$t_{\text{exp}}$", "Resistance", "--", raw"Threshold of $P$ above which the exponential cost component activates"),
:b_basement => (raw"$b$", "Resistance", "m", "Depth of basements below ground; flood-proofing must extend this far below the surface"),
:f_damage => (raw"$f_{\text{damage}}$", "Damage", "--", "Maximum fraction of a zone's value destroyed when fully inundated"),
:f_intact => (raw"$f_{\text{intact}}$", "Damage", "--", "Damage multiplier for Zone 3 when the dike holds (seepage and wave overtopping)"),
:f_failed => (raw"$f_{\text{failed}}$", "Damage", "--", "Damage multiplier for Zone 3 when the dike fails (amplified by sudden breach flooding)"),
:t_fail => (raw"$t_{\text{fail}}$", "Damage", "--", raw"Fraction of dike height $D$ at which failure probability begins to rise above $p_{\text{min}}$"),
:p_min => (raw"$p_{\text{min}}$", "Damage", "--", "Baseline probability of dike failure even when surge is well below the dike crest"),
:f_runup => (raw"$f_{\text{runup}}$", "Damage", "--", "Multiplier on raw surge height to account for wave runup effects at the seawall"),
:d_thresh => (raw"$d_{\text{thresh}}$", "Threshold", "USD", "Damage level above which cascading societal effects amplify losses"),
:f_thresh => (raw"$f_{\text{thresh}}$", "Threshold", "--", raw"Scales the excess damage above $d_{\text{thresh}}$ before applying the power-law penalty"),
:gamma_thresh => (raw"$\gamma_{\text{thresh}}$", "Threshold", "--", "Exponent of the power-law penalty applied to excess damage above the threshold"),
)
# Emit a Markdown table so Quarto renders the math
header = "| Category | Symbol | Field | Default | Units | Description |"
sep = "|----------|--------|-------|---------|-------|-------------|"
println(header)
println(sep)
for fn in fieldnames(EADConfig)
haskey(meta, fn) || continue
sym, cat, units, desc = meta[fn]
val = getfield(config, fn)
println("| $cat | $sym | `$fn` | $val | $units | $desc |")
end
println()
println(": {tbl-colwidths=\"[10,12,10,8,6,54]\"}")