Using Trajectory Analysis

advertisement

Using Trajectory Analysis.exe:

Analysis and Plotting of Trajectories Generated with

HYSPLIT Batch Generator

Version 1.0 (last updated December 18, 2006)

Prepared by Will Hafner

University of Washington – Bothell whafner@uwb.edu

About the Program:

Trajectory Analysis uses the output from HYSPLIT Batch Generator to identify trajectories in a given folder, approximate the source regions of the trajectories, and prepare an output for plotting trajectories in ArcGIS 9.x. The text output of this program is formatted to plot trajectory hourly points as a point feature class or raster in ArcGIS

9.0. This guide will show the steps necessary to plot your trajectories, but for a better introduction to ArcGIS go to Ormsby et al., 2004.

This program and code are freely available from me through the University of

Washington-Bothell. I welcome any comments and will provide help whenever possible.

Any suggestions for improvement will be incorporated into later versions of the program.

Feel free to make changes to the code to suit your own modeling purposes. However, if you do make changes to the original code, I am released from providing help if the program ceases to function.

Listed below are the current features of Trajectory Analysis, Version 1.0, plus one known problem.

Features include:

Quick identification of the input parameters that were used in making the trajectories with HYSPLIT Batch Generator.

Determination of the approximate source regions of the trajectories using a box approach (how often trajectories come from a given box). The altitude distribution of the hourly points within this box is also given.

Comma delimited output of the results from the box approach.

Comma delimited output of the hourly points for any number of selected trajectories. Output parameters include: latitude, longitude, altitude, hour, rain, potential temperature, ambient temperature, relative humidity, mixing height, and pressure. This output file is used by ArcGIS to plot the trajectories.

ASCII outputs of: the number of hourly points in each 1° x 1° cell covering the

Northern Hemisphere, the amount of precipitation from selected trajectories in each 1° x 1° cell, and the percent of hourly points in each 1° x 1° cell that are

under the HYSPLIT calculated mixing height. These output files are used by

ArcGIS to produce raster plots of the trajectories.

Known Problems:

This program was written to work only with the trajectory text files generated with HYSPLIT Ver4.8. The character spacing is different in previous versions of

HYSPLIT. Either download Ver4.8, or adjust the locations of latitude, longitude, etc… in the code to align with your text files output.

Prior to Running the Program:

This program was written to work with trajectories created using my HYSPLIT

Batch Generator. Learn how to use that program by reading “How to Create

Trajectories Using the Visual Basic.NET HYSPLIT Batch Generator”

If you wish to plot the trajectories, have access to ArcGIS 9.x.

If you only plan on running the executable version of the Trajectory Generator program, download the newest Microsoft.NET (Version 3.0) framework from: http://msdn2.microsoft.com/en-us/netframework/default.aspx

If you would like to modify the code of HYSPLIT Batch Generator, you must have Microsoft Visual Studio.NET 2003 or newer.

Running the Program:

I have worked to make this program as user-friendly as possible, but the layout of the user interface and options available may cause some confusion. In this document, I will present examples for analyzing and plotting the 144 trajectories that were created in the example from the HYSPLIT Batch Generator Instructions. As with those instructions, italics indicate field values for our example analysis.

In the following example, we will plot trajectories in ArcGIS. The shapefile

(global country outline in this case) necessary to display 10-day trajectories is provided.

I have already projected this shapefile to the desired coordinate system. When you make your own trajectories, you may want different shapefiles or layers in the background. I have all of the common political boundaries (U.S., Europe, and world countries) as well

as global population. Other files can be found free online. You are responsible for choosing your projections. The book ArcGIS 9: Understanding Map Projections, 2004, offers an overview of common projections plus their common uses.

To run the compiled program, open Trajectory Analysis.exe. To run the program from code in Visual Basic.NET, press the start button ( ► ) in the task bar. Once open, the program should look like Figure 1 (except most of the text fields will be blank).

Opening Files and Box Analysis:

With every batch of trajectories generated, HYSPLIT Batch Generator creates a text file with a .traj extension. This file is named after the site code, end year, end month, and end day. It contains all the input parameters and the names of all the trajectories.

Figure 1: The graphic user interface for Trajectory Analysis.

1.

Click on Open File and browse for the folder where the desired batch of trajectories is stored. Select the .traj file in that folder. For our example, that file is called

MBO20040425.traj.

2.

Click Open in the dialog box. The input parameters for this batch of trajectories are listed on the top of the form ( example: -240 hours trajectories for MBO on 4/5/2004 ).

All of the trajectory names are listed in the scrolling list box.

3.

Click Asia, California, or Alaska as the potential source region (or enter your own coordinates). For our example, use the Asian box.

To determine whether your back trajectories have spent any time within this area, click the Are Trajectories in this

Box?

button. Depending on the number of trajectories, this may take some time.

When done, note the additional columns that have appeared (see Figure 1). The

“Total” column on the right side of the list box represents the number of hourly points from the trajectory that are within the box coordinates. In Figure 1 (our example), the first trajectory listed spent 9 of its 240 hours in the Asian box.

The <3km column is the number of hourly points that were in the box and under 3km in altitude. <2km and <1km are similarly defined. Click on CA to change the box to California and click the Are Trajectories in this Box? button. Note that none of the trajectories pass through this CA.

4.

If you wish to write the results of the box analysis to a comma delimited file, check

“Write results to” file and press

Are Trajectories in this Box?

. You will be prompted to enter an output file name. The content of the list box will be printed to this file.

Creating an Output File and Plotting Hourly Points:

1.

In the list box, select the desired trajectories by clicking the check box next to the trajectory name. For multiple selections, use shift or control to highlight several rows and left click to select. We will be checking all 144 trajectories.

2.

Click X,Y for GIS Input and enter an output file name. We will use

PointExample.csv as the file name.

This button lists the hourly points from each selected trajectory file.

3.

Open ArcCatalog and ArcMap. In ArcCatalog, find the output directory and right click on PointExample . Go to Create Feature Class ►

→ From XY Table..

. A form will appear listing Longitude as the X Field, Latitude as the Y Field, and <None> as

the Z Field. Select an output file name and directory. We will use PointExample.shp as the filename . Click OK .

4.

Copy the World_PlateCaree folder to the directory of PointExample.shp

. Open the

World_PlateCaree folder in ArcCatalog and drag country_Plate_Caree to ArcMap .

A global map should appear. Adjust the colors by clicking on the color box. Next, drag PointExample.shp to ArcMap.

Make sure PointExample is above country_Plate_Caree in the display tab on the left side of the screen.

Your screen should resemble Figure 2 (but your hourly points should only be one color).

Features of ArcMap:

I will discuss two simple features of ArcMap that are useful for displaying and exploring trajectory hourly points: adjusting symbology and the query function. For a better explanation of how to make publication quality maps, read Ormsby et al., 2004.

Symbology:

A.

In the display tab of ArcMap, double click PointExample . On the Layer Properties form, go to the Symbology tab, click on Quantities and the on Graduated colors. For the Value field, scroll to Altitude.

B.

You will get a message that says “Maximum sample size reached…”. Click

OK and click the Classify button followed by the Sampling button. Increase the maximum sample size to 1,000,000 and click OK .

C.

You should now see a histogram representing the altitude of each of the hourly points from your 144 trajectories. Change the Break Values to 1000, 2000, 3000,

4000, and 10000 and click OK .

D.

Click on Symbol and Properties for all symbols… Select the circle in the top left corner and change the size from 18 to 3 and click OK . Choose the light pink to dark red color ramp and click OK . You now have the hourly points displayed by altitude.

Query:

E.

In the top menu, go to Selection → Select by Attributes. Make sure the Layer field says PointExample and the Method field says Create a New Selection. Under Fields double click “Hour”, click the equal sign, and type -120. Click Apply and Close .

F.

The halfway points of all the trajectories are highlighted. Using query, you can select hourly points by any criteria: hourly points whose altitude is under the mixing height, hourly points within the border of Japan, hourly points with precipitation.

G.

To make a separate layer of these points, right click on PointExample, go to Selection

► → Create Layer from Selected Features… All of the highlighted points have now become a separate layer called PointExample selection. You have now shown the range of 5-day transport on April 25, 2004. Your screen should now resemble Figure

2.

Figure 2: Plot of PointExample which includes 144 back trajectories plotted by altitude. The blue dots represent the location of the hourly points five days back from MBO on 4/25/06.

Creating an Output and Plotting Raster Data:

1.

In Trajectory Analysis, select desired trajectories by using shift or control. We will be plotting all 144 trajectories.

2.

There are 3 options for creating raster plots: Density, Sum Rain, and %<BL. All three options are a 1° x 1° grid rather than individual hourly points. Density plots

represent the total number of hourly points in each grid cell. Sum Rain plots represent the total precipitation belonging to the hourly points in each grid cell.

%<BL plots the relative number of hourly points in each grid cell that are below the mixing height as calculated by the HYSPLIT model. Select an option and click

Raster for GIS Input . For our example, check the Density option and save the file as DensityExample.

3.

Open ArcCatalog and ArcMap. In ArcCatalog, open ArcToolbox by clicking on the toolbox icon in the taskbar. In ArcToolbox, go to Conversion Tools → To Raster →

ASCII to Raster.

4.

Browse to find DensityExample for the Input ASCII Raster File. Also save the file as

DensityExample . For the Density option, the output data type should be Integer. For the Sum Rain and %<BL options, the output data type should be Float. Select Integer and click OK.

5.

ArcGIS has converted the ASCII file to a grid, but does not know the units coordinates. You must specify a geographic coordinate system for this file. In

ArcToolbox, go to Data Management Tools → Projections and Transformations →

Define Projection.

6.

Browse to find DensityExample for the Input Dataset. Search for a Coordinate

System. Click Select → Geographic Coordinate Systems → World →

WGS_1984.prj (for density plots that are predominately in North America, I usually use Geographic Coordinate Systems → North America → North American Datum

1983.prj). Click OK . Click OK again to define the projection.

7.

Drag country_Plate_Caree to ArcMap . Drag DensityExample from ArcCatalog to

ArcMap, ensuring that it is above country_Plate_Caree. Your screen should look similar to Figure 3.

8.

In ArcMap, double click DensityExample and click Stretched. Change the color ramp from black and white to light pink to dark red and click OK . Your figure should match Figure 3. To have the political boundaries above the DensityExample , drag an additional country_Plate_Caree from ArcCatalog to ArcMap, making sure it is above

DensityExample . Click on the top country_Plate_Caree and choose Hollow as a color.

9.

If you click Classified as opposed to Stretched, it is possible to define your own bins for the color ramps, similar to what was done with PointExample in step C of

Symbology.

Figure 3: Plot of DensityExample which contains 144 trajectories on a 1° x 1° grid. Note the areas near Mount Bachelor, where all 144 trajectories pass through, are the darkest.

Point vs. Raster:

The point and raster plots show the same data in different forms. The point data allows for more dimensions of the hourly points to be displayed on one plot. For example, in Figure 2 we plotted the X,Y, and Z (by color coding). The downside of hourly point plots is that they do a poor job representing many trajectories. Trajectories from the dominant transport pathways get plotted on top of each other, while stray trajectories appear to be more common. To make an appealing plot often requires cherrypicking individual trajectories to represent transport events.

Density plots do a much better job at representing thousands of trajectories. In these plots, the appearance of stray trajectories is minimized, and the dominant pathway

Oris easily visible. No trajectories need to be excluded to demonstrate atmospheric transport.

References:

Ormsby, T., Napoleon, E., Burke, R., Groessl, C., Feaster, L., Getting to Know ArcGIS

Desktop; 2004 ; ESRI Press, Redlands, CA

ArcGIS 9: Understanding Map Projections; 2004 ; ESRI Press, Redlands, CA

Download