Skip to content

Commit 430fd95

Browse files
author
Nathanael Zhixin Wong
committed
Updating the project notebooks and packages
1 parent 56ac5ef commit 430fd95

File tree

7 files changed

+518
-908
lines changed

7 files changed

+518
-908
lines changed

Project.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ authors = ["Nathanael Wong <natgeo.wong@outlook.com>"]
44

55
[deps]
66
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
7+
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
78
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
89
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
910
DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1"
@@ -12,6 +13,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1213
MakieExtra = "54e234d5-9986-40d8-815f-a5e42de435f6"
1314
MultivariateStats = "6f286f6a-111f-5878-ab1e-185364afe411"
1415
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
16+
PlutoUI = "7f904dfe-b85e-4ff6-b463-dae2292396a8"
1517
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
1618
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
1719
Trapz = "592b5752-818d-11e9-1e9a-2b8ca4a44cd1"

exp/snd/D0642km300V64

Lines changed: 128 additions & 128 deletions
Large diffs are not rendered by default.

exp/snd/D3842km300V64

Lines changed: 128 additions & 128 deletions
Large diffs are not rendered by default.

notebooks/01-rcespinup.jl

Lines changed: 94 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
### A Pluto.jl notebook ###
2-
# v0.20.3
2+
# v0.20.19
33

44
using Markdown
55
using InteractiveUtils
66

77
# This Pluto notebook uses @bind for interactivity. When running this notebook outside of Pluto, the following 'mock version' of @bind gives bound variables a default value (instead of an error).
88
macro bind(def, element)
99
#! format: off
10-
quote
10+
return quote
1111
local iv = try Base.loaded_modules[Base.PkgId(Base.UUID("6e696c72-6542-2067-7265-42206c756150"), "AbstractPlutoDingetjes")].Bonds.initial_value catch; b -> missing; end
1212
local el = $(esc(element))
1313
global $(esc(def)) = Core.applicable(Base.get, el) ? Base.get(el) : iv(el)
@@ -26,13 +26,10 @@ end
2626
# ╔═╡ 46faa412-5ade-11eb-3c37-23a7e59037a0
2727
begin
2828
@quickactivate "ExploreWTGSpace"
29-
using Statistics
3029
using PlutoUI
31-
using Printf
32-
33-
using ImageShow, PNGFiles
34-
using PyCall, LaTeXStrings
35-
pplt = pyimport("proplot")
30+
using Printf, Statistics
31+
using CairoMakie
32+
set_theme!(theme_latexfonts())
3633

3734
include(srcdir("sam.jl"))
3835
include(srcdir("samsnd.jl"))
@@ -65,7 +62,7 @@ There are two broad model configuration categories: (P)erpetual (INSOL)ation, an
6562

6663
# ╔═╡ 427511d0-88cb-11eb-2a40-019c91ee1401
6764
if prefix == "D"
68-
md"Toggle Domain Size: $(@bind dsize PlutoUI.Slider(0:1,default=0))"
65+
md"Toggle Domain Size: $(@bind dsize PlutoUI.Slider(-1:1,default=0))"
6966
else
7067
md"Toggle Domain Size: $(@bind dsize PlutoUI.Slider(-1:0,default=0))"
7168
end
@@ -143,6 +140,7 @@ begin
143140
else
144141
config = "TrainML"
145142
end
143+
# config = "D3842km300V64"
146144
nen = 10
147145

148146
md"**Experiment Set:** $config | **Number of Control Members**: $nen"
@@ -165,7 +163,7 @@ Should the difference in the final averaged sounding profile be vastly different
165163
"
166164

167165
# ╔═╡ 401a6a3a-8444-11eb-3ee8-594591ed5aa9
168-
nendays = 1500
166+
nendays = 1000
169167

170168
# ╔═╡ c658d650-8614-11eb-252c-c3066fb1d506
171169
ptrop = 70
@@ -225,94 +223,111 @@ begin
225223
md"Assuming that the tropopause in the tropics can sometimes reach as high as $ptrop hPa, the root-mean-square of the temperature difference between the model temperature `TABS` and the observed temperature `TABSOBS` below the tropopause is $(trms_en) K (i.e., we take calculate the root-mean-square using only levels where p > $(ptrop) hPa). The profile of the temperature difference is shown below:"
226224
end
227225

228-
# ╔═╡ a3650e8a-822b-11eb-29ca-cd01b90e8099
226+
# ╔═╡ 5ca776cf-30e8-46fa-a9f5-72c25a735205
229227
begin
228+
fig = Figure()
229+
230+
wdt = 75
230231

231-
pplt.close()
232-
fen,aen = pplt.subplots(arr,aspect=1/3,axwidth=0.6,sharex=0,wspace=1)
233-
234-
for im = 1 : nen
235-
aen[1].scatter(tdiff_en[:,im],pts_en[:,im],s=1,c="gray")
236-
end
237-
238-
aen[1].plot(
239-
dropdims(mean(tdiff_en,dims=2),dims=2),
240-
dropdims(mean(pts_en,dims=2),dims=2),c="k"
232+
ax1 = Axis(
233+
fig[1,1],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt,
234+
xlabel=L"$T$ / K",
235+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
236+
xticks=200:100:300,xminorticks=180:20:320,xminorticksvisible=true
241237
)
242-
aen[1].format(
243-
xlim=(-1.5,1.5)./10,xlocator=(-2:2)./10,xlabel=L"T - T$_{OBS}$ / K",
244-
ylim=(1010,25),yscale="log",ylabel="Pressure / hPa",
245-
suptitle="Model Ensemble Equilibrium RCE | $config",ultitle="(a)"
238+
ax2 = Axis(
239+
fig[1,2],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt,
240+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
241+
yticklabelsvisible=false,xlabel=L"$T - T_\text{ref}$ / K",
242+
xticks=(-1:1)./10,xminorticks=(-10:10)./50,xminorticksvisible=true
246243
)
247-
248-
cten = aen[2].pcolormesh(
249-
t_en.-t_en[1],plevel,tdts_en,
250-
# t.-80,p,tem .- mean(tem[:,(end-100+1):end],dims=2),
251-
# t[5:(end-4)].-80,p,temn .- tob[:,1],
252-
cmap="RdBu_r",
253-
extend="both",
254-
levels=lvls/10
244+
ax3 = Axis(
245+
fig[1,3],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt*7,
246+
yticklabelsvisible=false,xlabel="time / days",
247+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
248+
xticks=0:250:2000,xminorticks=0:50:2000,xminorticksvisible=true
249+
)
250+
ax4 = Axis(
251+
fig[2,1],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt,
252+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
253+
xlabel="r / %",xminorticks=0:10:100,xminorticksvisible=true
255254
)
256-
aen[2].format(
257-
xlim=(0,nt_en),
258-
ylim=(1010,25),yscale="log",
259-
ylabel="Pressure / hPa",
260-
urtitle=L"T$_{RMS}$" * " = $(trms_en) K",ultitle="(b)"
255+
ax5 = Axis(
256+
fig[2,2],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt,
257+
yticklabelsvisible=false,xlabel=L"q/q_\text{OBS}-1 / %",
258+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
259+
xticks=(-1:1),xminorticks=(-10:10)./5,xminorticksvisible=true
261260
)
261+
ax6 = Axis(
262+
fig[2,3],height=wdt*3,yscale=log10,yticks=[10,100,1000],width=wdt*7,
263+
yticklabelsvisible=false,xlabel="time / days",
264+
yminorticks=vcat(10:10:90,100:100:1000),yminorticksvisible=true,
265+
xticks=0:250:2000,xminorticks=0:50:2000,xminorticksvisible=true
266+
)
267+
262268

269+
xlims!(ax2,-0.15,0.15)
270+
xlims!(ax1,180,320)
271+
xlims!(ax5,-1.5,1.5)
272+
xlims!(ax4,0,100)
273+
274+
ylims!(ax1,1000,25)
275+
ylims!(ax2,1000,25)
276+
ylims!(ax3,1000,25)
277+
ylims!(ax4,1000,25)
278+
ylims!(ax5,1000,25)
279+
ylims!(ax6,1000,25)
280+
263281
for im = 1 : nen
264-
aen[3].scatter(qdiff_en[:,im],pts_en[:,im],s=1,c="gray")
282+
scatter!(ax2,tdiff_en[:,im],pts_en[:,im],markersize=5,color=:gray)
265283
end
266-
267-
aen[3].plot(
268-
dropdims(mean(qdiff_en,dims=2),dims=2),
269-
dropdims(mean(pts_en,dims=2),dims=2),c="k"
284+
lines!(ax2,
285+
dropdims(mean(tdiff_en,dims=2),dims=2),
286+
dropdims(mean(pts_en,dims=2),dims=2),color=:black
270287
)
271-
aen[3].format(
272-
xlim=(-1.5,1.5),xlocator=(-2:2),
273-
xlabel=L"qr = $\frac{q - q_{OBS}}{q_{OBS}}$ / %",
274-
ylim=(1010,25),yscale="log",ylabel="Pressure / hPa",ultitle="(c)"
288+
289+
for im = 1 : nen
290+
scatter!(ax1,tabs_en[:,im],pts_en[:,im],markersize=5,color=:gray)
291+
end
292+
lines!(ax1,
293+
dropdims(mean(tabs_en,dims=2),dims=2),
294+
dropdims(mean(pts_en,dims=2),dims=2),color=:black
275295
)
276296

277-
cqen = aen[4].pcolormesh(
278-
t_en.-t_en[1],plevel,qdts_en,
279-
# t.-80,p,qvp .- mean(qvp[:,(end-100+1):end],dims=2),
280-
cmap="drywet",
281-
extend="both",
282-
levels=lvls
283-
)
284-
aen[4].format(
285-
xlim=(0,nt_en),
286-
ylim=(1010,25),yscale="log",
287-
xlabel="time / days",ylabel="Pressure / hPa",
288-
urtitle=L"$qr_{RMS}$" * " = $(qrms_en) %",ultitle="(d)"
297+
c1 = heatmap!(ax3,
298+
t_en,plevel,tdts_en',
299+
colormap=:balance,colorrange=(-0.2,0.2)
289300
)
290-
301+
text!(ax3,0.98*length(t_en),30,text="RMS = $(trms_en) K",align=(:right,:top))
302+
291303
for im = 1 : nen
292-
aen[5].scatter(tabs_en[:,im],pts_en[:,im],s=2,c="gray")
304+
scatter!(ax5,qdiff_en[:,im],pts_en[:,im],markersize=5,color=:gray)
293305
end
294-
295-
aen[5].plot(
296-
dropdims(mean(tabs_en,dims=2),dims=2),
297-
dropdims(mean(pts_en,dims=2),dims=2),c="k"
306+
lines!(ax5,
307+
dropdims(mean(qdiff_en,dims=2),dims=2),
308+
dropdims(mean(pts_en,dims=2),dims=2),color=:black
298309
)
299-
aen[5].format(xlim=(180,320),xlabel="T / K")
300-
310+
301311
for im = 1 : nen
302-
aen[6].scatter(relh_en[:,im],pts_en[:,im],s=2,c="gray")
312+
scatter!(ax4,relh_en[:,im],pts_en[:,im],markersize=5,color=:gray)
303313
end
304-
305-
aen[6].plot(
314+
lines!(ax4,
306315
dropdims(mean(relh_en,dims=2),dims=2),
307-
dropdims(mean(pts_en,dims=2),dims=2),c="k"
316+
dropdims(mean(pts_en,dims=2),dims=2),color=:black
308317
)
309-
aen[6].format(xlim=(0,120),xlabel="r / %")
310-
311-
aen[2].colorbar(cten,loc="r",width=0.2)
312-
aen[4].colorbar(cqen,loc="r",width=0.2)
313-
fen.savefig(plotsdir("01a-ensemble-$(config).png"),transparent=false,dpi=400)
314-
load(plotsdir("01a-ensemble-$(config).png"))
315318
319+
c2 = heatmap!(ax6,
320+
t_en,plevel,qdts_en',
321+
colormap=:BrBg,colorrange=(-2.5,2.5)
322+
)
323+
text!(ax6,0.98*length(t_en),30,text="RMS = $(qrms_en) %",align=(:right,:top))
324+
325+
Colorbar(fig[1,4], c1,)
326+
Colorbar(fig[2,4], c2,)
327+
Label(fig[:,0],"Pressure / hPa",rotation=pi/2)
328+
329+
resize_to_layout!(fig)
330+
fig
316331
end
317332

318333
# ╔═╡ 11913f26-8e7c-11eb-1b37-0f9c8e7b7331
@@ -377,12 +392,12 @@ end
377392
# ╟─ac8b9d4c-5ade-11eb-06f4-33bff063bbde
378393
# ╟─7842e150-822b-11eb-1ded-f35ee4cc6d8c
379394
# ╟─99dca670-81e5-11eb-24b8-cf1b23d8c1f7
380-
# ╟─401a6a3a-8444-11eb-3ee8-594591ed5aa9
395+
# ╠═401a6a3a-8444-11eb-3ee8-594591ed5aa9
381396
# ╠═c658d650-8614-11eb-252c-c3066fb1d506
382397
# ╟─7d905176-81e8-11eb-20d3-b9be287472f5
383398
# ╟─ad523b4e-81ee-11eb-2d10-a984d5983471
384399
# ╟─f35ab14c-8226-11eb-29b4-c3b7130f3733
385-
# ╟─a3650e8a-822b-11eb-29ca-cd01b90e8099
400+
# ╟─5ca776cf-30e8-46fa-a9f5-72c25a735205
386401
# ╟─11913f26-8e7c-11eb-1b37-0f9c8e7b7331
387402
# ╟─caf84abe-581d-4859-baf5-81c75d133fd4
388403
# ╟─4db59bf0-82ec-11eb-0374-81a982a74216

0 commit comments

Comments
 (0)