map algebra and beyond: 1. map algebra for scalar fields xingong li university of kansas 3 nov 2009

48
Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Upload: barbra-porter

Post on 23-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra and Beyond:1. Map Algebra for Scalar

Fields

Xingong LiUniversity of Kansas

3 Nov 2009

Page 2: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Topics

• The conventional map algebra– Local operations– Focal operations– Zonal operations– Global operations

Page 3: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra

Precipitation-

Losses (Evaporation,

Infiltration)=

Runoff

5 22 3

2 43 3

7 65 6

-

=

• Raster layers are manipulated by math-like expression to create new raster layers

Page 4: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra Operations

• Tomlin (1990) defines and organizes operations as local, focal, zonal, and global according to the spatial scope of the operations– Geographic Information System and Cartographic

Modeling, Englewood Cliffs: Prentice Hall, 1990.

Local ZonalFocal Global

Page 5: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Local Operations

• Compute a new raster layer.

• The value for each cell on the output layer is a function of one or more cell values at the same location on the input layer(s).

Page 6: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Local Operations

• Arithmetic operations

+, -, *, /, Abs, …

• Relational operators

>, <, …

• Statistic operations

Min, Max, Mean, Majority, …

• Trigonometric operations

Sine, Cosine, Tan, Arcsine, Arccosine, …

• Exponential and logarithmic operations

Sqr, sqrt, exp, exp2, …

Page 7: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Local Operation--Examples

9 9 7

9 8 5

6 3 0

0 0 2

0 0 1

0 0 0

9 9 9

9 8 6

6 3 0+ =

9 9 7

9 8 5

6 3 0

0 0 2

0 0 1

0 0 0

N N 3.5

N N 5

N N N/ =

Page 8: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Removing Clouds Using a Local Operation

• Two consecutive ocean surface temperature raster layers for the same area (measured at a slightly different time).

Images are from: http://rs.gso.uri.edu/amy/avhrr.html

Page 9: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

30-Year (1971-2000) Monthly PRISM Precipitation

Dec.

Oct.

Aug.

Jun.

Apr.

Feb.

How do we define seasonality of precipitation at a single

location?

Page 10: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Seasonality at San Francisco

[4.01 3.48 2.69 1.30 0.48 0.11 0.01 0.02 0.19 0.74 1.57 4.09]

Total = 18.69”

Page 11: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Monthly Precipitation as a Vector Quantity

1

2

3

4

530

210

60

240

90270

120

300

150

330

180

0

x=p*sin(monthAngle)y=p*cos(monthAngle)

Each month’s duration is equivalent to a 30° angleMonthly data are plotted at midpoint: 15°, 45°, 75°, ……

Page 12: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Seasonality Analysis

5

10

1530

210

60

240

90270

120

300

150

330

180

0

Monthly precipitation (in inches): [4.01 3.48 2.69 1.30 0.48 0.11 0.01 0.02 0.19 0.74 1.57 4.09]

1

2

3

4

530

210

60

240

90270

120

300

150

330

180

0

x=p*sin(monthAngle)y=p*cos(monthAngle) Add all vectors = Resultant vector

Page 13: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Seasonality at San Francisco

• Average monthly precipitation at San Francisco in inches– [4.01 3.48 2.69 1.30 0.48 0.11 0.01 0.02 0.19 0.74 1.57 4.09]

• Precipitation vectors– x=1.09, 2.46, 2.59, 1.26, 0.34, 0.03, 0, -0.01, -0.18, -0.71, -1.11, -

1.04– y=3.86, 2.47, 0.74, -0.32, -0.33, -0.11, -0.01, -0.01, -0.05, 0.19, 1.11,

3.95• Resultant vector

– sx=4.7– sy=11.5– Magnitude=12.41– Direction=22.25

• Time of occurrence – Direction in month (= January)

• Seasonality index– 1-magnitude of resultant vector/total precip.– = 1- (12.41/18.69)– = 0.34 (larger number means more uniform)

22.25°

Page 14: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Seasonality Analysis: Local functions at each cell over the whole domain

• sy– Cos(15) * [p01] + Cos(45) * [p02] + Cos(75) * [p03] + Cos(105)

* [p04] + Cos(135) * [p05] + Cos(165) * [p06] + Cos(195) * [p07] + Cos(225) * [p08] + Cos(255) * [p09] + Cos(285) * [p10] + Cos(315) * [p11] + Cos(345) * [p12]

• sx– Sin(15) * [p01] + Sin(45) * [p02] + Sin(75) * [p03] + Sin(105) *

[p04] + Sin(135) * [p05] + Sin(165) * [p06] + Sin(195) * [p07] + Sin(225) * [p08] + Sin(255) * [p09] + Sin(285) * [p10] + Sin(315) * [p11] + Sin(345) * [p12]

• Magnitude of resultant vector– Sqrt(Sqr([sx]) + Sqr([sy]))

• Total precipitation– [p01] + [p02] + [p03] + [p04] + [p05] + [p06] + [p07] + [p08] +

[p09] + [p10] + [p11] + [p12]• Seasonality

– 1 - ([Mag. Of resultant vector] / [Total Precip])

Page 15: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Time of Occurrence

Page 16: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Seasonality Index

Large number means more uniformSmall number means more seasonal

0.34

Page 17: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra Operations

• Operations are grouped as local, focal, zonal, and global according to the spatial scope of the operations.

Page 18: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Focal Operations• Compute an output value for each cell as a function of

the cells that are within its neighborhood

• Widely used in image processing with different names– Convolution, filtering, kernel or moving window

• Focal operations are spatial in nature

Page 19: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Neighborhoods

• The simplest and most common neighborhood is a 3 by 3 rectangle window

• Other possible neighborhoods – a rectangle, a circle, an annulus (a donut) or a wedge

Page 20: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Finding Appropriate Wind Farm Sites

• Wind speed– Higher elevation higher speed– Elevation (>= 1000m)

• Aspect– facing prevailing wind direction

• Wind exposure– Not blocked by nearby hills in the

prevailing wind direction

• Data – Prevailing wind direction

• 225 to 315– DEM

• Wedge neighborhood– 0 degree is East, counterclockwise

(135—225)

Page 21: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Wind Exposure Analysis

• Find max elevation in the prevailing wind direction– FocalMax with a wedge neighborhood

• Find cells not blocked by hills in the neighborhood– DEM > FocalMax

Page 22: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra Operations

• Operations are grouped as local, focal, zonal, and global according to the spatial scope of the operations.

Page 23: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Zonal Operations

• Compute a new value for each cell as a function of the cell values within a zone containing the cell

• Zone layer– defines zones

• Value layer– contains input cell values

Page 24: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Zonal Statistical Operations

• Calculate statistics for each cell by using all the cell values within a zone

• Zonal statistical operations:– ZonalMean, ZonalMedian, ZonalSum,

ZonalMinimum, ZonalMaximum, ZonalRange, ZonalMajority, ZonalVariety, ….

Page 25: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Zonal Statistical Operation Example

1 1 4 3 3

1 1 4 3 3

2 2 2 3 4

2 1 2 3 4

1 1 4 4 4

1 2 3 4 5

6 7 8 9 1

2 3 4 5 6

7 8 9 1 2

3 4 5 6 7

Zone Layer Value Layer

ZonalMax

Output Layer

8 8 8 9 9

8 8 8 9 9

9 9 9 9 8

9 8 9 9 8

8 8 8 8 8

Page 26: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Outputs of Zonal Operations

• Raster layer– All the cells within a zone have

the same value on the output raster layer

• Table– Each row in the table contains

the statistics for a zone.

– The first column is the value (or ID) of each zone.

– The table can be joined back to the zone layer.

Page 27: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

NEXRAD Cell Precipitation

Measurement spatial resolution

Page 28: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Subwatershed Precipitation from NEXRAD Cells Precipitation

model/application resolution

Page 29: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

NEXRAD Subwatershed Precipitation

Page 30: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Calculating Subwatershed Precipitation Depth

i

ii

a

pa

aaaa

papapapa ***** depth precip. edsubwatersh

4321

44332211

p1 p2

p3 p4

a1a2

a3 a4

mean zonal*

* depth precip. edsubwatersh

So, . size cell is layer, edsubwatershraster aWith

n

p

an

pa

a

pa

aa

ii

i

ii

i

pi—precipitation depth in an hour

ai—portion of the watershed that falls in the ith cell

Page 31: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Map Algebra Operations

• Operations are grouped as local, focal, zonal, and global according to the spatial scope of the operations.

Page 32: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Global Operations

• Operations that compute an output raster where the value of each output cell is a function of all the cells in the input raster

• Global statistical operations

• Distance operations.

– Euclidean distance

– Cost distance

Page 33: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Distance Operations

• Characterize the relationships between each cell and source cells (usually representing features)– Distance to nearest source cell

– Direction to nearest source cell

Page 34: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Euclidean Distance Operation

1 1

1

2

• Calculates the shortest straight distance from each cell to its nearest source cell (EucDistance)

• Assigns each cell the value of its nearest source cell (EucAllocation)

• Calculates the direction from each cell to its nearest source cell (EucDirection)

1 1 1 1 1 1

1 1 1 1 1 1

1 1 1 1 1 1

2 1 1 1 1 1

2 2 2 1 1 1

2 2 2 2 2 1

Page 35: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

EucDistance Example

Buffers can be delineated from the distance raster

Page 36: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

EucAllocation Example

Thesisen’s polygon

Voronoi diagram

Page 37: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Non-Euclidean Distance (Cost Distance)

• Straight line distance (between A and B) is a type of cost

• Cost could also be measured as time or money spent• Friction may vary space• Least cost and least-cost-path

Page 38: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

CostDistance Operation

• Compute the least accumulative cost from each cell to its least-cost source cell

• Source raster– Representing features (points,

lines, and polygons) – No-source cells are set to

NODATA value

• Friction raster– Cost encountered while moving in

a cell (distance, time, dollars and efforts)

– Unit is: cost per unit distance– Can have barriers (NODATA cells)

friction

source

Page 39: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Fungus Invasion

• Fungus spreading depends on the availability of precipitation

• A fungus is introduced at a seaport in January 1

• Questions

– Which area would be affected by July?

– Will the fungus reach Austin by the end of July?

Page 40: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Fungus Spreading Speed

• Fungus travel speed depends on precipitation.

– < 100 mm/month, 0 m/day

– 100 – 200 mm/month, 4000 m/day

– > 200 mm/month, 7000 m/day

Page 41: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

The Friction Raster

Friction = 1 / speed

Unit of the friction raster:days per unit distance

Travel speed

Page 42: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

The Least Cost Raster

What do the values mean on the cost raster layer?

The days that the fungus will take to reach a cell

Page 43: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Friction Varies in Space & Time

• Precipitation varies both in space and time.

• How could we model the spreading of the fungus now?

AprilFebruary

Page 44: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Fungus Invasion

Page 45: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Fungus Invasion by Month

Page 46: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Sum of Two Cost Surfaces

The least cost between A and B and passes through a cell.

Page 47: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Corridor Analysis

Corridor = accumulative cost < a threshold value

Page 48: Map Algebra and Beyond: 1. Map Algebra for Scalar Fields Xingong Li University of Kansas 3 Nov 2009

Summary Concepts

• What you have just seen is the basis for the map algebra language in ArcGIS Grid and Spatial Analyst– Local functions

– Focal functions

– Zonal functions

– Global functions