Skip to content

Commit

Permalink
clean up plots
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Feb 10, 2025
1 parent 3be9828 commit dbbb516
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 44 deletions.
32 changes: 22 additions & 10 deletions docs/tutorials/standalone/Soil/freezing_front.jl
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,15 @@ mask_12h = hours .== 12
mask_24h = hours .== 24
mask_50h = hours .== 50;

fig = Figure(size = (900, 300))
fig = Figure(size = (1500, 500), fontsize = 36)
ax1 = Axis(
fig[1, 1],
title = "12 hours",
xlabel = L"θ_l + θ_i",
ylabel = "Soil depth (m)",
ylabel = "Depth (m)",
xgridvisible = false,
ygridvisible = false,
xticks = (0.2:0.1:0.4, ["0.2", "0.3", "0.4"]),
)
limits!(ax1, 0.2, 0.5, -0.2, 0.0)
ax2 = Axis(
Expand All @@ -268,6 +271,9 @@ ax2 = Axis(
xlabel = L"θ_l + θ_i",
yticksvisible = false,
yticklabelsvisible = false,
xgridvisible = false,
ygridvisible = false,
xticks = (0.2:0.1:0.4, ["0.2", "0.3", "0.4"]),
)
limits!(ax2, 0.2, 0.5, -0.2, 0.0)
ax3 = Axis(
Expand All @@ -276,40 +282,46 @@ ax3 = Axis(
xlabel = L"θ_l + θ_i",
yticksvisible = false,
yticklabelsvisible = false,
xgridvisible = false,
ygridvisible = false,
xticks = (0.2:0.1:0.4, ["0.2", "0.3", "0.4"]),
)
limits!(ax3, 0.2, 0.5, -0.2, 0.0)


z = parent(coords.subsurface.z)[:];

scatter!(ax1, vwc[mask_12h], -depth[mask_12h], label = "", color = "purple")
scatter!(ax1, vwc[mask_12h], -depth[mask_12h], label = "", color = "orange")
lines!(
ax1,
parent(sol.u[13].soil.ϑ_l .+ sol.u[13].soil.θ_i)[:],
z,
label = "",
color = :green,
color = :blue,
linewidth = 3,
)


scatter!(ax2, vwc[mask_24h], -depth[mask_24h], label = "", color = "purple")
scatter!(ax2, vwc[mask_24h], -depth[mask_24h], label = "", color = "orange")
lines!(
ax2,
parent(sol.u[25].soil.ϑ_l .+ sol.u[25].soil.θ_i)[:],
z,
label = "",
color = :green,
color = :blue,
linewidth = 3,
)

scatter!(ax3, vwc[mask_50h], -depth[mask_50h], label = "Data", color = "purple")
scatter!(ax3, vwc[mask_50h], -depth[mask_50h], label = "Data", color = "orange")
lines!(
ax3,
parent(sol.u[51].soil.ϑ_l .+ sol.u[51].soil.θ_i)[:],
z,
label = "Simulation",
color = :green,
label = "Model",
color = :blue,
linewidth = 3,
)
axislegend(ax3, position = :rb)
axislegend(ax3, position = :rb, framevisible = false)

save("mizoguchi_data_comparison.png", fig);
# ![](mizoguchi_data_comparison.png)
Expand Down
22 changes: 16 additions & 6 deletions docs/tutorials/standalone/Soil/phase_change_analytic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,13 +212,21 @@ sol = SciMLBase.solve(
);
sol_T = parent(sv.saveval[end].soil.T)[:]

fig = Figure(size = (300, 300))
ax1 = Axis(fig[1, 1], title = "", xlabel = L"T (K)", ylabel = "Soil depth (m)")
fig = Figure(size = (500, 500), fontsize = 24)
ax1 = Axis(
fig[1, 1],
title = "",
xlabel = "T (K)",
ylabel = "Depth (m)",
xgridvisible = false,
ygridvisible = false,
xticks = 263:3:275,
)
limits!(ax1, 262, 276, -3, 0.0)

z = parent(coords.subsurface.z)[:];

lines!(ax1, sol_T, z, label = "Simulation", color = :green)
lines!(ax1, sol_T, z, label = "Model", color = :blue, linewidth = 3)

# # Analytic Solution of Neumann
# All details here are taken from [DallAmico2011](@cite) (see also [CarslawJaeger](@cite)), and the reader is referred to that
Expand Down Expand Up @@ -320,15 +328,17 @@ lines!(
T_frozen[mask_frozen],
-1 .* depth[mask_frozen],
label = "Analytic Solution",
color = "purple",
color = "orange",
linewidth = 3,
)
lines!(
ax1,
T_unfrozen[mask_unfrozen],
-1 .* depth[mask_unfrozen],
color = "purple",
color = "orange",
linewidth = 3,
)
axislegend(ax1, position = :lb)
axislegend(ax1, position = :lb, framevisible = false)

save("phase_change_analytic.png", fig);
# ![](phase_change_analytic.png)
Expand Down
56 changes: 28 additions & 28 deletions experiments/standalone/Snow/snowmip_simulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ CairoMakie.scatter!(
seconds[mass_data_avail] ./ 24 ./ 3600,
SWE,
label = "Data",
color = :red,
color = :orange,
)
CairoMakie.axislegend(ax1, position = :rt)

Expand All @@ -204,7 +204,7 @@ CairoMakie.scatter!(
mean_obs_df.doy,
mean_obs_df.obs_swe,
label = "Data",
color = :red,
color = :orange,
)
CairoMakie.save(joinpath(savedir, "snow_water_content_$(SITE_NAME).png"), fig)

Expand All @@ -223,7 +223,7 @@ CairoMakie.scatter!(
seconds[mass_data_avail] ./ 24 ./ 3600,
T_snow .+ 273.15,
label = "Snow T",
color = :red,
color = :orange,
)
CairoMakie.scatter!(
ax1,
Expand Down Expand Up @@ -257,7 +257,7 @@ CairoMakie.scatter!(
mean_obs_df.doy,
mean_obs_df.obs_tsnow,
label = "Data",
color = :red,
color = :orange,
)
CairoMakie.save(joinpath(savedir, "snow_energy_content_$(SITE_NAME).png"), fig)

Expand Down Expand Up @@ -366,58 +366,58 @@ CairoMakie.save(joinpath(savedir, "conservation_$(SITE_NAME).png"), fig)

# Paper plot

fig = CairoMakie.Figure(size = (1100, 1400), fontsize = 26)
fig = CairoMakie.Figure(size = (1100, 1400), fontsize = 36)
# set limits
ax1 = CairoMakie.Axis(fig[1, 1], ylabel = "SWE (m)")
ax1 = CairoMakie.Axis(
fig[1, 1],
ylabel = "SWE (m)",
xgridvisible = false,
ygridvisible = false,
)

xlims!(ax1, 0, ndays)
CairoMakie.hidexdecorations!(ax1, ticks = false)
CairoMakie.lines!(ax1, daily, S, label = "Model S")
CairoMakie.lines!(ax1, daily, S_l, label = "Model S_l")
CairoMakie.lines!(ax1, daily, S, color = :blue, linewidth = 3, label = "Model")
#CairoMakie.lines!(ax1, daily, S_l, label = "S_l", color=:blue, linewidth=3)
CairoMakie.scatter!(
ax1,
seconds[mass_data_avail] ./ 24 ./ 3600,
SWE,
label = "Data S",
color = :red,
label = "Data",
color = :orange,
)
ax2 = CairoMakie.Axis(
fig[2, 1],
ylabel = "Depth (m)",
xgridvisible = false,
ygridvisible = false,
)
CairoMakie.axislegend(ax1, position = :rt)
ax2 = CairoMakie.Axis(fig[2, 1], ylabel = "Depth (m)")

xlims!(ax2, 0, ndays)
CairoMakie.hidexdecorations!(ax2, ticks = false)
CairoMakie.lines!(ax2, daily, z, label = "Model z")
CairoMakie.lines!(ax2, daily, z, color = :blue, linewidth = 3)
CairoMakie.scatter!(
ax2,
seconds[mass_data_avail] ./ 24 ./ 3600,
FT.(depths),
label = "Data z",
color = :red,
color = :orange,
)
CairoMakie.axislegend(ax2, position = :rt)
s = "$(start_date)"

ax3 = CairoMakie.Axis(
fig[3, 1],
ylabel = "Temperature (K)",
xlabel = "Days since $(s[1:10])",
xgridvisible = false,
ygridvisible = false,
)
CairoMakie.lines!(ax3, daily, T, label = "Model")
CairoMakie.lines!(
ax3,
daily,
zeros(length(daily)) .+ 273.15,
label = "Freezing Temperature",
color = :purple,
linestyle = :dot,
)
CairoMakie.lines!(ax3, daily, T, color = :blue, linewidth = 3)
CairoMakie.scatter!(
ax3,
seconds[mass_data_avail] ./ 24 ./ 3600,
FT.(T_snow) .+ 273.15,
label = "Data",
color = :red,
color = :orange,
)
xlims!(ax3, 0, ndays)
CairoMakie.axislegend(ax3, position = :rt)
CairoMakie.axislegend(ax1, position = :rt, framevisible = false)
CairoMakie.save(joinpath(savedir, "data_comparison_$(SITE_NAME).png"), fig)

0 comments on commit dbbb516

Please sign in to comment.