-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from anowacki/SC-REM
Add SC-REM models of Kemper et al. (2023)
- Loading branch information
Showing
13 changed files
with
2,691 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Test the implementation of SC_REM_* models by repdroducing Figure 4 | ||
# of Kemper et al. (2023) | ||
|
||
using SeisModels | ||
import Plots | ||
|
||
function ribbon(xs, y1s, y2s) | ||
[xs; reverse(xs); xs[begin]], [y1s; reverse(y2s); y1s[begin]] | ||
end | ||
|
||
function ribbon_plot!(p, xs, y1s, y2s; kwargs...) | ||
x, y = ribbon(xs, y1s, y2s) | ||
Plots.plot!(p, Plots.Shape(y, x); kwargs...) | ||
end | ||
|
||
function ribbon_plot!(p, f, m1::SeisModels.SeisModel, m2::SeisModels.SeisModel, rs; kwargs...) | ||
vals1 = f.(m1, rs) | ||
vals2 = f.(m2, rs) | ||
ribbon_plot!(p, r, vals1, vals2; kwargs...) | ||
end | ||
|
||
ribbon_plot(args...; kwargs...) = ribbon_plot!(Plots.plot(), args...; kwargs...) | ||
|
||
rs = 0:6371 | ||
prem_colour = :red | ||
|
||
ps = Plots.Plot[] | ||
for f in (density, vp, vs, Qμ) | ||
p = f == density ? Plots.plot() : | ||
f == Qμ ? Plots.plot(xaxis=:log10, xlim=(80, 1e5), legend=false) : | ||
Plots.plot(yticks=nothing, legend=false) | ||
push!(ps, p) | ||
for (low, high, color) in ((SC_REM_75_LOW, SC_REM_75_HIGH, :lightblue), | ||
(SC_REM_50_LOW, SC_REM_50_HIGH, :blue), | ||
(SC_REM_25_LOW, SC_REM_25_HIGH, :darkblue)) | ||
ribbon_plot!(ps[end], f, low, high, rs; | ||
label="", fillcolor=color, title=f) | ||
end | ||
# Prem | ||
Plots.plot!(ps[end], f.(PREM, rs), rs, lc=prem_colour, ls=:dash, label="PREM") | ||
end | ||
Plots.plot(ps...; layout=(1, length(ps)), size=(800,400)) |> display |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# Generate the SC-REM models | ||
|
||
let data_path = joinpath(@__DIR__, "..", "..", "data", "Earth", "SC_REM") | ||
for percent in (25, 50, 75), high_low in ("high", "low") | ||
model_file = joinpath(data_path, "screm-$(percent)p-$(high_low).dat") | ||
model_data = readdlm(model_file, ',', Float64; skipstart=1) | ||
|
||
r = model_data[:,1] | ||
ρ = model_data[:,3] | ||
vp = model_data[:,4] | ||
vs = model_data[:,5] | ||
Qκ = model_data[:,6] | ||
Qμ = model_data[:,7] | ||
|
||
lower_upper = high_low == "high" ? "Upper" : "Lower" | ||
|
||
model = Symbol(:SC_REM_, percent, :_, uppercase(high_low)) | ||
model_name = String(model) | ||
|
||
@eval begin | ||
""" | ||
# `$($model_name)` | ||
$($lower_upper) bound of the $($percent)% credible interval of the SC-REM model of | ||
Kemper et al. (2023). | ||
See also: | ||
[`SC_REM_25_LOW`](@ref), | ||
[`SC_REM_25_HIGH`](@ref), | ||
[`SC_REM_50_LOW`](@ref), | ||
[`SC_REM_50_HIGH`](@ref), | ||
[`SC_REM_75_LOW`](@ref), | ||
[`SC_REM_75_HIGH`](@ref). | ||
## References | ||
- Kemper, J., Khan, A., Helffrich, G., van Driel, M., Giardini, D., 2023. | ||
Self-consistent models of Earth’s mantle and core from long-period seismic and tidal constraints. | ||
Geophys J Int 235, 690–717. | ||
https://doi.org/10.1093/gji/ggad254 | ||
- Kemper, J., Khan, A., Helffrich, G., Giardini, D., 2023. | ||
Self-consistent models of Earth's mantle and core from long-period seismic and tidal constraints (0.2) [Data set]. | ||
Zenodo. | ||
https://doi.org/10.5281/zenodo.10037465 | ||
""" | ||
const $model = LinearLayeredModel( | ||
r = $r, | ||
vp = $vp, | ||
vs = $vs, | ||
density = $ρ, | ||
Qκ = $Qκ, | ||
Qμ = $Qμ | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters