hot-spot analysis tips & tools
TRANSCRIPT
http://www.epa.gov/otaq/stateresources/transconf/projectlevel-hotspot.htm
Project-Level Conformityand Hot-Spot Analyses
CE 253Guest Lecture
Jim Dunshee09-APR-2015
EPA Guidance Website:
TAQ 2015 Final Project Tips: Links & Contours
Goals1. Define link geometry for use in MOVES & CALINE
2. Generate pollutant concentration contour plots to visualize modeling results
MOVES/CALINE
1
2
2
3
Background: Defining Links by Activity
Source: EPA-420-B-13-053
4
Link activity can be characterized by:
Source: EPA-420-B-13-053
1. Average Speed2. Link Drive Schedule3. Op-Mode Distributions
5
FE
Example Roundabout Links(overly simple & low accuracy approach)
2 distinct link speeds and lengthsX 8 lanes= 16 total on-road links
• Avg speeds based on real-world data• Assumed avg speed decreases by 10mph
due to peak hour traffic congestion
23mpg avg Approach/Departure Link
16mph avg Roundabout Link
Off-Peak Hour Speeds Peak Hour Speeds
13mpg avg Approach/Departure Link
6mph avg Roundabout Link
AB
C
D
G
H
I J
K
L
MN
O
P
Market St Market St
Gard
en S
tGa
rden
St
6
Background: Receptor Positions
CALINE4 v2.1 limited to 20 receptors per run
High receptor density will require multiple CALINE runs
7
Low Receptor Density = Low Resolution Contours
Note: Ambient PM2.5 = 5.5 µg/m³; distances in meters
Sufficient data for contours will require dense grid of receptors, including placing receptors ON LINKS
Wind Dir.181°
8
Goal 1: Defining Link Geometry
1. Determine study areaExample: ~0.5km² grid with intersection of interest near center
2. Use Google Maps (regular & “Style Wizard”) to generate images of links with known scales
Google Styled Maps Wizard: http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
3. Use MATLAB to determine XY coordinates within images
9
Default: m by n pixels New: y by x pixels
y meters
x m
eter
sPixels as Built-in Scale
Now scale is built-in image property
Image = matrix of pixels = 1m x 1m each(easy to analyze in MATLAB)
Maintain aspect ratio
10
Single Lane Road Edges from Google Map View Correspond Well With Actual Lane Centers
Can use this property to automatically detect & define links
11
Find Area in Google Maps
Latitude, Longitude, Map Zoom Level
Right click for ‘Measure distance’ option
12
Find Same Area in Styled Map Wizard
1. Enter Lat. & Long. coordinates into "Style Wizard”
2. Adjust slider bar to appropriate zoom level• Slider bar scale is 0-21• Generated image will be zoomed in by +1For example, if the you want 18z (approximately 552m width by 414 height) adjust slider to 17
http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html
13
Styled Google Static MapsRegular B&W (will be useful in MATLAB)
Done by removing layers & defining color schemes in “Style Wizard”
14
Resize Image Pixels to Match Map Dimensions
http://www.picresize.com/
Default: 640 x 480 pixels New: 552 x 414 pixels
*552m
*414
m
*Approximate map dimensions with 4:3 aspect ratio at zoom = 18
Easily done here:
CAVEAT: check your dimensions
I also resized and sharpened the BW image simultaneously with this site
Maintain 4:3 aspect ratio
15
Visually Define Link Geometry
Can use white lines in MS Paint to separate links
Use thin black lines to add more links or augment existing links
Remove features that are not of interest
16
Analyze Image in MATLABMy code comments outlining steps to take:1. %Read in image2. %Convert image from RGB to grayscale3. %Plot histogram of grayscale image4. %Pick a threshold to separate histogram peaks
(50-100 should work for preprocessed image)5. %Index values below thresh as 0, and above as 1, to create BW image6. %Find groups of 8-connected pixels and label as objects7. %Create and display an RGB image with different colors for each object
Functions used:imread, rgb2gray, imhist, bwlabel, label2rgb
Tip:With bwlabel, it will be useful to define each labeled object, as well as the number of labeled objects: [label,num]
17
Manual Threshold with Image HistogramSource: Bradford Smith, UVM ME207 Spring 2015 Lecture
18
Labeling Objects in a Binary Image
http://www.mathworks.com/help/images/labeling-and-measuring-objects-in-a-binary-image.html
Sources:Bradford Smith, UVM ME207 Spring 2015 Lecture
19
Individually Labeled LinksEach link is now an object labeled as a number (1:num of links)
20
imshow(label==8)
Link 8Displaying pixels labeled as “8”:
21
CALINE Limited to 20 Links/Run
num = 51
Can manually remove unnecessary links from image
May be better to keep the 20 link max. in mind when initially defining study area…
22
16 LinksApproach/departure links within 100m of intersection.Beyond that, cruise links.
Cruise Links
Departure Links
Approach Links
I also realized that I should extend the departure links to avoid large gaps b/w links at intersection (necessary gap to separate links is only 1 pixel)
23
Individually Labeled Links
num = 16
24
Automatically Find Link Endpoints%Define start and end points for each link and store in matrixlinks = zeros(num,4); %initialize matrix “links” to store datafor i = 1:num %num = # of links [y1,x1] = find(xlabel==i,1,'first'); %left-most XY coordinate Of link [yn,xn] = find(xlabel==i,1,'last'); %right-most XY coordinate Of link
%Store coordinates in “links” matrix%Use negative Y values to convert from matrix to XY coordinates links(i,1) = x1; links(i,2) = -y1; links(i,3) = xn; links(i,4) = -yn;end%Write links geometry data to .xlsx filefilename = 'links.xlsx';xlswrite(filename,links);
Output:x1 y1 xn yn
Link 1
Link n
25
links.xlsx
Rows = linksTop = firstBottom = last
Columns = x1, y1, x2, y2
1 -213 108 -2081 -223 109 -217
110 -208 216 -205111 -217 207 -214197 -1 204 -101203 -104 208 -202207 -1 213 -101209 -207 214 -317211 -214 318 -211213 -103 218 -212214 -319 219 -414218 -216 223 -317220 -205 317 -201223 -319 228 -414319 -201 552 -186320 -211 552 -195
Can copy & paste rows + columns into CALINE
26
MATLAB Data Cursor
Useful, but keep in mind that top left of image has default [X,Y] coordinates of [1,1]
27
Receptor Positions: Grid%Define X and Y as vectorsX = round(linspace(xmin,xmax,# of points));%Use negative Y values to convert from matrix to Cartesian coordinatesY = -round(linspace(ymin,ymax,# of points));%Create matrices of X and Y values[Y,X] = meshgrid(Y,X);%Convert matrices to vectors%Store vectors as coordinates in matrix “receptors”%Write coordinates to .xlsx file
x yReceptor 1
Receptor n
Output:
28
432 Receptors = 22 CALINE RunsTook me ~15min of mostly copying & pasting (~40sec/run)
29
Goal 2: Contour Plots
1. Copy CALINE receptor results into .xlsx file with corresponding XY coordinates
2. Import data into MATLAB
3. Superimpose contour plot onto area map
30
CALINE Results
x y Pollutant ConcentrationReceptor 1
Receptor n
Can just copy & paste pollutant concentrations into previously made ‘receptors.xlsx’ file and save as new file (e.g., ‘receptors_PM.xlsx’):
This will serve as a “Z-coordinate”.Similar to making topographic/elevation map.
31
Alternative to MATLAB: Result from JMP
Manually overlaid contour figure from JMP onto map image in PowerPoint
Imported my ‘receptors_PM.xlsx’ file into JMP and made contour plot
32
MATLAB Contours: General Steps%Import the data%Convert y values from negative to positive (Cartesian to matrix coord.)%Create regular grid across data space[X,Y] = meshgrid(linspace(min(x),max(x)), linspace(min(y),max(y)));%create contour plot%flip Y axis to match image axes%add colorbar for scale of pollutant concentrationhold on%Read in map image and define as matrix Isubimage(I) %overlay map image onto contour plotalpha(0.58) %set transparency
33
Default Colormap
34
Transparency Affects ColorsTransparency = 0≤alpha≤1Previous slide: alpha = 0.58Here: alpha = 0.2
This is actually image map superimposed onto contour map (other way more difficult in MATLAB)
35
A Solution to Match Colorbar to Colormap
Can place transparent rectangle(here: gray, 58% = alpha = 0.58)over the colorbar in PowerPoint
36
“Hot” Colormap
37
Lines Instead of Filled Contours
CHITTENDEN COUNTY, VT
38
Good Luck!