Multi-color trajectory plot

Post Reply
Posts: 53
Joined: October 5th, 2015, 10:20 pm
Registered HYSPLIT User: Yes

Multi-color trajectory plot

Post by yaqiang » May 30th, 2016, 11:33 am

Only one color can be assigned to a line in MeteoInfo, so we have to create multi-line pieces to fullfill multi-color trajectory plot function. Below is an example to plot a multi-color trajectory according to it’s height. Read the endpoints from the HYSPLIT output trajectory file, and create a layer with line shapes from each pair of the adjacent endpoints. Height values were put into the layer’s attribute table. Then we can display the trajectory layer using it’s height field.

Code: Select all

#Read trajectory data file
fn = 'E:/Trajectory/RYO-to Yaqiang/05060306'
f = open(fn)
line = f.readline()
mfn = int(line.split()[0])
for i in range(mfn):
line = f.readline()
sn = int(line.split()[0])
for i in range(sn):
lons = []
lats = []
alts = []
for line in f:
    dd = line.split()
    lat = float(dd[9])
    lon = float(dd[10])
    alt = float(dd[11])
alts = array(alts)
#Create trajectory layer
layer = MILayer(shapetype='line')
layer.addfield('Height', 'float')
lon1 = lons[0]
lat1 = lats[0]
for i in range(1, len(lons)):
    lon = lons[i]
    lat = lats[i]
    alt = alts[i]
    layer.addshape([lon1,lon], [lat1, lat], [alt])
    lon1 = lon
    lat1 = lat
levs = arange(0, 1000, 100)
cols = makecolors(len(levs) + 1)
ls = makesymbolspec('line', levels=levs, colors=cols, field='Height', size=2)
lworld = shaperead('D:/Temp/map/country1.shp')
geoshow(lworld, edgecolor=(204,204,204), facecolor=(250,235,252))
geoshow(layer, symbolspec=ls)
scatterm(lons[0], lats[0], size=8, facecolor='r')
text(lons[0], lats[0]-1, 'Fukushima')
title('Multi-color line')
yticks(arange(30, 51, 5))
xlim(130, 160)
ylim(30, 50)

Posts: 8
Joined: June 15th, 2015, 6:59 am
Registered HYSPLIT User: No

Re: Multi-color trajectory plot

Post by arindamroy115 » July 11th, 2016, 4:33 am

Can I do that in offline version of HYSPLIT or in Trajstat (Without writting code)?

Posts: 53
Joined: October 5th, 2015, 10:20 pm
Registered HYSPLIT User: Yes

Re: Multi-color trajectory plot

Post by yaqiang » July 12th, 2016, 9:07 pm

You can download MeteoInfo 1.3.4 to do this job (

Post Reply