Page 1 of 1

3D trajectory and terrain

Posted: January 10th, 2020, 1:13 am
by yaqiang
From MeteoInfo version 2.0, opengl supported 3D axes was implemented for better 3D data visualization. Following is an example to plot 3D trajectory and terrain.

Code: Select all

fn = 'D:/Temp/hysplit/output_850'
f = addfile_hytraj(fn)
tlayer = f.trajlayer()
ls = tlayer.legend()
for lb in ls.getLegendBreaks():
    lb.setDrawSymbol(False)
stlayer = f.trajsplayer()

lcountry = shaperead('country')
lchina = shaperead('cn_province')

#Relief data
fn = 'D:/Temp/nc/elev.0.25-deg.nc'
f = addfile(fn)
elev = f['data'][0,'15:40','90:115']
elev[elev<0] = 0

#Plot
ax = axes3dgl()
cols = makecolors(20, cmap='MPL_terrain')
cols[0] = 'gray'
ls = ax.plot_surface(elev, 20, colors=cols, edge=False)
ax.plot_layer(tlayer)
ax.plot_layer(stlayer, fill=False)
ax.plot_layer(lchina, offset=100)
ax.plot_layer(lcountry, edgecolor='k', offset=100)
xlim(90, 115)
ylim(15, 40)
zlim(0, 10000)
xlabel('Longitude')
ylabel('Latitude')
zlabel('Height')
title('3D trajectory example')
traj3d_terrain.png

Re: 3D trajectory and terrain

Posted: February 27th, 2020, 3:25 pm
by McP82
I can confirm that it helps a lot compared to the older versions (I recently upgraded to 2.1.1 as I had an ancient version), it required some work to represent the 3d models otherwise.