## Multi-color trajectory plot

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

### Multi-color trajectory plot

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)
mfn = int(line.split()[0])
for i in range(mfn):
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])
lats.append(lat)
lons.append(lon)
alts.append(alt)
alts = array(alts)
f.close()
#Create trajectory layer
layer = MILayer(shapetype='line')
lon1 = lons[0]
lat1 = lats[0]
for i in range(1, len(lons)):
lon = lons[i]
lat = lats[i]
alt = alts[i]
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)
#Plot
axesm()
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')
colorbar(layer)
title('Multi-color line')
yticks(arange(30, 51, 5))
xlim(130, 160)
ylim(30, 50)``````
arindamroy115
Posts: 8
Joined: June 15th, 2015, 6:59 am
Registered HYSPLIT User: No

### Re: Multi-color trajectory plot

Can I do that in offline version of HYSPLIT or in Trajstat (Without writting code)?
yaqiang
Posts: 55
Joined: October 5th, 2015, 10:20 pm
Registered HYSPLIT User: Yes