@@ -3,7 +3,7 @@ module GLMakie_Visualisation
33
44using Statistics
55using GeophysicalModelGenerator: lonlatdepth_grid, GeoData, CartData, km, AbstractGeneralGrid
6- import GeophysicalModelGenerator: visualise
6+ import GeophysicalModelGenerator: visualise, ustrip
77
88# We do not check `isdefined(Base, :get_extension)` as recommended since
99# Julia v1.9.0 does not load package extensions when their dependency is
1414 using .. GLMakie
1515end
1616
17- export visualise
17+ import GLMakie: heatmap!, heatmap
18+
19+ export visualise, heatmap, heatmap!
1820
1921println (" Loading GLMakie extensions for GMG" )
2022
@@ -271,5 +273,47 @@ function visualise(Data::AbstractGeneralGrid; Topography=nothing, Topo_range=not
271273 return nothing
272274end
273275
276+ """
277+ heatmap(x::GeoData, args...; field=:Topography, kwargs...)
278+ heatmap for a 2D GeoData object (surface)
279+ """
280+ function heatmap (x:: GeoData , args... ; field= :Topography , kwargs... )
281+ @assert size (x. depth. val,3 )== 1
282+
283+ heatmap (x. lon. val[:,1 ], x. lat. val[1 ,:], ustrip .(x. fields[field][:,:,1 ]), args... ; kwargs... )
284+
285+ end
286+
287+ """
288+ heatmap(x::CartData, args...; field=:Topography, kwargs...)
289+ heatmap for a 2D CartData object (surface)
290+ """
291+ function heatmap (x:: CartData , args... ; field= :Topography , kwargs... )
292+ @assert size (x. z. val,3 )== 1
293+
294+ heatmap (x. x. val[:,1 ], x. y. val[1 ,:], ustrip .(x. fields[field][:,:,1 ]), args... ; kwargs... )
295+
296+ end
297+
298+ """
299+ heatmap!(x::GeoData, args...; field=:Topography, kwargs...)
300+ in-place heatmap for a 2D GeoData object (surface),
301+ """
302+ function heatmap! (x:: GeoData , args... ; field= :Topography , kwargs... )
303+ @assert size (x. z. val,3 )== 1
304+
305+ heatmap! (x. lon. val[:,1 ], x. lat. val[1 ,:], ustrip .(x. fields[field][:,:,1 ]), args... ; kwargs... )
306+
307+ end
308+
309+ """
310+ heatmap!(x::CartData, args...; field=:Topography, kwargs...)
311+ in-place heatmap for a 2D CartData object (surface)
312+ """
313+ function heatmap! (x:: CartData , args... ; field= :Topography , kwargs... )
314+ @assert size (x. z. val,3 )== 1
315+ heatmap! (x. x. val[:,1 ], x. y. val[1 ,:], ustrip .(x. fields[field][:,:,1 ]), args... ; kwargs... )
316+ end
317+
274318
275319end
0 commit comments