Project

General

Profile

« Previous | Next » 

Revision 8ceb6da6

Added by Jim Regetz over 13 years ago

  • ID 8ceb6da6eb50a1f1621d0fee16f8fe42fd14b40b

numerous changes and revisions to boundary assessment doc

View differences:

terrain/boundary/boundary.Rnw
13 13
% To extract R code from within R:
14 14
%   Stangle("<filename.Rnw>", annotate=FALSE)
15 15
\documentclass[8pt]{article}
16
\usepackage[final]{pdfpages}
17 16
\usepackage{fancyhdr}
17
\usepackage[font=small,labelfont=bf]{caption}
18 18
\usepackage[font=normalsize,singlelinecheck=false]{subfig}
19 19

  
20 20

  
21 21
\title{SRTM/ASTER boundary analysis}
22 22
\author{Jim Regetz}
23
\date{Last update: 23 Jun 2011}
23
\date{Last update: 08 Jul 2011}
24 24

  
25 25
%\SweaveOpts{echo=true}
26 26
\usepackage[utf8]{inputenc}
......
29 29
\usepackage{listings}
30 30
\usepackage[colorlinks=true,urlcolor=red]{hyperref}
31 31
\usepackage{color}
32

  
33
%\topmargin 70pt
32
\usepackage{xspace}
34 33

  
35 34
\pagestyle{fancy}
36 35
\rfoot{}
......
38 37
\renewcommand {\headrulewidth}{0pt}
39 38
\renewcommand {\footrulewidth}{0pt}
40 39

  
40
% define degree command for convenience
41
\newcommand{\N}{\ensuremath{^\circ\mbox{N}}\xspace}
42
\newcommand{\W}{\ensuremath{^\circ\mbox{W}}\xspace}
43

  
44

  
41 45
% set some listings options
42 46
\lstset{
43 47
  basicstyle=\small\ttfamily,
......
48 52

  
49 53
\begin{document}
50 54

  
51
% define custom colors for R input and output
52
\definecolor{dkblue}{rgb}{0,0,0.7}
53
\definecolor{dkgray}{gray}{0.25}
54

  
55
% define simple macro for marking up inline R code
56
\def\rfunc#1{\textcolor{dkblue}{\texttt{#1}}}
57
\def\robj#1{\textcolor{black}{\texttt{#1}}}
58

  
59
% nicer settings from Ross Ihaka
60
\DefineVerbatimEnvironment{Sinput}{Verbatim} %  {xleftmargin=2em,formatcom=\color{dkblue},fontsize=\footnotesize}
61
  {xleftmargin=2em,formatcom=\color{dkblue}}
62
\DefineVerbatimEnvironment{Soutput}{Verbatim}
63
%  {xleftmargin=2em,formatcom=\color{dkgray},fontsize=\footnotesize}
64
  {xleftmargin=2em,formatcom=\color{dkgray}}
65
\DefineVerbatimEnvironment{Scode}{Verbatim}{xleftmargin=2em}
66
\fvset{listparameters={\setlength{\topsep}{0pt}}}
67
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}
68

  
69
% set some specific R options that affect the output format
70
<<echo=FALSE,print=FALSE>>=
71
options(width=80)
72
options(continue=" ")
73
@
55
\maketitle
56

  
57
% don't number document sections
58
\setcounter{secnumdepth}{-1}. 
59

  
60
\paragraph{Summary of findings}
61
\begin{itemize}
62
 \item Big SRTM vs ASTER differences:
63
  \begin{itemize}
64
   \item ASTER is generally lower, by 12 meters in the median case
65
   \item ASTER has numerous spurious spikes
66
   \item ASTER has more high-frequency variability (``texture''),
67
     affecting slope/aspect?
68
  \end{itemize}
69
 \item Northward exponential rampdown of boundary delta
70
  \begin{itemize}
71
   \item fixes seam itself
72
   \item leaves abrupt transition in SRTM/ASTER textural differences
73
   \item introduces ridging
74
  \end{itemize}
75
 \item Blending via multiresolution spline
76
  \begin{itemize}
77
   \item fixes seam itself
78
   \item leaves abrupt transition in SRTM/ASTER textural differences
79
  \end{itemize}
80
 \item Blending via Gaussian weighted average of SRTM/ASTER
81
  \begin{itemize}
82
   \item fixes seam itself
83
   \item smooths transition in textural differences
84
  \end{itemize}
85
 \item Canada DEM itself has problems
86
  \begin{itemize}
87
   \item 60\N coincides with provincial boundaries; there are
88
     clear 60\N artifacts in this layer!
89
   \item other evident tiling artifacts too
90
  \end{itemize}
91
 \item Other comments
92
  \begin{itemize}
93
   \item N/S bias to aspect, flow direction computed on unprojected data
94
     at higher latitudes?
95
   \item Routing will be a big ball of wax
96
  \end{itemize}
97
\end{itemize}
98

  
99
\paragraph{To do (possibly)}
100
\begin{itemize}
101
 \item add constant offset to ASTER? or maybe a modeled offset (e.g., as
102
       a function of elevation)?
103
 \item smooth ASTER?
104
\end{itemize}
74 105

  
75
\paragraph{Region of analysis} For testing purposes, I used a narrow
76
band along the 60N boundary in Canada (Figure \ref{focal-area}). The
77
latitudinal extent of this band is 59.875N - 60.125N (i.e., 300 3"
78
pixels straddling 60N), and the longitudinal extent is 136W to 96W
79
(i.e., 48000 pixels wide).
106
\clearpage
80 107

  
81
\begin{figure}[htp]
108
\section{Terrain layer production methodology}
109

  
110
For the purposes of assessing artifacts associated with the 60\N boundary
111
between SRTM and ASTER, I used a narrow band along the 60\N boundary in
112
Canada (Figure \ref{focal-area}). The latitudinal extent of this band is
113
59.875\N - 60.125\N (i.e., 300 3" pixels straddling 60\N), and the
114
longitudinal extent is 136\W to 96\W (i.e., 48000 pixels wide). For flow
115
direction, a smaller longitudinal swath from 125\W to 100\W was used, due
116
to a $\sim$30k ($2^{15}$) limit to the input raster dimension size in
117
the pre-built GRASS \texttt{r.terraflow} module I used.
118

  
119
\begin{figure}%[htp]
82 120
  \caption{Focal area}
83 121
  \centering
84 122
<<echo=FALSE,results=hide,fig=TRUE,height=5,width=7>>=
......
100 138
  \label{focal-area}
101 139
\end{figure}
102 140

  
103
\paragraph{Fusion approaches} This document includes latitudinal
104
characterizations of terrain values based on three different variants of
105
a fused ASTER/SRTM DEM. I also explored (and briefly describe below) two
106
additional approaches to fusing the layers, but do not include further
107
assessment of these here.
108

  
109
\subparagraph{Simple fusion} Naive concatentation of SRTM below 60N with
110
ASTER above 60N, without applying any modifications to deal with
111
boundary artifacts (Figure \ref{blend-simple}).
112

  
113
\subparagraph{Multiresolution spline} Application of Burt \& Adelson's
114
(1983) method for blending overlapping images using multiresolution
115
splines, as implmented in the \emph{enblend} software package. Data prep
116
and post-processing were handled in R (see Listing \ref{code-enblend}).
117
As presented here, the ASTER and SRTM inputs were prepared such that the
118
overlap zone is 75 latitudinal rows (6.75km) (Figure
119
\ref{blend-multires}).
120

  
121
\subparagraph{Gaussian weighted average} Blend of the two layers using
122
weighted averaging such that the relative contribution of the SRTM
123
elevation is zero at 60N, and increases according to a Gaussian function
124
of distance moving south away from 60N. As presented here, this function
125
was parameterized such that the ASTER and SRTM are equally weighted at a
126
distance of $\sim$2.4km (26 cells) from the boundary, and the influence of
127
ASTER is negligible by $\sim$5km from the boundary (Figure
128
\ref{blend-gaussian}).
129

  
130
\subparagraph{Others not shown} Fused with exponential ramp north of
131
60N. The first step is to take the pixel-wise difference between ASTER
132
and SRTM in the row immediately below 60N (i.e., the northmost extent of
133
SRTM). An exponentially declining fraction of this difference is then
134
then added back into the ASTER values north of 60N. This does a fine job
135
of eliminating the artificial shelf and thus the appearance of a seam
136
right along the 60N boundary, but it does not address the abrupt
137
transition in texture (i.e., the sudden appearance of high frequency
138
variability moving north across the boundary). Additionally, it
139
introduces vertical ``ridges'' running north from the boundary. These
140
arise because the calculated ramps are independent from one longitudinal
141
``column'' to the next, and thus any changes in the boundary difference
142
from one pixel to the next lead to adjacent ramps with different
143
inclines.
144

  
145
I also tried a simple LOESS predictive model. This involved first
146
calculating the difference between ASTER and SRTM everywhere south of
147
60N, and then fitting a LOESS line to these differences using the actual
148
ASTER elevation as a predictor. I then used the fitted model to predict
149
the ASTER-SRTM difference for ASTER cells north of 60N, and add a
150
declining fraction (based on a Gaussian curve) of this difference to the
151
ASTER values north of 60N. Conceptually, this amounts to applying an
152
ASTER-predicted correction to the ASTER elevation values, where the
153
correction term declines to zero according with increasing distance
154
north of the bonudary. However, this method alone didn't yield
155
particularly promising results in removing the 60N seam itself,
156
presumably because adding a predicted correction at the boundary does
157
not close the SRTM-ASTER gap nearly as efficiently as do corrections
158
that are based on the actual elevation values. I therefore haven't
159
pursued this any further, although it (or something like it) may prove
160
useful in combination with one of the other methods.
161

  
162 141
\begin{figure}
163
  \caption{SRTM/ASTER blend configurations}
142
  \caption{SRTM/ASTER DEM fusion configurations}
164 143
  \centering
165 144
  \subfloat[Simple fusion]{
166 145
    \label{blend-simple}
......
213 192
  }
214 193
\end{figure}
215 194

  
216
\newpage
195
\paragraph{Elevation} This document includes latitudinal
196
characterizations of terrain values based on three different variants of
197
a fused ASTER/SRTM DEM. I also explored (and briefly describe below) two
198
additional approaches to fusing the layers, but do not include further
199
assessment of these here.
217 200

  
218
%\includepdfset{pagecommand=\thispagestyle{fancy}}
219
%\setkeys{Gin}{width=1.8\linewidth}
220
%\captionsetup[table]{position=top}
201
\subparagraph{Simple fusion} Naive concatentation of SRTM below 60\N with
202
ASTER above 60\N, without applying any modifications to deal with
203
boundary artifacts (Figure \ref{blend-simple}).
221 204

  
205
\subparagraph{Multiresolution spline} Application of Burt \& Adelson's
206
(1983) method for blending overlapping images using multiresolution
207
splines, as implemented in the \emph{enblend} software package (version
208
4.0, http://enblend.sourceforge.net). Data prep and post-processing were
209
handled in R (see Listing \ref{code-enblend}). As presented here, the
210
ASTER and SRTM inputs were prepared such that the overlap zone is 75
211
latitudinal rows (6.75km) (Figure \ref{blend-multires}).
222 212

  
223
\paragraph{Latitudinal terrain profiles (means)}
213
\subparagraph{Gaussian weighted average} Blend of the two layers using
214
weighted averaging such that the relative contribution of the SRTM
215
elevation is zero at 60\N, and increases according to a Gaussian function
216
of distance moving south away from 60\N (Equation \ref{eq-gaussian}).
217
\begin{eqnarray}
218
\label{eq-gaussian}
219
&fused_{x,y} =
220
  \left\{
221
    \begin{array}{c l}
222
      ASTER_{x,y} & \mbox{above } 60^\circ \mbox{N} \\
223
      w_{x,y}ASTER_{x,y} + (1-w_{x,y})SRTM_{x,y} & \mbox{below } 60^\circ \mbox{N}
224
    \end{array}
225
  \right.\\
226
&\mbox{where }
227
  w_{x,y}=e^{-rD_{y}^{2}}
228
  \mbox{ and }
229
  D_{y} \mbox{ is the distance from } 60^\circ \mbox{N in units of pixels.} \nonumber
230
\end{eqnarray}
231
For the assessment presented here, the Gaussian weighting function
232
function was parameterized using $r=0.001$, which means that the ASTER
233
and SRTM are equally weighted at a distance of $\sim$2.4km (26 cells)
234
south of the the boundary, and the influence of ASTER is negligible by
235
$\sim$5km (Figure \ref{blend-gaussian}).
224 236

  
225
\subparagraph{Elevation} As indicated in Figure \ref{mean-elevation},
226
the mean SRTM elevation is uniformly higher than the mean ASTER
227
elevation at all latitudes in the area of overlap, by $\sim$11 meters.
228
However, the shape of the profile itself is nearly identical between the
229
two. As point of reference, the Canada DEM shares a similarly shaped
230
profile, but with elevation values intermediate to the ASTER and SRTM.
237
\subparagraph{Others not shown} Fused with exponential ramp north of
238
60\N. The first step is to take the pixel-wise difference between ASTER
239
and SRTM in the row immediately below 60\N (i.e., the northmost extent of
240
SRTM). An exponentially declining fraction of this difference is then
241
then added back into the ASTER values north of 60\N. This does a fine job
242
of eliminating the artificial shelf and thus the appearance of a seam
243
right along the 60\N boundary, but it does not address the abrupt
244
transition in texture (i.e., the sudden appearance of high frequency
245
variability moving north across the boundary). Additionally, it
246
introduces vertical ``ridges'' running north from the boundary. These
247
arise because the calculated ramps are independent from one longitudinal
248
``column'' to the next, and thus any changes in the boundary difference
249
from one pixel to the next lead to adjacent ramps with different
250
inclines.
231 251

  
232
Not surprisingly, simple fusion produces an artificial cliff in the mean
233
elevation profile. This artifact is completely removed by both the
234
multiresolution spline and gaussian weighted average methods. The
235
transition is, at least to the eye, slightly smoother in the former
236
case, although ultimately this would depend on the chosen zone of
237
overlap and on the exact parameterization of the weighting function.
252
I also tried a simple LOESS predictive model. This involved first
253
calculating the difference between ASTER and SRTM everywhere south of
254
60\N, and then fitting a LOESS line to these differences using the actual
255
ASTER elevation as a predictor. I then used the fitted model to predict
256
the ASTER-SRTM difference for ASTER cells north of 60\N, and add a
257
declining fraction (based on a Gaussian curve) of this difference to the
258
ASTER values north of 60\N. Conceptually, this amounts to applying an
259
ASTER-predicted correction to the ASTER elevation values, where the
260
correction term declines to zero according with increasing distance
261
north of the bonudary. However, this method alone didn't yield
262
particularly promising results in removing the 60\N seam itself,
263
presumably because adding a predicted correction at the boundary does
264
not close the SRTM-ASTER gap nearly as efficiently as do corrections
265
that are based on the actual elevation values. I therefore haven't
266
pursued this any further, although it (or something like it) may prove
267
useful in combination with one of the other methods.
238 268

  
269
\paragraph{Slope}
270
For each of the three main fused DEM variants described above, slope was
271
calculated using \texttt{gdaldem}:
272
\begin{verbatim}
273
    $ gdaldem slope -s 111120 <input_elevation> <output_slope>
274
\end{verbatim}
275
Note that the scale option used here is as recommended in the
276
\texttt{gdaldem} documentation:
277
\begin{quote}
278
  \emph{If the horizontal unit of the source DEM is degrees (e.g
279
  Lat/Long WGS84 projection), you can use scale=111120 if the vertical
280
  units are meters}
281
\end{quote}
282
The output slope raster is in units of degrees.
283

  
284
\paragraph{Aspect}
285
As was the case with slope, aspect was calculated using
286
\texttt{gdaldem}:
287
\begin{verbatim}
288
    $ gdaldem aspect -s 111120 <input_elevation> <output_aspect>
289
\end{verbatim}
290
The output aspect raster values indicate angular direction in units of
291
degrees, with 0=North and proceeding clockwise.
292

  
293
\paragraph{Flow direction}
294
Flow direction was calculated using the GRASS \texttt{r.terraflow}
295
module; see code listing \ref{code-flowdir}. The default flow direction
296
output of this module is encoded so as to indicate \emph{all} downslope
297
neighbors, also known as the Multiple Flow Direction (MFD) model. However, to
298
simplify post-processing and summarization, the results here are based
299
on an alternative Single Flow Direction (SFD, \emph{a.k.a.} D8) model,
300
which indicates the neighbor associated with the steepest downslope
301
gradient. Note that this is equivalent to what ArcGIS GRID
302
\texttt{flowaccumulation} command does. I then recoded the output raster
303
to use the same azimuth directions used by \texttt{gdaldem aspect}, as
304
described above for aspect.
239 305

  
240
\subparagraph{Slope} As indicated in Figure \ref{mean-slope},
241
the mean ASTER slope is uniformly steeper than the mean SRTM
242
elevation at all latitudes in the area of overlap, by nearly 1 degree.
243
However, the shape of the profile itself is nearly identical between the
244
two. Although this may partly reflect inherent SRTM vs ASTER
245
differences, my guess is that CGIAR postprocessing of the particular
246
SRTM product we're using has removed some of the high frequency
247
``noise'' that remains in ASTER.
306
%
307
% Elevation differences between SRTM and ASTER
308
%
248 309

  
249
Note that the he Canada DEM tends to be flatter than both ASTER and
310
<<echo=FALSE,results=hide>>=
311
  library(raster)
312
  demdir <- "/home/regetz/media/temp/terrain/dem/"
313
  d.srtm <- raster(file.path(demdir, "srtm_150below.tif"))
314
  d.aster <- raster(file.path(demdir, "aster_300straddle.tif"))
315
  delta.median <- median(values(d.srtm) - values(crop(d.aster,
316
      extent(d.srtm))))
317
  delta.mean <- mean(values(d.srtm) - values(crop(d.aster,
318
      extent(d.srtm))))
319
@
320

  
321
\begin{figure}
322
  \caption{ASTER vs SRTM elevation comparisons}
323
  \centering
324
  \subfloat[Boxplots of the arithmetic difference in elevations (ASTER -
325
  SRTM), summarized across a series of ASTER elevation bins. Boxes
326
  include the median (horizontal band), 1st and 3rd quartiles (box
327
  extents), and $\pm$1.5$\times$IQR (whiskers). Gray numbers above each whisker
328
  indicates how many thousands of pixels are included in the
329
  corresponding summary. Dashed red line indicates the median difference
330
  across all pixels south of 60\N.]{
331
    \includegraphics[width=\linewidth]{../dem/aster-srtm-bins.png}
332
    \label{aster-srtm-bins}
333
  }\\
334
  \subfloat[Pixel-wise plot of ASTER vs SRTM for all values in the 150
335
  latitudinal rows of overlap south of 60\N. Dashed blue line indicates
336
  the 1:1 diagonal, and the parallel red line is offset lower by the
337
  observed median difference between ASTER and SRTM
338
  (\Sexpr{delta.median}).]{
339
    \includegraphics[width=\linewidth]{../dem/aster-srtm-scatter.png}
340
    \label{aster-srtm-scatter}
341
  }
342
  \label{aster-srtm}
343
\end{figure}
344

  
345
%
346
% Latitudinal terrain profiles (means)
347
%
348

  
349
\begin{figure}
350
  \centering
351
  \caption{Mean elevation (m)}
352
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../dem/elevation-assessment.pdf}
353
    \label{mean-elevation}
354
\end{figure}
355
\begin{figure}
356
  \centering
357
  \caption{Mean slope (degrees)}
358
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../slope/slope-assessment.pdf}
359
    \label{mean-slope}
360
\end{figure}
361
\begin{figure}
362
  \centering
363
  \caption{Circular mean aspect (azimuth)}
364
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../aspect/aspect-assessment.pdf}
365
    \label{mean-aspect}
366
\end{figure}
367
\begin{figure}
368
  \centering
369
  \caption{Circular mean flow direction}
370
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../flow/flowdir-assessment.pdf}
371
    \label{mean-flowdir}
372
\end{figure}
373

  
374
\clearpage
375

  
376
\section{Latitudinal mean terrain profiles}
377

  
378
\paragraph{Elevation} ASTER, SRTM, and the Canada DEM all share a very
379
similarly shaped mean elevation profile, but with differing heights
380
(Figure \ref{mean-elevation}). SRTM tends to be highest, ASTER is
381
lowest, and the Canada DEM is intermediate. The magnitude of average
382
difference between SRTM and ASTER is fairly consistent not only across
383
latitudes, but also across elevations (Figure \ref{aster-srtm}). The
384
overall median difference between ASTER and SRTM is \Sexpr{delta.median}
385
meters (mean=\Sexpr{round(delta.mean, 2)}), and this more or less holds
386
(within a few meters) across the observed range of elevations (Figure
387
\ref{aster-srtm-bins}). However, while this \emph{average} offset is
388
consistent, considerably more variation is evident at the pixel level.
389
The interquartile range in ASTER-SRTM differences spans $\sim$10 meters
390
(Figure \ref{aster-srtm-bins}), and there are many pixels for which the
391
elevation difference is on the order of 100 meters (note width of cloud
392
about the diagonal lines in Figure \ref{aster-srtm-scatter}). Figure
393
\ref{aster-srtm-scatter} also highlights the existence of numerous ASTER
394
spurious spikes of >1000m; although not shown here, these tend to occur
395
in small clumps of pixels, perhaps corresponding to false elevation
396
readings associated with clouds?
397

  
398
Not surprisingly, simple fusion produces an artificial $\sim$12m cliff
399
in the mean elevation profile (Figure \ref{mean-elevation}). At least in
400
terms of mean elevation, this artifact is completely removed by both the
401
multiresolution spline and gaussian weighted average methods. The
402
transition is, to the eye, slightly smoother in the former case,
403
although ultimately this would depend on the chosen zone of overlap and
404
on the exact parameterization of the weighting function.
405

  
406
\paragraph{Slope} The mean ASTER slope is uniformly steeper than the
407
mean SRTM slope at all latitudes in the area of overlap, by nearly 1
408
degree (Figure \ref{mean-slope}). However, the shape of the profile
409
itself is nearly identical between the two. Although this may partly
410
reflect inherent SRTM vs ASTER differences, my guess is that CGIAR
411
postprocessing of the particular SRTM product we're using has removed
412
some of the high frequency ``noise'' that remains in ASTER?
413
\textbf{\color{red}[todo: check!]}
414

  
415
Note that the the Canada DEM tends to be flatter than both ASTER and
250 416
SRTM (presumably because it is at least partially derived from
251
contour-based data (\textbf{check!})). Moreover, this figure makes it
417
contour-based data \textbf{\color{red}[todo: check!]}. Moreover, this figure makes it
252 418
clear that the Canada DEM has some major artifacts at regular intervals.
253
The spike especially at 60N (which coincides with provincial boundaries
419
The spike especially at 60\N (which coincides with provincial boundaries
254 420
across the entirety of western Canada) means we probably need to scuttle
255 421
our plans to use this DEM as a reference dataset for boundary analysis.
256 422

  
257 423
The simple fused layer exhibits a dramatic spike in slope at the
258
immediate 60N boundary, undoubtedly associated with the artificial
424
immediate 60\N boundary, undoubtedly associated with the artificial
259 425
elevation cliff. This artifact is eliminated by both the multiresolution
260
spline and gaussian weighting. However, former exhibits a sudden step
426
spline and gaussian weighting. However, the former exhibits a sudden step
261 427
change in slope in the SRTM-ASTER overlap region, whereas the transition
262 428
is smoothed out in the latter. This likely reflects the fact that the
263 429
multiresolution spline effectively uses a very narrow transition zone
264 430
for stitching together high frequency components of the input images,
265
and I surmise these are precisely the features responsible for the shift
266
in mean slope. 
267

  
268
\subparagraph{Aspect} As indicated in Figure \ref{mean-aspect},
269
the mean aspect of ASTER and SRTM are quite similar across all latitudes
270
in the area of overlap. However, the shape of the
271
profile itself is nearly identical between the
272
two. Although this may partly reflect inherent SRTM vs ASTER
273
differences, my guess is that CGIAR postprocessing of the particular
274
SRTM product we're using has removed some of the high frequency
275
``noise'' that remains in ASTER.
276

  
277
%TODO: recalc aspect using circular mean?
278
%TODO: run flow for enblend output? or just leave what we have, and
279
%discuss that? be sure to mention that we're doing flow for a smaller
280
%longitudinal range
431
and it seems likely that these are precisely the features responsible
432
for the shift in mean slope. 
433

  
434
\paragraph{Aspect}
435
For the purposes of latitudinal profiles, aspect values were summarized
436
using a circular mean (Equation \ref{eq-cmean}).
437
\begin{equation}
438
 \bar{x} = \mathrm{atan2}
439
   \left(
440
    \sum_{i=1}^{n}\frac{\sin(x_i)}{n},
441
    \sum_{i=1}^{n}\frac{\cos(x_i)}{n}
442
   \right )
443
\label{eq-cmean}
444
\end{equation}
445
where $x_i$ is the aspect value (in radians) of pixel $i$.
446

  
447
As indicated in Figure \ref{mean-aspect}, the circular mean aspect
448
values of ASTER and SRTM are generally similar across all latitudes in
449
the area of overlap, and mean aspect values calculated on the Canada DEM
450
are similar at most but not all latitudes. The mean values at nearly all
451
latitudes are directed either nearly north or nearly south, though
452
almost always with a slight eastward rather than westward inclination.
453
In fact, there appears to be a general bias towards aspect values
454
orienting along the north-south axis, as is especially apparent in the
455
rose diagrams of Figure \ref{rose-diag-aspect}. I suspect this is an
456
artifact of our use of unprojected data, especially at these high
457
latitudes. Because the unprojected raster is effectively 'stretched'
458
east and west relative to the actual topography, elevational gradients
459
along the east-west axis are artificially flattened, and the direction
460
of dominant gradient is more likely to be along the north-south axis.
461

  
462
Upon further reflection, it's not clear whether these patterns of mean
463
aspect are particular useful diagnostics, as they seems to be sensitive
464
to subtle variations in the data. Referring again to Figure
465
\ref{rose-diag-aspect}, note how the mean direction flips from nearly
466
north to nearly south between the two latitudes, even though the
467
distributions of pixel-wise aspect values are nearly indistinguishable
468
by eye.
469

  
470
In any case, not surprisingly, the simple fused layer matches the SRTM
471
aspect values south of 60\N and the ASTER aspect values north of 60\N; at
472
the immediate boundary, the mean aspect is northward, as one would
473
expect in the presence of a cliff artifact at the seam.
474

  
475
Interestingly, the aspect layers derived from the two blended DEMs
476
(muliresolution spline and weighted Gaussian average) exhibit a
477
consistent mean northward inclination at all latitudes in their
478
respective fusion zones. This pattern is visually obvious at latitudes
479
between 59.95\N and 60\N in the bottom two panels of Figure
480
\ref{mean-aspect}. This is almost certainly a signal of the blending of
481
the lower elevation ASTER to the north with higher elevation SRTM to the
482
south. 
483

  
484
\begin{figure}[h!]
485
  \caption{Binned frequency distributions of aspect within two selected
486
    latitudinal strips: (a) within the SRTM-ASTER blend zone, and (b)
487
    south of the overlap zone. Aspect values here are based on the DEM
488
    produced via Gaussian weighted averaging, but similar patterns are
489
    evident using the other DEMs. Red spoke lines indicate the circular
490
    mean direction across all pixels at the associated latitude.}
491
  \centering
492
<<echo=FALSE,results=hide,fig=TRUE,height=5,width=7>>=
493
  library(circular)
494
  aspdir <- "/home/regetz/media/temp/terrain/aspect"
495
  a.bg <- raster(file.path(aspdir, "fused_300straddle_blendgau_a.tif"))
496
  par(mfrow=c(1,2), mar=c(0,0,4,0))
497
  y1 <- 200
498
  y2 <- 220
499
  cx <- circular(as.matrix(a.bg)[c(y1,y2),], units="degrees",
500
      rotation="clock", zero=pi/2)
501
  rose.diag(cx[1,], bins=8, axes=FALSE)
502
  mtext(paste("(a)", round(yFromRow(a.bg, y1), 3), "degrees"))
503
  axis.circular(at=circular(c(pi/2, pi, 3*pi/2, 2*pi)),
504
      labels=c("N", "W", "S", "E"))
505
  points(mean.circular(cx[1,], na.rm=TRUE), col="red")
506
  lines.circular(c(mean.circular(cx[1,], na.rm=TRUE), 0), c(0,-1),
507
      lwd=2, col="red")
508
  rose.diag(cx[2,], bins=8, axes=FALSE)
509
  mtext(paste("(b)", round(yFromRow(a.bg, y2), 3), "degrees"))
510
  axis.circular(at=circular(c(pi/2, pi, 3*pi/2, 2*pi)),
511
      labels=c("N", "W", "S", "E"))
512
  points(mean.circular(cx[2,], na.rm=TRUE), col="red")
513
  lines.circular(c(mean.circular(cx[2,], na.rm=TRUE), 0), c(0,-1),
514
      lwd=2, col="red")
515
@
516
  \label{rose-diag-aspect}
517
\end{figure}
518

  
519
\paragraph{Flow direction} With the exception of edge effects at the
520
margins of the input rasters, mean ASTER-derived flow is northward at
521
all latitudes, and SRTM-derived flow is northward at nearly all
522
latitudes (Figure \ref{mean-flowdir}). This seems reasonable considering
523
that most pixels in this Canada test region fall in the Arctic drainage.
524
As was the case with aspect, note that a general north-south bias is
525
evident (Figure \ref{rose-diag-flowdir}, again likely due to use of an
526
unprojected raster at high latitudes.
527

  
528
The various fused layer profiles look as one would expect (Figure
529
\ref{mean-flowdir}), although the lack of latitudinal variability in
530
mean flow direction makes it hard to say much more than that. 
531

  
532
\begin{figure}[h!]
533
  \caption{Relative frequencies of D8 flow directions (indicated by
534
    relative heights of the blue spokes) within two selected
535
    latitudinal bands: (a) within the SRTM-ASTER blend zone, and (b)
536
    south of the overlap zone. Flow directions here are based on the DEM
537
    produced via Gaussian weighted averaging. Red spoke lines indicate
538
    the circular mean flow direction across all pixels at the associated
539
    latitude.}
540
  \centering
541
<<echo=FALSE,results=hide,fig=TRUE,height=5,width=7>>=
542
  library(circular)
543
  flowdir <- "/home/regetz/media/temp/terrain/flow"
544
  # create function to recode terraflow SFD values into degrees, with
545
  # 0=North and proceeding clockwise (this matches gdaldem's default
546
  # azimuth output for aspect calculation)
547
  recode <- function(r) {
548
      v <- values(r)
549
      v[v==0] <- NA
550
      v[v==1] <- 90  ## east
551
      v[v==2] <- 135
552
      v[v==4] <- 180  ## south
553
      v[v==8] <- 225
554
      v[v==16] <- 270  ## west
555
      v[v==32] <- 315
556
      v[v==64] <- 0  ## north
557
      v[v==128] <- 45
558
      r[] <- v
559
      return(r)
560
  }
561
  sfd.bg <- recode(raster(file.path(flowdir,
562
      "fused_300straddle_blendgau_sfd.tif")))
563
  par(mfrow=c(1,2), mar=c(0,0,4,0))
564
  y1 <- 200
565
  y2 <- 220
566
  cx <- circular(as.matrix(sfd.bg)[c(y1,y2),], units="degrees",
567
      rotation="clock", zero=pi/2)
568
  rose.diag(cx[1,], bins=1000, border="blue", ticks=FALSE, axes=FALSE)
569
  mtext(paste("(a)", round(yFromRow(sfd.bg, y1), 3), "degrees"))
570
  axis.circular(at=circular(c(pi/2, pi, 3*pi/2, 2*pi)),
571
      labels=c("N", "W", "S", "E"))
572
  #points(mean.circular(cx[1,], na.rm=TRUE), col="red")
573
  lines.circular(c(mean.circular(cx[1,], na.rm=TRUE), 0), c(0,-1),
574
      lwd=2, col="red")
575
  rose.diag(cx[2,], bins=1000, border="blue", ticks=FALSE, axes=FALSE)
576
  mtext(paste("(b)", round(yFromRow(sfd.bg, y2), 3), "degrees"))
577
  axis.circular(at=circular(c(pi/2, pi, 3*pi/2, 2*pi)),
578
      labels=c("N", "W", "S", "E"))
579
  #points(mean.circular(cx[2,], na.rm=TRUE), col="red")
580
  lines.circular(c(mean.circular(cx[2,], na.rm=TRUE), 0), c(0,-1),
581
      lwd=2, col="red")
582
@
583
  \label{rose-diag-flowdir}
584
\end{figure}
281 585

  
282 586
%
283
% Latitudinal terrain profiles (means)
587
% Latitudinal terrain profiles (correlations, RMSEs)
284 588
%
285
\begin{figure}[t!]
589
\section{Informal correlation analysis}
590

  
591
\paragraph{Elevation}
592

  
593
\paragraph{Slope}
594

  
595
\paragraph{Aspect}
596
Circular analogues of the Pearson correlation coefficient were
597
calculated using the \textbf{circular} R package function
598
\texttt{cor.circular}. I believe this implements the formula described
599
by Jammalamadaka \& Sarma (1988):
600
\begin{equation}
601
r = \frac
602
  {\sum_{i=1}^{n} \sin(x_i-\bar{x}) \sin(y_i-\bar{y})}
603
  {\sqrt{\sum_{i=1}^{n} \sin(x_i-\bar{x})^2}
604
   \sqrt{\sum_{i=1}^{n} \sin(y_i-\bar{y})^2}}
605
\label{eq-ccor}
606
\end{equation}
607

  
608
where $x_i$ and $y_i$ are aspect values (in radians) for pixel $i$, and
609
$\bar{x}$ and $\bar{y}$ are circular means calculated as in Equation
610
\ref{eq-cmean}.
611

  
612
\paragraph{Flow direction}
613
As with aspect, circular correlation coefficients were calculated for
614
each latitudinal band.
615

  
616
\begin{figure}
286 617
  \centering
287
  \caption{Latitudinal terrain profiles}
288
  \subfloat[Mean elevation (m)]{
289
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../dem/elevation-assessment.pdf}
290
    \label{mean-elevation}
618
  \caption{Elevation associations between original and fused layers}
619
  \subfloat[Elevation correlations]{
620
    \includegraphics[page=3, trim=1in 1in 1in 1in, width=\linewidth]{../dem/elevation-assessment.pdf}
621
    \label{corr-elevation}
291 622
  }\\
292
  \newpage
293
  \subfloat[Mean slope (degrees)]{
294
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../slope/slope-assessment.pdf}
295
    \label{mean-slope}
623
  \subfloat[Elevation RMSEs]{
624
    \includegraphics[page=2, trim=1in 1in 1in 1in, width=\linewidth]{../dem/elevation-assessment.pdf}
625
    \label{rmse-elevation}
296 626
  }
297 627
\end{figure}
298
\begin{figure}[h!]
299
  \ContinuedFloat
628

  
629
\begin{figure}
300 630
  \centering
301
  \captionsetup{position=top}
302
  \subfloat[Aspect (direction, 0=East)]{
303
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../aspect/aspect-assessment.pdf}
304
    \label{mean-aspect}
631
  \caption{Slope associations between original and fused layers}
632
  \subfloat[Slope correlations]{
633
    \includegraphics[page=3, trim=1in 1in 1in 1in, width=\linewidth]{../slope/slope-assessment.pdf}
634
    \label{corr-slope}
305 635
  }\\
306
  \subfloat[Flow (D8 direction, 0=East)]{
307
    \includegraphics[page=1, trim=1in 1in 1in 1in, width=\linewidth]{../flow/flowdir-assessment.pdf}
308
    \label{mean-flow}
636
  \subfloat[Slope RMSEs]{
637
    \includegraphics[page=2, trim=1in 1in 1in 1in, width=\linewidth]{../slope/slope-assessment.pdf}
638
    \label{rmse-slope}
309 639
  }
310 640
\end{figure}
311 641

  
312
\paragraph{Summary of findings}
313
\begin{itemize}
314
 \item CDEM itself has problems
315
  \begin{itemize}
316
   \item 60N coincides with provincial boundaries; there are clear 60N
317
     artifacts in this layer!
318
   \item other evident tiling artifacts too
319
  \end{itemize}
320
 \item Big SRTM vs ASTER differences:
321
  \begin{itemize}
322
   \item ASTER is generally lower elevation
323
   \item ASTER has more high-frequency variability ("texture"), which
324
     affects slope/aspect?
325
  \end{itemize}
326
 \item Exponential ramping
327
  \begin{itemize}
328
   \item fixes seam itself
329
   \item leaves dramatic transition in SRTM/ASTER textural differences
330
   \item introduces ridging
331
  \end{itemize}
332
 \item Blending
333
  \begin{itemize}
334
   \item fixes seam itself
335
   \item smooths transition in textural differences
336
  \end{itemize}
337
 \item Other comments
338
  \begin{itemize}
339
   \item Routing is a big ball of wax
340
  \end{itemize}
341
\end{itemize}
342

  
343
\paragraph{To do (possibly)}
344
\begin{itemize}
345
 \item add constant offset to ASTER? or maybe an offset that is a
346
 function of elevation? (revisit LOESS fit)
347
 \item smooth ASTER?
348
\end{itemize}
349

  
350
%TODO: include and discuss the RMSE/correlation plots
642
\begin{figure}
643
  \centering
644
  \caption{Aspect associations between original and fused layers}
645
  \subfloat[Aspect circular correlations]{
646
    \includegraphics[page=3, trim=1in 1in 1in 1in, width=\linewidth]{../aspect/aspect-assessment.pdf}
647
    \label{corr-aspect}
648
  }\\
649
  \subfloat[Aspect RMSEs]{
650
    \includegraphics[page=2, trim=1in 1in 1in 1in, width=\linewidth]{../aspect/aspect-assessment.pdf}
651
    \label{rmse-aspect}
652
  }
653
\end{figure}
351 654

  
352
%\includepdf[landscape=true,pages=-]{../dem/elevation-assessment.pdf}
353
%\includepdf[landscape=true,pages=-]{../slope/slope-assessment.pdf}
354
%\includepdf[landscape=true,pages=-]{../aspect/aspect-assessment.pdf}
355
%\includepdf[landscape=true,pages=-]{../flow/flowdir-assessment.pdf}
655
\begin{figure}
656
  \centering
657
  \caption{Flow direction associations between original and fused layers}
658
  \subfloat[Flow direction correlations]{
659
    \includegraphics[page=3, trim=1in 1in 1in 1in, width=\linewidth]{../flow/flowdir-assessment.pdf}
660
    \label{corr-flow}
661
  }\\
662
  \subfloat[Flow direction RMSEs]{
663
    \includegraphics[page=2, trim=1in 1in 1in 1in, width=\linewidth]{../flow/flowdir-assessment.pdf}
664
    \label{corr-flow}
665
  }
666
\end{figure}
356 667

  
357
\newpage
358 668

  
359 669
\appendix
360 670

  
671
\section{Code listings}
672

  
673
\clearpage
361 674
\lstinputlisting[language=R, caption={R wrapper code for multiresolution
362 675
    spline}, label=code-enblend]{../dem/enblend.R}
363 676

  
677
\clearpage
678
\lstinputlisting[language=bash, caption={GRASS code for computing
679
    flow directions}, label=code-flowdir]{../flow/flow-boundary.sh}
680

  
364 681
\end{document}
365 682

  

Also available in: Unified diff