-
Notifications
You must be signed in to change notification settings - Fork 12
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 #60 from gaelforget/v0p2p22
V0p2p22
- Loading branch information
Showing
2 changed files
with
69 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "MeshArrays" | ||
uuid = "cb8c808f-1acf-59a3-9d2b-6e38d009f683" | ||
authors = ["gaelforget <[email protected]>"] | ||
version = "0.2.21" | ||
version = "0.2.22" | ||
|
||
[deps] | ||
CatViews = "81a5f4ea-a946-549a-aa7e-2a7f63a27d31" | ||
|
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,68 @@ | ||
|
||
#possible issues | ||
#1. intermediate yy needed; MeshArrays errors otherwise | ||
#2. lack of exch_z, which would allow using corner points | ||
#4. Float32 / Float64 dispatch may be an issue in e.g. | ||
# `pi/2 .-Γ.YC*pi/180` | ||
|
||
# XC=γ.read(γ.write(Γ.XC),MeshArray(γ,Float64)) | ||
# YC=γ.read(γ.write(Γ.YC),MeshArray(γ,Float64)) | ||
|
||
using GLMakie | ||
|
||
""" | ||
plot_as_sphere(Γ) | ||
Plot mesh (Γ.XC,Γ.YC) and depth (Γ.Depth) on the surface of the sphere in 3D. | ||
""" | ||
function plot_as_sphere(Γ) | ||
yy=pi/2 .-Γ.YC*pi/180 | ||
x=sin.(yy)*cos.(Γ.XC*pi/180) | ||
y=sin.(yy)*sin.(Γ.XC*pi/180) | ||
z=cos.(yy) | ||
d=Γ.Depth | ||
crng=(minimum(d),maximum(d)) | ||
minimum(d)==maximum(d) ? crng=(0.9*crng[1],1.1*crng[1]) : nothing | ||
|
||
c=[:gold,:magenta,:DeepSkyBlue,:cyan,:red,:black] | ||
az=Node(0.4π) | ||
el=Node(0.2π) | ||
fig = Figure(resolution = (900,900), backgroundcolor = :grey90) | ||
ax = Axis3(fig, aspect = :data, viewmode = :fitzoom, #perspectiveness = 0.5, | ||
azimuth = az, elevation = el,) | ||
for i=1:length(z.fSize) | ||
surface!(ax, x[i], y[i], z[i], color = d[i], colorrange = crng, colormap = :grays) | ||
wireframe!(x[i],y[i],z[i], overdraw = false, linewidth = 0.25,color=c[i]) | ||
end | ||
#hidedecorations!(ax) | ||
#hidespines!(ax) | ||
fig[1,1] = ax | ||
fig | ||
end | ||
|
||
""" | ||
plot_as_plane(Γ) | ||
Plot mesh (Γ.XC,Γ.YC) and depth (Γ.Depth) pn a 2D plane. | ||
""" | ||
function plot_as_plane(Γ) | ||
x=Float64.(Γ.XC) | ||
y=Float64.(Γ.YC) | ||
z=0*y | ||
d=Float64.(Γ.Depth) | ||
crng=(minimum(d),maximum(d)) | ||
minimum(d)==maximum(d) ? crng=(0.9*crng[1],1.1*crng[1]) : nothing | ||
|
||
c=[:magenta,:gold,:blue,:cyan,:red,:black] | ||
fig = Figure(resolution = (900,900), backgroundcolor = :grey90) | ||
ax = Axis3(fig[1,1]) | ||
for i=1:length(x.fSize) | ||
surface!(ax, x[i], y[i], z[i], color = d[i], colorrange = crng, colormap = :grays) | ||
#contourf!(x[i], y[i], d[i], colorrange = (0.0, 5e3), colormap = :grays) | ||
wireframe!(x[i],y[i], z[i], overdraw = false, linewidth = 0.25,color=c[i]) | ||
end | ||
#hidedecorations!(ax) | ||
#hidespines!(ax) | ||
fig[1,1] = ax | ||
fig | ||
end |