-
Notifications
You must be signed in to change notification settings - Fork 400
Closed
Description
Irregular grid is commonly used in many simulation programs.
I think it would be necessary to support plotting the results of these simulations.
Below is an example output of an ionosphere simulation program (SAMI2). Code and data are attached in the end.
The grid can be plotted using plot3, but I haven't found a way to plot data using GMT.

Matplotlib provides pcolor/pcolormesh which can plot the data in irregular grid easily.
I think it just add some polygons to the figure ref.
I found a post might be related to this. I think there is no need to modify grdimage.
A new function named pcolor/pcolormesh would be great.
data used:
alts.txt
glats.txt
glons.txt
ne.txt
code used above:
using Libdl
"/usr/local/Cellar/gmt/6.0.0_5/lib" in Libdl.DL_LOAD_PATH ||
push!(Libdl.DL_LOAD_PATH, "/usr/local/Cellar/gmt/6.0.0_5/lib")
using GMT
using DelimitedFiles
function build_AGMTgrid(alts, glats, glons)
grd1 = Array{GMT.GMTdataset,1}()
grd2 = Array{GMT.GMTdataset,1}()
n1, n2 = size(glons)
for i in 1:n1
if i % 3 != 1 continue end
push!(grd1, GMT.GMTdataset(hcat(glons[i,:], glats[i,:], alts[i,:])))
end
for i in 1:n2
if i % 2 != 1 continue end
push!(grd2, GMT.GMTdataset(hcat(glons[:,i], glats[:,i], alts[:,i])))
end
grd1, grd2
end
tmp_array = Array{Array{Float64,2},1}()
for fn in ["alts","glats","glons","ne", ]
push!(tmp_array,
DelimitedFiles.readdlm("$fn.txt", '\t', Float64, '\n'))
end
alts, glats, glons, ne = tmp_array
grd1, grd2 = build_AGMTgrid(alts, glats, glons)
R = (65, 160, -80, 80, 0, 4000)
view = (150, 45)
proj = (name = :PlateCarree, center = (0, 20),)
gmtbegin()
gmtfig("test1",fmt = "png,jpg")
basemap(region = R, proj = proj,
frame = (axes = "WSE"),
xaxis = (annot = :auto, label = :lon),
yaxis = (annot = :auto, label = :lat),
view = view,
figsize = 20, zsize = 20,)
topo = makecpt(color = :globe, range = (-8800, 8800,), continuous = true)
grdimage("@earth_relief_06m.grd", region = R, view = view,
shade = (azim = view[1], norm = "e0.8"),color = topo)
plot3(grd1,region = R, view = view,
zsize = 20,
pen = (0.5, :red, :solid)
)
plot3(grd2,region = R, view = view,
frame = (axes = "Z1234"),
zsize = 20,
zaxis = (annot = 1000, label = :altitude),
pen = (0.3, :cyan, :solid),
)
gmtend()
using PyPlot
PyPlot.pcolormesh(glats,alts,ne,cmap = "jet")
PyPlot.savefig("test2.png", )
Are you willing to help implement and maintain this feature? Yes
Metadata
Metadata
Assignees
Labels
No labels

