From a83c8158f918f490057a5d8978eb1e89e7002405 Mon Sep 17 00:00:00 2001 From: Aaron Kaw Date: Mon, 12 Aug 2024 00:56:19 +1000 Subject: [PATCH] Added more demonstrations --- demo/Manifest.toml | 20 ++++++++++++- demo/Project.toml | 1 + demo/fan.jl | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 demo/fan.jl diff --git a/demo/Manifest.toml b/demo/Manifest.toml index 63012d0..ebf778c 100644 --- a/demo/Manifest.toml +++ b/demo/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.11.0-rc2" manifest_format = "2.0" -project_hash = "312250c93ab02666602ba58c787d6694fab65fad" +project_hash = "850ebf95b1ce889497cf9809e7d9a16374c395b8" [[deps.ADTypes]] git-tree-sha1 = "6778bcc27496dae5723ff37ee30af451db8b35fe" @@ -198,6 +198,18 @@ git-tree-sha1 = "0157e592151e39fa570645e2b2debcdfb8a0f112" uuid = "00ebfdb7-1f24-5e51-bd34-a7502290713f" version = "3.4.3" +[[deps.Cairo]] +deps = ["Cairo_jll", "Colors", "Glib_jll", "Graphics", "Libdl", "Pango_jll"] +git-tree-sha1 = "d0b3f8b4ad16cb0a2988c6788646a5e6a17b6b1b" +uuid = "159f3aea-2a34-519c-b102-8c37f9878175" +version = "1.0.5" + +[[deps.CairoMakie]] +deps = ["CRC32c", "Cairo", "Cairo_jll", "Colors", "FileIO", "FreeType", "GeometryBasics", "LinearAlgebra", "Makie", "PrecompileTools"] +git-tree-sha1 = "e4da5095557f24713bae4c9f50e34ff4d3b959c0" +uuid = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" +version = "0.12.5" + [[deps.Cairo_jll]] deps = ["Artifacts", "Bzip2_jll", "CompilerSupportLibraries_jll", "Fontconfig_jll", "FreeType2_jll", "Glib_jll", "JLLWrappers", "LZO_jll", "Libdl", "Pixman_jll", "Xorg_libXext_jll", "Xorg_libXrender_jll", "Zlib_jll", "libpng_jll"] git-tree-sha1 = "a2f1c8c668c8e3cb4cca4e57a8efdb09067bb3fd" @@ -839,6 +851,12 @@ git-tree-sha1 = "97285bbd5230dd766e9ef6749b80fc617126d496" uuid = "c27321d9-0574-5035-807b-f59d2c89b15c" version = "1.3.1" +[[deps.Graphics]] +deps = ["Colors", "LinearAlgebra", "NaNMath"] +git-tree-sha1 = "d61890399bc535850c4bf08e4e0d3a7ad0f21cbd" +uuid = "a2bd30eb-e257-5431-a919-1863eab51364" +version = "1.1.2" + [[deps.Graphite2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "344bf40dcab1073aca04aa0df4fb092f920e4011" diff --git a/demo/Project.toml b/demo/Project.toml index d96888f..92156e5 100644 --- a/demo/Project.toml +++ b/demo/Project.toml @@ -1,3 +1,4 @@ [deps] +CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" OceanSonar = "03019ade-4524-4ecd-af79-46d4f04a1b56" diff --git a/demo/fan.jl b/demo/fan.jl new file mode 100644 index 0000000..8a7834e --- /dev/null +++ b/demo/fan.jl @@ -0,0 +1,71 @@ +## +using OceanSonar +using OceanSonar.IntervalArithmetic +using CairoMakie + +cel = OceanCelerityProfile("Munk") +bty = BathymetryProfile("Flat", z = 5e3) +ati = AltimetryProfile("Flat") + +r_min = 0.0 +r_max = 100e3 + +fan = Fan("Gaussian", + π/20 * range(-1, 1, 5), + 1e3, r_max, 1e3, + cel, + bty, + ReflectionCoefficientProfile("Reflective"), + ati, + ReflectionCoefficientProfile("Mirror") +) + +r_ntv = interval(r_min, r_max) +z_min = r_ntv |> ati |> inf +z_max = r_ntv |> bty |> sup + +fig = Figure() +axis = Axis(fig[1, 1], yreversed = true) +celerityheatmap!(axis, cel, r_min, r_max, z_min, z_max) +bathymetryband!(axis, bty, r_min, r_max) +altimetryband!(axis, ati, r_min, r_max) +raycurves!(axis, fan) + +display(fig) + +## +using OceanSonar +using OceanSonar.IntervalArithmetic +using CairoMakie + +cel = OceanCelerityProfile("Homogeneous") +bty = BathymetryProfile("Parabolic") +ati = AltimetryProfile("Flat") + +r_min = 0.0 +r_max = 20e3 + +z_ref = 5e3 + +fan = Fan("Gaussian", + range(atan(z_ref, r_max), atan(z_ref, r_max/10), 5), + 0.0, r_max, 1e3, + cel, + bty, + ReflectionCoefficientProfile("Reflective"), + ati, + ReflectionCoefficientProfile("Mirror") +) + +r_ntv = interval(r_min, r_max) +z_min = r_ntv |> ati |> inf +z_max = r_ntv |> bty |> sup + +fig = Figure() +axis = Axis(fig[1, 1], yreversed = true) +celerityheatmap!(axis, cel, r_min, r_max, z_min, z_max) +bathymetryband!(axis, bty, r_min, r_max) +altimetryband!(axis, ati, r_min, r_max) +raycurves!(axis, fan) + +display(fig)