TrajStat Help
TrajStat Help
TrajStat Help
TrajStat is a free software with some trajectory statistics functions. The trajectory calculation
module of HYSPLIT (http://www.arl.noaa.gov/ready/hysplit4.html) (Draxler and Hess, 1998) was
included in TrajStat as an external process to calculate trajectories. Monthly trajectories could be
calculated in TrajStat, and the trajectories could be converted to GIS (Geographic Information
System) line shape file. Cluster analysis function is in the software. Measurement data could be
added to the corresponding trajectories, so the trajectories could be selected according to the
measurement data. The software also could do PSCF (Potential Source Contribution Function) and
CWT (Concentration Weighted Trajectory) analysis which is useful to identify pollution sources
spatially for long-term environment measurement.
The software also has some GIS functions which allow the users to customize the trajectory
map. Open-source MapWindowGIS ActiveX Control (http://www.mapwindow.com/)
(MapWindow open source team, 2007) was used in this software in which ESRI shape file could
be added.
Microsoft .NET Framework 2.0 has to be installed before using TrajStat 1.0, so it only could
be used in Microsoft Windows environment.
New Features
Version 1.1.1:
1. Labels could be saved and edited.
2. Some legend edit functions were added.
3. The trajectory shape file created by ‘Convert To Shape File’ function added ‘Year’,
‘Month’, ‘Day’ and ‘Hour’ fields. So the trajectory could be queried with date more
conveniently. For the trajectory shape file created by old version, ‘Add YMDH Fields’
function could add the fields.
1
4. Some bugs were corrected.
Version 1.1:
1. Trajectory line shape file type changed from ‘Polyline’ to ‘PolylineZ’. That means each
point of a trajectory line is 3-D with press as Z. TrajStat 1.0 users could recreate
trajectory line shape using ‘Convert To Shape File’ function.
2. Add the function to show press profile of the trajectory with 2-D and 3-D chart.
3. Add the function to do CWT (Concentration Weighted Trajectory) analysis.
4. The attribute data of the layer could be edited.
5. Color scheme could be set to layer.
Example
For new users to better understand the software, an example was described in this help
document. Sand and dust storm (SDS) pathways and sources could be identified using trajectory
statistics methods (Wang et al., 2006; Wang et al., 2004). In this example, we want to do such
analysis to Jiuquan which is located in northwest of China. We have the data of daily averaged
PM10 concentration at Jiuquan in springtime from 2004 to 2006 (Wang et al., 2008). Following is
the steps to implement the job.
1. Add Jiuquan station into the project.
2. Calculate 3-day back trajectories during PM10 data measurement period.
3. Convert end point files to .tgs files. Then join .tgs files to one file.
4. Convert .tgs file to trajectory line shape file and add the shape file into the project.
5. Show press profile of the trajectories.
6. Add measurement data into the trajectories.
7. Select polluted trajectories.
8. Convert trajectory shape file to line data file (.lcd).
9. Cluster calculation to the trajectories.
10. Calculate mean trajectory of cluster and add the cluster line shape file into the project.
11. Decide cluster number with your eyes.
12. Add cluster to each trajectory.
13. Do cluster statistics and find the pathways of SDS.
14. Create grid polygon shape layers of PSCF and CWT.
15. PSCF analysis.
Three sample files ‘JiuquanSpr.tgs’, ‘Stations.txt’ and ‘Jiuquan_PM10_Spr_DA.csv’ could be
found in ‘Sample’ folder under software installation directory. The example could be done with
them except trajectory calculation step which need large meteorological data. Please read
HYSPLIT help documents for details of trajectory calculation.
2
GIS Functions
GIS Project
When starting the software, a GIS project file named ‘MyTraj.mwprj’ will be opened.
The disk locations and properties of the layer files were included in the project file which
could also be generated from MapWindow GIS (an open source GIS software). Originally the
‘MyTraj.mwprj’ file includes some geographic layers in ‘Geo Data’ group and some empty groups
‘Trajectory’, ‘Cluster’, ‘Station’, ‘PSCF’ and ‘CWT’.
‘Open’, ‘Save’ and ‘Save As’ menu items could be used for project file with ‘.mwprj’
extension. The initialized project file will be copied to ‘MyTraj.mwprj’ after pressing ‘Reset’
menu item.
3
GIS Group And Layer
In legend area a context menu will be showed after right button of mouse was clicked with
menu items of ‘Add Group’, ‘Rename Group’, ‘Remove Group’ and ‘Add Layer’. One group
could include some layers.
A context menu with items of ‘Add Layer’, ‘Rename Layer’ and ‘Remove Layer’ will appear.
Shape files or image files could be added as layers in a project. The layers could be displayed or
hided by clicking the check box before group or layer. The layer with gray background is active
layer which could be changed by mouse clicking.
Legend Editor
The ‘Legend Editor’ dialog of the selected layer will be opened after double-click the layer in
legend. The color and size of the shapes in a layer could be changed in this dialog. The legend
editor of ‘world’ layer is blow.
4
Set ‘Show Fill’ Property to true. Click ‘Color Scheme’ property, a ‘Coloring Scheme Editor’
dialog will be opened.
Select ‘Field’ to ‘CNTRY_NAME’ and then Click ‘Unique Values’ menu item under ‘Make
Breaks’ button, a color scheme with unique country name will be created. The color scheme could
be saved as a file and then loaded from it.
5
Press ‘Apply’ button, the color scheme will be applied to ‘World’ layer.
Map View
The map content of a layer could be displayed in map view area. Some tools including zoom
in, zoom out, pan, full extent and zoom to layer could be used to change the display extent of
layer.
6
Map View Output
The map view could be saved as bmp, gif or jpg format figure using ‘Map Output’ function in
‘Edit’ menu. But for professional map output, please use other commercial GIS software such as
ArcView.
Layer Attribute
The attribute table of the active layer could be showed by clicking ‘Attribute Table’ menu
item. The attribute data could be edited with the functions in ‘Edit’ menu.
7
‘Identify’ tool is used to find the attribute of the selected shape with mouse in active layer.
Layer Label
After clicking ‘Set Label’ button, a ‘Label’ dialog will be showed and the label of the shapes
8
in active layer could be set from this dialog.
Station layer
Station point layer could be created with user input dialog and from the file.
9
When click ‘Create Station Layer’ menu item, the corresponding dialog will be opened.
After input station, longitude, latitude and altitude, click ‘OK’ button, then set a name for the
station shape file in a ‘Save As’ dialog. A point shape layer will be added in ‘Station’ group of the
project. Then you could change the point show type and add the label to the station.
10
Station point shape file could also be created from file, with this function multi-stations could
be added once. Click ‘Create Station Layer from File’ menu item.
Press ‘Input File’ and selected sample data ‘Stations.txt’. Then set name, longitude, latitude
and altitude field.
11
Press ‘Add Data’ button and set filename in save as dialog. The station shape file will be
created and added in ‘Station’ group of the project.
Edit Station
Add station: Click ‘Add Station’ menu item when station layer is active. Following step is
12
similar with ‘Create Station Layer’.
Edit Station: After clicking ‘Edit Station’ menu item, select the station point with mouse in
map view. Following step is similar with ‘Create Station Layer’.
Delete Station: After clicking ‘Delete Station’ menu item, select the station with mouse in
map view, and then the selected station will be deleted from the station layer.
Trajectory Statistics
‘Trajectory’ menu includes some functions to calculate trajectory, add measurement data to
trajectory, do cluster analysis and do PSCF and CWT analysis.
Trajectory Calculation
‘Trajectory Monthly Calculation’ dialog will be opened when clicking ‘Calculate’ menu item.
From the dialog station name, starting time and location, run time, top of model, vertical,
meteorological files, start day, end day and output path could be set. The setting is similar with
TCL interface of HYSPLIT model. Then click ‘Calculate’ button, the trajectories will be
calculated automatically. The ‘hymodelt.exe’ file come from HYSPLIT
(http://www.arl.noaa.gov/ready/hysplit4.html) was used in calculation. The file names were set
automatically to ‘yymmddhh’, such as ‘07120106’. Then click ‘Convert’ button, every trajectory
file will be rewrite to the format with column titles as fist row and comma-delimited data. The
extension names of the files were changed to ‘.tgs’. Finally click ‘Combine’ button, the ‘.tgs’ files
will be combined to one file. In this example, we calculate trajectories of springtime (March to
13
May) in 2004-2006.
Click ‘Join TGS Files’ menu item. Then select all .tgs files generated from last step in open
file dialog, and press open button.
14
Then set the output .tgs file name to ‘JiuquanSpr.tgs’ in save as dialog, and press save button.
So all trajectories now are in one file.
15
Convert To Shape File
Click ‘Convert To Shape File’ menu item. Then select ‘JiuquanSpr.tgs’ file in open dialog.
Then set path and name for trajectory line shape file in ‘Save as’ dialog. Press save button
then the ‘PolylineZ’ shape file was created. Each point of a trajectory line is 3-D with press as Z.
16
Then the shape file was created and the shape layer was added in ‘Trajectory’ group.
The attribute table of the created trajectory layer is blow. ‘DATE’ and ‘Height’ field was
added to each trajectory.
17
Show Press Profile
Click ‘Show Press Profile’ menu item, a ‘Press Profile Figure’ dialog will be opened.
Press ‘Select Trajectory’ button (first one) in ‘Press Profile Figure’, and then select trajectory
one by one in map view with mouse. The press profile line will be added when you select a
trajectory. Please make sure ‘JuqanSpr’ layer was selected in legend, or the trajectories could not
be selected. Trajectory could be removed from press profile figure by using ‘Remove Last
Trajectory’ and ‘Remove All Trajectories’ button. Several plot styles could be chosen to change
the figure performance.
Click ‘3-D Chart’ button, 3 dimensions trajectories will be showed in ‘3 Dimension Chart’
18
dialog. Horizontal and vertical angle could be adjusted with slide buttons at right and bottom.
Double-click the chart will start or stop the animation.
This tool will add data from a comma-delimited text file to trajectories according to the date
field. The file must contain column titles as the first row and a date column with format
‘YYYYMMDDHH’ or ‘YYYYMMDD’. Below is a sample of data format.
19
An ‘Add data to trajectories’ dialog will be opened when click ‘Add Data to Trajectory’ menu
item.
Press ‘Input File’ button, then select the data file ‘Jiuquan_PM10_Spr_DA.csv’ from the
‘Open’ dialog. Then set ‘Date field’ and ‘Data Field’ from the dataset. Then the data field property
which will be added into trajectory layer has to be set with name, type, width and precision. Please
note that field name can’t be started with number.
20
Press ‘Add Data’ button. Then select the layers in which the data will be added in a ‘Select
Trajectory Layers’ dialog. Press ok button the measurement data will be added in ‘JiuquanSpr’
layer.
The attribute table of the trajectory layer ‘JiuquanSpr’ was showed below after ‘PM10’ data
were added.
21
Select Trajectory
The trajectories could be selected according to the attribute. A ‘Select Trajectory’ dialog will
be opened when ‘Select Trajectory’ menu item was clicked. In the dialog, trajectory layers could
be checked for selection, a selection expression could be set. In this example, we want to select the
trajectories with PM10 concentration larger than 150 µg m-3 which is Class Ⅱ Chinese standard.
When click ‘Select’ button, the trajectories within the selection expression will be selected
with yellow high light.
22
Or only selected trajectories show in map view if ‘Hide Others’ option was checked. So the
trajectories with high PM10 concentration were mainly come from west direction.
23
Convert To Line Data
Before cluster calculation, we should convert trajectory shape files to line data file. A
‘Convert to Line Data’ dialog will be opened when click ‘Convert to Line Data’ menu item. In the
dialog, the trajectory layers, point interval and output file should be set.
Then press ‘OK’ button, an ASCII file with ‘lcd’ extension will be created. In the file, each
row expresses one trajectory line. First column is the start time of the trajectory, the others are
latitude, longitude and press of the endpoints.
24
Cluster analysis
A ‘Cluster Calculation’ dialog will be opened when click ‘Cluster Analysis’ menu item. Input
file should be the .lcd file generated by pre-step. There are two clustering options with Euclidean
distance or angle distance (Sirois and Bottenheim, 1995). If users only concern the directions of
the trajectories in clustering, then angle distance should be selected.
The Euclidean distance between two backward trajectories was then given by
n
d 12 = ∑ (( X
i =1
1 (i ) − X 2 (i )) 2 + (Y1 (i ) − Y2 (i )) 2 ) (1)
1 n ⎛ ( A + Bi − Ci ) ⎞⎟
d 12 = ∑
n i =1
cos −1 ⎜ 0.5 i
⎜ Ai Bi ⎟
(2)
⎝ ⎠
where
The variables X0 and Y0 define the position of the studied site. Note that d12 varies between 0
25
and π. The two extreme values occur when two trajectories are in the same and opposite direction,
respectively. As defined by equations (2) to (5), d12 is the mean angle between the two backward
trajectories, as seen from the studied site.
Press ‘Calculate Cluster’ button to run the clustering program. Then a .txt file with trajectory
number and cluster members was created. In this case, maximum cluster number is set to 9 which
could be changed if necessary.
‘Eye ball’ method was used to determine the cluster number in this software. In ‘Cluster
Calculation’ dialog, mean trajectories and trajectory number of each cluster could be calculated
and to be transferred to ESRI shape file according to selected cluster number by pressing
‘Calculate Mean Traj’ button. Several kinds of mean trajectories were calculated and showed in
map view, and then a suitable cluster number could be determined by your eyes. In this example,
26
Cluster number 5 is decided.
Set cluster number to 5 in ‘Cluster Calculation’ dialog, and then press ‘Add Cluster to Traj’
button. Select layers in opened ‘Select Trajectory Layers’ dialog. The cluster attribute will be
added to the trajectory layers with ‘CLUSTER’ field.
Cluster statistics
Click ‘Cluster Statistics’ menu item, ‘Cluster Statistics’ dialog will be opened. In which, field,
27
cluster number, pollution criterion and null data should be set.
Then press ‘OK’ button, the statistical result will be showed with trajectory number, mean
value, standard deviation, polluted trajectory number, polluted mean value and polluted standard
deviation of each cluster.
In this case, PM10 mean value of cluster 4 is the highest with from west direction.
Before performing PSCF or CWT analysis, a PSCF or CWT layer has to be created. Click
‘Create Grid Layer’ menu item, then set the extension, cell size and type of the layer in opened
dialog.
28
Press ‘Create Layer’ button, and then set the filename of the layer in ‘Save As’ dialog. A grid
layer will be created in ‘PSCF’ group.
ID, Nij, Mij, PSCF and WPSCF fields were added during PSCF layer creation.
29
To create CWT layer, type should be selected to ‘CWT’, Then CWT field width and precision
should be set.
ID, Nij, CWT, WCWT fields were added to cwt shape file.
30
PSCF analysis
The PSCF values for the grid cells in the study domain are calculated by counting the
trajectory segment endpoints that terminate within each cell (Ashbaugh et al., 1985). The number
of endpoints that fall in the ijth cell is designated nij. The number of endpoints for the same cell
having arrival times at the sampling site corresponding to PM concentrations higher than an
arbitrarily set criterion is defined to be mij. The PSCF value for the ijth cell is then defined as
The PSCF value can be interpreted as the conditional probability that the concentrations of a
given analyte greater than the criterion level are related to the passage of air parcels through the
ijth cell during transport to the receptor site. That is, cells with high PSCF values are associated
with the arrival of air parcels at the receptor site that have concentrations of the analyte higher
than the criterion value. These cells are indicative of areas of ‘high potential’ contributions for the
constituent.
Click ‘PSCF Analysis’ menu item to open the below dialog.
31
Select trajectory layers, PSCF layer, data field and set pollution criterion and null data. Then
press ‘Get Nij’, ‘Get Mij’, ‘Cal PSCF’ buttons one by one. To reduce the effect of small values of
nij, the PSCF values were multiplied by an arbitrary weight function Wij to better reflect the
uncertainty in the values for these cells (Polissar et al., 1999). The weighting function reduced the
PSCF values when the total number of the endpoints in a particular cell was less than about three
times the average value of the end points per each cell. In this case, Wij was defined as below.
32
The PSCF analysis point out that west desert areas are the sources of PM10 in Jiuquan
ambient air.
CWT Analysis
A limitation of the PSCF method is that grid cells can have the same PSCF value when
sample concentrations are either only slightly higher or much higher than the criterion. As a result,
it can be difficult to distinguish moderate sources from strong ones. In the CWT method (Hsu et
al., 2003; Seibert et al., 1994), each grid cell is assigned a weighted concentration by averaging
the sample concentrations that have associated trajectories that crossed that grid cell as follows:
M
1
C ij = ∑ cτ (8)
∑l =1 τ ijl
M l ijl
l =1
where Cij is the average weighted concentration in the ijth cell, l is the index of the trajectory,
M is the total number of trajectories, Cl is the concentration observed on arrival of trajectory l, and
τijl is the time spent in the ijth cell by trajectory l. A high value for Cij implies that air parcels
traveling over the ijth cell would be, on average, associated with high concentrations at the
receptor. The arbitrary weighting function described above was also used in the CWT analyses to
reduce the effect of the small values of nij.
Click ‘CWT Analysis’ menu item, and set CWT layer, data field, null data and weighting
parameters. Then press ‘Get Nij’, ‘Cal CWT’ and ‘Weight CWT’ button one by one.
33
Set the color scheme of the cwt layer as below.
And set line width to 0 in ‘Legend Editor’ dialog. CWT layer looks as blow.
34
In this case, CWT analysis result is similar with PSCF analysis.
References
Ashbaugh, L.L., Malm, W.C. and Sadeh, W.Z., 1985. A residence time probability analysis of sulfur
concentrations at Grand Canyon National Park. Atmospheric Environment, 19(8): 1263-1270.
Draxler, R.R. and Hess, G.D., 1998. An overview of the HYSPLIT_4 modelling system for trajectories,
dispersion, and deposition. Australian Meteorological Magazine, 47: 295-308.
Hsu, Y.-K., Holsen, T.M. and Hopke, P.K., 2003. Comparison of hybrid receptor models to locate PCB
sources in Chicago. Atmospheric Environment, 37: 545-562.
MapWindow open source team, 2007. MapWinGIS reference manual. Geospatial Software Lab, Idaho
State University, Pocatello.
Polissar, A.V., Hopke, P.K., Paatero, P., Kaufmann, Y.J., Hall, D.K., Bodhaine, B.A., Dutton, E.G. and
Harris, J.M., 1999. The aerosol at Barrow, Alaska: long-term trends and source locations.
Atmospheric Environment, 33: 2441-2458.
Seibert, P., Kromp-Kolb, H., Baltensperger, U., Jost, D.T., Schwikowski, M., Kasper, A. and Puxbaum,
H., 1994. Trajectory analysis of aerosol measurements at high alpine sites. In: B.P. M., B. P., C.
T. and S. W. (Editors), Transport and Transformation of Pollutants in the Troposphere.
Academic Publishing, Den Haag, pp. 689-693.
Sirois, A. and Bottenheim, J.W., 1995. Use of backward trajectories to interpret the 5-year record of
PAN and O3 ambient air concentrations at Kejimkujik National Park, Nova Scotia. Journal of
Geophysical Research, 100: 2867-2881.
35
Wang, Y.Q., Zhang, X.Y. and Arimoto, R., 2006. The Contribution from Distant Dust Sources to the
Atmospheric Particulate Matter Loadings at XiAn, China during Spring. Science of the Total
Environment, 368(2-3): 875-883.
Wang, Y.Q., Zhang, X.Y., Arimoto, R., Cao, J.J. and Shen, Z.X., 2004. The transport pathways and
sources of PM10 pollution in Beijing during spring 2001, 2002 and 2003. Geophysical
Research Letters, 31(14): L14110, doi:10.1029/2004GL019732.
Wang, Y.Q., Zhang, X.Y. and Draxler, R., 2009. TrajStat: GIS-based software that uses various
trajectory statistical analysis methods to identify potential sources from long-term air pollution
measurement data. Environmental Modelling & Software, 24: 938-939.
Wang, Y.Q., Zhang, X.Y., Gong, S.L., Zhou, C.H., Liu, H.L., Niu, T. and Yang, Y.Q., 2008. Surface
observation of sand and dust storm in East Asia and its application in CUACE/Dust.
Atmospheric Chemistry and Physics, 8: 545-553.
36