Revision 3c841968
Added by Jim Regetz over 13 years ago
- ID 3c84196885571b2ed49c0b79b79ea17123a2926f
terrain/boundary/boundary.Rnw | ||
---|---|---|
1 |
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*- |
|
2 |
% |
|
3 |
% Using Gregor Gorjanc's bash script: |
|
4 |
% sweave -old=<pdfviewer> <filename.Rnw> |
|
5 |
% |
|
6 |
% Using my simple bash script wrapper: |
|
7 |
% sweave_jr <basename> |
|
8 |
% |
|
9 |
% Using the lower level commands, in two steps: |
|
10 |
% R CMD Sweave <filename.Rnw> |
|
11 |
% pdflatex <filename.tex> |
|
12 |
% |
|
13 |
% To extract R code from within R: |
|
14 |
% Stangle("<filename.Rnw>", annotate=FALSE) |
|
15 |
\documentclass[8pt]{article} |
|
16 |
\usepackage[final]{pdfpages} |
|
17 |
\usepackage{fancyhdr} |
|
18 |
\usepackage[font=normalsize,singlelinecheck=false]{subfig} |
|
19 |
|
|
20 |
\title{SRTM/ASTER boundary analysis} |
|
21 |
\author{Jim Regetz} |
|
22 |
\date{Last update: 23 Jun 2011} |
|
23 |
|
|
24 |
%\SweaveOpts{echo=true} |
|
25 |
\usepackage[utf8]{inputenc} |
|
26 |
\usepackage{a4wide} |
|
27 |
\usepackage{verbatim} |
|
28 |
\usepackage[colorlinks=true,urlcolor=red]{hyperref} |
|
29 |
|
|
30 |
\topmargin 70pt |
|
31 |
|
|
32 |
\pagestyle{fancy} |
|
33 |
\rfoot{} |
|
34 |
\cfoot{\Large\thepage} |
|
35 |
\renewcommand {\headrulewidth}{0pt} |
|
36 |
\renewcommand {\footrulewidth}{0pt} |
|
37 |
|
|
38 |
\begin{document} |
|
39 |
|
|
40 |
% define custom colors for R input and output |
|
41 |
\definecolor{dkblue}{rgb}{0,0,0.7} |
|
42 |
\definecolor{dkgray}{gray}{0.25} |
|
43 |
|
|
44 |
% define simple macro for marking up inline R code |
|
45 |
\def\rfunc#1{\textcolor{dkblue}{\texttt{#1}}} |
|
46 |
\def\robj#1{\textcolor{black}{\texttt{#1}}} |
|
47 |
|
|
48 |
% nicer settings from Ross Ihaka |
|
49 |
\DefineVerbatimEnvironment{Sinput}{Verbatim} % {xleftmargin=2em,formatcom=\color{dkblue},fontsize=\footnotesize} |
|
50 |
{xleftmargin=2em,formatcom=\color{dkblue}} |
|
51 |
\DefineVerbatimEnvironment{Soutput}{Verbatim} |
|
52 |
% {xleftmargin=2em,formatcom=\color{dkgray},fontsize=\footnotesize} |
|
53 |
{xleftmargin=2em,formatcom=\color{dkgray}} |
|
54 |
\DefineVerbatimEnvironment{Scode}{Verbatim}{xleftmargin=2em} |
|
55 |
\fvset{listparameters={\setlength{\topsep}{0pt}}} |
|
56 |
\renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}} |
|
57 |
|
|
58 |
% set some specific R options that affect the output format |
|
59 |
<<echo=FALSE,print=FALSE>>= |
|
60 |
options(width=80) |
|
61 |
options(continue=" ") |
|
62 |
@ |
|
63 |
|
|
64 |
\begin{figure}[htp] |
|
65 |
\centering |
|
66 |
\caption{Focal area} |
|
67 |
<<echo=FALSE,results=hide,fig=TRUE>>= |
|
68 |
library(raster) |
|
69 |
library(maps) |
|
70 |
demdir <- "/home/regetz/media/temp/terrain/dem/" |
|
71 |
dem <- raster(file.path(demdir, "fused_300straddle.tif")) |
|
72 |
map("world", xlim=c(-140,-70), ylim=c(40, 70), fill=TRUE, col="grey") |
|
73 |
grid(col="darkgray") |
|
74 |
axis(1) |
|
75 |
axis(2) |
|
76 |
box() |
|
77 |
plot(extent(dem), col="red", add=TRUE) |
|
78 |
arrows(-110, 57, -113, 59.7, col="red", length=0.1) |
|
79 |
text(-110, 57, labels="focal region", col="red", font=3, pos=1) |
|
80 |
@ |
|
81 |
\end{figure} |
|
82 |
|
|
83 |
\begin{figure}[htp] |
|
84 |
\caption{Weighting schemes} |
|
85 |
\centering |
|
86 |
\subfloat[Gaussian weighted blend]{ |
|
87 |
<<echo=FALSE,results=hide,fig=TRUE, height=3, width=6>>= |
|
88 |
par(omi=c(0,0,0,0), mar=c(4,4,1,2)+0.1) |
|
89 |
curve(exp(-0.001*x^2), from=-150, to=0, xlim=c(-150, 150), col="red", |
|
90 |
xaxt="n", bty="n", xlab="Latitude", ylab="Weighting") |
|
91 |
curve(1+0*x, from=0, to=150, add=TRUE, col="red") |
|
92 |
curve(1-exp(-0.001*x^2), from=-150, to=0, add=TRUE, col="blue") |
|
93 |
#axis(1, at=seq(-150, 150, by=60), labels=seq(59.875, 60.125, by=0.05)) |
|
94 |
#axis(1, at=0, labels=60, col="red", cex=0.85) |
|
95 |
axis(1, at=seq(-120, 120, by=60), labels=seq(59.9, 60.1, by=0.05)) |
|
96 |
text(-100, 0.6, labels="gaussian\nblend") |
|
97 |
text(-140, 0.9, labels="SRTM", col="blue", pos=4) |
|
98 |
text(-140, 0.1, labels="ASTER", col="red", pos=4) |
|
99 |
@ |
|
100 |
}\\ |
|
101 |
\subfloat[Multiresolution spline]{ |
|
102 |
<<echo=FALSE,results=hide,fig=TRUE, height=3, width=6>>= |
|
103 |
par(omi=c(0,0,0,0), mar=c(4,4,0,2)+0.1) |
|
104 |
plot(0, xlim=c(-150, 150), ylim=c(0, 1), type="n", xaxt="n", yaxt="n", |
|
105 |
bty="n", xlab="Latitude", ylab=NA) |
|
106 |
rect(-75, 0, 0, 0.75, col="purple") |
|
107 |
rect(-75, 0, 150, 0.75, col="red", density=5, angle=45) |
|
108 |
rect(-150, 0, 0, 0.75, col="blue", density=5, angle=135) |
|
109 |
#axis(1, at=seq(-150, 150, by=60), labels=seq(59.875, 60.125, by=0.05)) |
|
110 |
#axis(1, at=0, labels=60, col="red", cex=0.85) |
|
111 |
axis(1, at=seq(-120, 120, by=60), labels=seq(59.9, 60.1, by=0.05)) |
|
112 |
text(-150, 0.9, labels="SRTM", pos=4, col="blue") |
|
113 |
text(-37.5, 0.8, labels="overlap", pos=3, font=3) |
|
114 |
text(150, 0.9, labels="ASTER", pos=2, col="red") |
|
115 |
@ |
|
116 |
} |
|
117 |
\end{figure} |
|
118 |
|
|
119 |
%\newpage |
|
120 |
%\begin{center} |
|
121 |
%\includegraphics[width=\linewidth]{../dem/boundary-hillshade.png} |
|
122 |
%\end{center} |
|
123 |
|
|
124 |
\newpage |
|
125 |
|
|
126 |
\centering |
|
127 |
\includepdfset{pagecommand=\thispagestyle{fancy}} |
|
128 |
\setkeys{Gin}{width=1.8\linewidth} |
|
129 |
\includepdf[landscape=true,pages=-]{../dem/elevation-assessment.pdf} |
|
130 |
\includepdf[landscape=true,pages=-]{../slope/slope-assessment.pdf} |
|
131 |
\includepdf[landscape=true,pages=-]{../aspect/aspect-assessment.pdf} |
|
132 |
\includepdf[landscape=true,pages=-]{../flow/flowdir-assessment.pdf} |
|
133 |
|
|
134 |
\verbatiminput{../dem/enblend.R} |
|
135 |
|
|
136 |
\end{document} |
|
137 |
|
Also available in: Unified diff
early version of 60N boundary assessment report