|
5 | 5 | @testitem "velocities and mass transports" setup=[LocalBuiltMatrix] tags=[:skipci] begin
|
6 | 6 |
|
7 | 7 | using NaNStatistics
|
8 |
| - using GLMakie |
| 8 | + using CairoMakie |
9 | 9 |
|
10 | 10 | (; gridmetrics, indices, ρ, v3D, lat, lon, zt, uo, vo, uo_lon, uo_lat, vo_lon, vo_lat,
|
11 | 11 | lon_vertices, lat_vertices, indices,
|
|
14 | 14 |
|
15 | 15 |
|
16 | 16 | # plot for sanity check
|
17 |
| - begin # plot zonal average density |
18 |
| - ρ2D = dropdims(nansum(ρ .* v3D, dims = 1) ./ nansum(v3D, dims = 1), dims = 1) |
19 |
| - fig = Figure() |
20 |
| - ax = Axis(fig[1,1], xlabel = "latitude (°)", ylabel = "depth (m)") |
21 |
| - # levels = 25:0.1:30 |
22 |
| - colormap = :viridis |
23 |
| - # co = contourf!(ax, dropdims(maximum(lat |> Array, dims=1), dims=1), zt |> Array, Γ2D; levels, colormap) |
24 |
| - co = contourf!(ax, dropdims(maximum(lat |> Array, dims=1), dims=1), zt |> Array, ρ2D; colormap) |
25 |
| - ρunit = rich("kg m", superscript("−3")) |
26 |
| - cb = Colorbar(fig[1, 2], co; label = rich("Density (", ρunit, ")"), tellheight = false) |
27 |
| - cb.height = Relative(2/3) |
28 |
| - ylims!(ax, (6000, 0)) |
29 |
| - Label(fig[0,1], text = "$model $member Density", tellwidth = false) |
30 |
| - fig |
31 |
| - end |
| 17 | + # plot zonal average density |
| 18 | + ρ2D = dropdims(nansum(ρ.data .* v3D, dims = 1) ./ nansum(v3D, dims = 1), dims = 1) |
| 19 | + fig = Figure() |
| 20 | + ax = Axis(fig[1,1], xlabel = "latitude (°)", ylabel = "depth (m)") |
| 21 | + # levels = 25:0.1:30 |
| 22 | + colormap = :viridis |
| 23 | + # co = contourf!(ax, dropdims(maximum(lat |> Array, dims=1), dims=1), zt |> Array, Γ2D; levels, colormap) |
| 24 | + co = contourf!(ax, dropdims(maximum(lat |> Array, dims=1), dims=1), zt |> Array, ρ2D; colormap) |
| 25 | + ρunit = rich("kg m", superscript("−3")) |
| 26 | + cb = Colorbar(fig[1, 2], co; label = rich("Density (", ρunit, ")"), tellheight = false) |
| 27 | + cb.height = Relative(2/3) |
| 28 | + ylims!(ax, (6000, 0)) |
| 29 | + Label(fig[0,1], text = "$model $member Density", tellwidth = false) |
| 30 | + |
32 | 31 | outputfile = joinpath(outputdir, "rho_$model.png")
|
33 | 32 | @info "Saving density zonal average as image file:\n $(joinpath("test", outputfile))"
|
34 | 33 | save(outputfile, fig)
|
@@ -110,29 +109,14 @@ end
|
110 | 109 | end
|
111 | 110 | end
|
112 | 111 |
|
113 |
| -@testitem "Test flux divergence" setup=[LocalBuiltMatrix] tags=[:skipci] begin |
114 |
| - |
115 |
| - using SparseArrays |
116 |
| - using LinearAlgebra |
117 |
| - |
118 |
| - # unpack transport matrices |
119 |
| - (; T) = LocalBuiltMatrix |
120 |
| - |
121 |
| - # tests if diagonal elements are > 0 and off-diagonal are < 0. |
122 |
| - diagT = sparse(Diagonal(T)) |
123 |
| - @test all(diagT.nzval .> 0) |
124 |
| - @test all((T - diagT).nzval .< 0) |
125 |
| - |
126 |
| -end |
127 |
| - |
128 | 112 | @testitem "Ideal age (coarsened)" setup=[LocalBuiltMatrix] tags=[:skipci] begin
|
129 | 113 |
|
130 | 114 | using SparseArrays
|
131 | 115 | using LinearAlgebra
|
132 | 116 | using Unitful
|
133 | 117 | using Unitful: s, yr
|
134 | 118 | using NaNStatistics
|
135 |
| - using GLMakie |
| 119 | + using CairoMakie |
136 | 120 |
|
137 | 121 | (; gridmetrics, indices, T, model, member, outputdir) = LocalBuiltMatrix
|
138 | 122 |
|
|
158 | 142 | issrf_c = LUMP * issrf .> 0
|
159 | 143 | M_c = sparse(Diagonal(issrf_c))
|
160 | 144 | sΓ_c = LUMP * sΓ
|
161 |
| - @info "Solving ideal mean age" |
162 |
| - Γ_c = (T_c + M_c) \ sΓ_c |
| 145 | + @time "Solving ideal mean age" Γ_c = (T_c + M_c) \ sΓ_c |
163 | 146 | Γ = SPRAY * Γ_c
|
164 | 147 | Γyr = ustrip.(yr, Γ .* s)
|
165 | 148 | Γ3D = OceanTransportMatrixBuilder.as3D(Γyr, wet3D)
|
|
185 | 168 |
|
186 | 169 | @testitem "mass transport vs velocity checks" setup=[LocalBuiltMatrix] tags=[:skipci] begin
|
187 | 170 |
|
188 |
| - using GLMakie |
| 171 | + using CairoMakie |
189 | 172 | using Makie.StructArrays
|
190 | 173 |
|
191 | 174 | outputdir = LocalBuiltMatrix.outputdir
|
|
0 commit comments