Revision e11b5636
Added by Rick Reeves over 13 years ago
- ID e11b563698ead9e6624d201b1c650124145998c6
terrain/rscripts/CreateImageDiffPlotsOverlayNewPlotsLowessLines.R | ||
---|---|---|
1 |
############################################################################################## |
|
2 |
# |
|
3 |
# CreateImageDiffPlots |
|
4 |
# |
|
5 |
# R script generates collection of nine plots that display the distributions of populations of |
|
6 |
# three elevation pixel pairs in proximity to the border between ASTER and STRM data in mosaic |
|
7 |
# images# under development for the Environment and Organisms project. |
|
8 |
# |
|
9 |
# |
|
10 |
# Inputs: |
|
11 |
# 1) Comma Separated Value (CSV) table containing randomly-sampled elevation value pairs, |
|
12 |
# extracted from ASTER/CGIAR mosaic and CDEM images, created by the R script: makeImagePairTable.r |
|
13 |
# Note: At present, be sure that this file has been sorted by column 1 (ColumnID) in Excel |
|
14 |
# before using in this program. |
|
15 |
# NOTE: This filename is set in the body of the script. |
|
16 |
# |
|
17 |
# 2) sampling factor: integer (range=1 to number of recors in input table. Determines |
|
18 |
# the size of randomly-selected sampe of total table record 'triplets' (north, border, |
|
19 |
# and south) rows of each column sample) to be displayed in the plots: |
|
20 |
# sampling factor = 1 : plot every table record |
|
21 |
# 10 : plot a random sample containing 1/10th of records |
|
22 |
# 100 : plot random sample containing 1/100th of records. |
|
23 |
# 3) JpgPlotFileFlag: Set to TRUE to have *individual* plots written to JPG files. |
|
24 |
# |
|
25 |
# To run: |
|
26 |
# |
|
27 |
# 1) place this file and the input file "tableForMark4000_5_8_SortColID.csv" in folder |
|
28 |
# 2) start R |
|
29 |
# 3) > source("CreateImageDiffPlotsOverlay.r") |
|
30 |
# 4) > CreateImageDiffPlots(sampling factor,JpegFlag) |
|
31 |
# < press <cr> key to view plots sequentially |
|
32 |
# |
|
33 |
# TODO: add symbol legend to each plot. |
|
34 |
# Author: Rick Reeves, NCEAS |
|
35 |
# May 14, 2011 |
|
36 |
# May 17, 2011: This version generates 'delta scatterplots' specified by Mark and Jim. |
|
37 |
# May 18, 2011: If JpgPlotFlag set, write individual plot files to JPG files. |
|
38 |
# May 22, 2011: add Lowess lines to center of scatterplot distribution |
|
39 |
############################################################################################## |
|
40 |
CreateImageDiffPlotsNewLL <- function(plotSampFact = 1,JpgPlotFileFlag = TRUE) |
|
41 |
{ |
|
42 |
|
|
43 |
# Check plotSampleFact rangels -l *.tif |
|
44 |
|
|
45 |
if (plotSampFact < 1) |
|
46 |
plotSampFact = 1 |
|
47 |
|
|
48 |
# Read input table that was sorted OFFLINE in Excel on the first column (ColumnID) |
|
49 |
|
|
50 |
pointTable <-read.csv("pixelPairs36000_5_8EvenSortCol1.csv") |
|
51 |
# pointTable <-read.csv("pixelPairs36000_Exa.csv") |
|
52 |
# Table created by randomly sampling from two superimposed |
|
53 |
# image: |
|
54 |
# 1) DOM mosaic image comprised of ASTER and SRTM components. |
|
55 |
# 2) 'Baseline' Canadian DEM (CDEM) image. |
|
56 |
# |
|
57 |
# The input table contains three rows for each randomly-selected |
|
58 |
# pixel pair from both images. Each row contains two pixel pairs, |
|
59 |
# the first pair drawn from the image mosaic, the second pair |
|
60 |
# drawn from the CDEM image: |
|
61 |
# First pair: North pixel, South pixel (ASTER/SRTM mosaic) |
|
62 |
# Second pair: North pixel, South pixel (CDEM) |
|
63 |
# |
|
64 |
# The first row of each 'triplet' contains pixel pairs North of border, |
|
65 |
# The second row contains pixel pairs spanning border, |
|
66 |
# The third row contains pixel pairs South of border, |
|
67 |
# |
|
68 |
# This script generates a series of plots that display |
|
69 |
# differences between: |
|
70 |
# 1) The mosaic and CDEM images |
|
71 |
# 2) Image pixels on and away from the ASTER / SRTM boundary. |
|
72 |
# |
|
73 |
northRowIndexes = seq(from=1, to=(nrow(pointTable) - 3),by=3) |
|
74 |
borderRowIndexes = seq(from=2, to=(nrow(pointTable) - 1),by=3) |
|
75 |
southRowIndexes = seq(from=3, to=(nrow(pointTable)),by=3) |
|
76 |
# |
|
77 |
# calculate and append the difference between elevations |
|
78 |
# and CDEM |
|
79 |
# these lines create the inputs for differnce image plots for each of three |
|
80 |
# pixel pair subsets: North of border (All Aster), border (combo Aster/Srtm), |
|
81 |
# South of border (all Srtm) |
|
82 |
# |
|
83 |
# First, add the 'difference columns' to the entire table |
|
84 |
# |
|
85 |
pointTable <-cbind(pointTable,(pointTable$elevNorth - pointTable$elevSouth)) |
|
86 |
pointTable <-cbind(pointTable,(pointTable$cdemNorth - pointTable$cdemSouth)) |
|
87 |
pointTable <-cbind(pointTable,(pointTable$elevNorth - pointTable$cdemNorth)) |
|
88 |
pointTable <-cbind(pointTable,(pointTable$elevSouth - pointTable$cdemSouth)) |
|
89 |
# |
|
90 |
colnames(pointTable)[6] <- "diffMosaicNorthSouth" |
|
91 |
colnames(pointTable)[7] <- "diffCDEMNorthSouth" |
|
92 |
colnames(pointTable)[8] <- "diffNorthMosaicCDEM" |
|
93 |
colnames(pointTable)[9] <- "diffSouthMosaicCDEM" |
|
94 |
|
|
95 |
# add a placeholder for the 'boundary' value, across each table |
|
96 |
|
|
97 |
# pointTable <-cbind(pointTable,(-1)) |
|
98 |
|
|
99 |
# colnames(pointTable)[10] <- "deltaAcrossBorder" |
|
100 |
|
|
101 |
# Difference between Mosaic (ASTER or CGIAR or border) |
|
102 |
# and CDEM elevation as pertentage of the mosaic elevation |
|
103 |
|
|
104 |
pointTable <-cbind(pointTable,(pointTable$diffNorthMosaicCDEM/pointTable$elevNorth * 100)) |
|
105 |
pointTable <-cbind(pointTable,(pointTable$diffSouthMosaicCDEM/pointTable$elevSouth * 100)) |
|
106 |
|
|
107 |
colnames(pointTable)[10] <- "magDiffMosaicCDEMNorthPct" |
|
108 |
colnames(pointTable)[11] <- "magDiffMosaicCDEMSouthPct" |
|
109 |
|
|
110 |
# For the plots, subdivide the table into three segments: |
|
111 |
# rows north of border |
|
112 |
# rows crossing border |
|
113 |
# rows south of border |
|
114 |
|
|
115 |
northRowTblAll = pointTable[northRowIndexes,] |
|
116 |
borderRowTblAll = pointTable[borderRowIndexes,] |
|
117 |
southRowTblAll = pointTable[southRowIndexes,] |
|
118 |
|
|
119 |
subset <- 1:nrow(northRowTblAll) |
|
120 |
|
|
121 |
randSub <- sample(subset,as.integer(length(subset) / plotSampFact)) |
|
122 |
|
|
123 |
northRowTbl <- northRowTblAll[randSub,] |
|
124 |
borderRowTbl <- borderRowTblAll[randSub,] |
|
125 |
southRowTbl <- southRowTblAll[randSub,] |
|
126 |
|
|
127 |
message("hit key to create each plot...") |
|
128 |
browser() |
|
129 |
|
|
130 |
# Three plotting characters used |
|
131 |
|
|
132 |
plotCh1 <- 17 # 'north' (aster) points |
|
133 |
plotCh2 <- 18 # 'border' (aster+srtm) points |
|
134 |
plotCh3 <- 20 # 'south' (srtm) points |
|
135 |
lowessLineColor <- "yellow" |
|
136 |
# NEW: Three plots: The difference between Mosaic and CDEM for pixels along |
|
137 |
# each of three border edges: North (ASTER), Border, South (SRTM) |
|
138 |
# for now, north, border, south have separate plots |
|
139 |
|
|
140 |
# We need to tailor the plot 'triplet' X and Y axes to the dynamic ranges of all three data sets. |
|
141 |
|
|
142 |
# Create values for the three 'delta across pixel boundaries' plots: |
|
143 |
# 1) Y-Axis: columnIDs |
|
144 |
# 2) Y-Axis: CDEM elevations |
|
145 |
# 3) Y-Axis: |
|
146 |
|
|
147 |
deltaBoundaryASTER <- northRowTbl$diffNorthMosaicCDEM - northRowTbl$diffSouthMosaicCDEM |
|
148 |
deltaBoundaryBorder <- borderRowTbl$diffNorthMosaicCDEM - borderRowTbl$diffSouthMosaicCDEM |
|
149 |
deltaBoundarySRTM <- southRowTbl$diffNorthMosaicCDEM - southRowTbl$diffSouthMosaicCDEM |
|
150 |
|
|
151 |
normDeltaBoundaryASTER <- (deltaBoundaryASTER / northRowTbl$cdemNorth * 100) |
|
152 |
normDeltaBoundaryBorder <- (deltaBoundaryBorder / borderRowTbl$cdemNorth * 100) |
|
153 |
normDeltaBoundarySRTM <- (deltaBoundarySRTM / southRowTbl$cdemNorth * 100) |
|
154 |
|
|
155 |
par(mfrow=c(1,3)) # Create a set of three column multi-plots |
|
156 |
|
|
157 |
commonXAxis <- c(0,max(pointTable$ColumnID)) |
|
158 |
commonYAxis <- range(c(deltaBoundarySRTM,deltaBoundaryBorder,deltaBoundaryASTER),na.rm=TRUE) |
|
159 |
|
|
160 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(deltaBoundaryASTER,na.rm=TRUE),sd(deltaBoundaryASTER,na.rm=TRUE)) |
|
161 |
plot(northRowTbl$ColumnID,deltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Delta: ASTER - CDEM",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
162 |
vv <- cbind(northRowTbl$ColumnID,deltaBoundaryASTER) |
|
163 |
# vx <- vv[-(which(is.na(vv[,"deltaBoundaryASTER"]))),] |
|
164 |
vx <- vv[(which(!is.na(vv[,"deltaBoundaryASTER"]))),] |
|
165 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
166 |
|
|
167 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(deltaBoundaryBorder,na.rm=TRUE),sd(deltaBoundaryBorder,na.rm=TRUE)) |
|
168 |
plot(northRowTbl$ColumnID,deltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Delta: Bdry Mix - CDEM",sub="X Axis: West-East Columns",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
169 |
vv <- cbind(northRowTbl$ColumnID,deltaBoundaryBorder) |
|
170 |
vx <- vv[(which(!is.na(vv[,"deltaBoundaryBorder"]))),] |
|
171 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
172 |
|
|
173 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(deltaBoundarySRTM,na.rm=TRUE),sd(deltaBoundarySRTM,na.rm=TRUE)) |
|
174 |
plot(northRowTbl$ColumnID,deltaBoundarySRTM,main="Delta: SRTM - CDEM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
175 |
vv <- cbind(northRowTbl$ColumnID,deltaBoundarySRTM) |
|
176 |
vx <- vv[(which(!is.na(vv[,"deltaBoundarySRTM"]))),] |
|
177 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
178 |
|
|
179 |
message("ColumnID-X-Axis is done") |
|
180 |
browser() |
|
181 |
#dev.new() |
|
182 |
# par(mfrow=c(3,1)) # Create a three column multi-plot pointTable$diffNorthMosaicCDEM/pointTable$elevNorth * 100)) |
|
183 |
|
|
184 |
commonXAxis <- c(0,max(pointTable$cdemNorth,na.rm=TRUE)) |
|
185 |
commonYAxis <- range(c(deltaBoundarySRTM,deltaBoundaryBorder,deltaBoundaryASTER),na.rm=TRUE) |
|
186 |
|
|
187 |
# northDelta.lo <- loess(deltaBoundaryASTER ~ deltaBoundaryASTER,northRowTbl) |
|
188 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(deltaBoundaryASTER,na.rm=TRUE),sd(deltaBoundaryASTER,na.rm=TRUE)) |
|
189 |
plot(northRowTbl$cdemNorth,deltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Delta: ASTER - CDEM",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
190 |
vv <- cbind(northRowTbl$cdemNorth,deltaBoundaryASTER) |
|
191 |
vx <- vv[(which(!is.na(vv[,"deltaBoundaryASTER"]))),] |
|
192 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
193 |
|
|
194 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(deltaBoundaryBorder,na.rm=TRUE),sd(deltaBoundaryBorder,na.rm=TRUE)) |
|
195 |
plot(northRowTbl$cdemNorth,deltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main=" Delta: Bdy Mix - CDEM",sub="X Axis: CDEM Elevation",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
196 |
vv <- cbind(northRowTbl$cdemNorth,deltaBoundaryBorder) |
|
197 |
vx <- vv[(which(!is.na(vv[,"deltaBoundaryBorder"]))),] |
|
198 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
199 |
|
|
200 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(deltaBoundarySRTM,na.rm=TRUE),sd(deltaBoundarySRTM,na.rm=TRUE)) |
|
201 |
plot(northRowTbl$cdemNorth,deltaBoundarySRTM,main="Delta: SRTM - CDEM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
202 |
vv <- cbind(northRowTbl$cdemNorth,deltaBoundarySRTM) |
|
203 |
vx <- vv[(which(!is.na(vv[,"deltaBoundarySRTM"]))),] |
|
204 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
205 |
message("ColumnID-CDEM Elevation done") |
|
206 |
browser() |
|
207 |
commonXAxis <- c(0,max(pointTable$cdemNorth,na.rm=TRUE)) |
|
208 |
commonYAxis <- range(c(normDeltaBoundarySRTM,normDeltaBoundaryBorder,normDeltaBoundaryASTER),na.rm=TRUE) |
|
209 |
|
|
210 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(normDeltaBoundaryASTER,na.rm=TRUE),sd(normDeltaBoundaryASTER,na.rm=TRUE)) |
|
211 |
plot(northRowTbl$cdemNorth,normDeltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Delta Norm Elev: ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
212 |
vv <- cbind(northRowTbl$cdemNorth,normDeltaBoundaryASTER) |
|
213 |
vx <- vv[(which(!is.na(vv[,"normDeltaBoundaryASTER"]))),] |
|
214 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
215 |
|
|
216 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(normDeltaBoundaryBorder,na.rm=TRUE),sd(normDeltaBoundaryBorder,na.rm=TRUE)) |
|
217 |
plot(northRowTbl$cdemNorth,normDeltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Delta Norm Elev: Border",sub="X Axis: CDEM Elevation",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
218 |
vv <- cbind(northRowTbl$cdemNorth,normDeltaBoundaryBorder) |
|
219 |
vx <- vv[(which(!is.na(vv[,"normDeltaBoundaryBorder"]))),] |
|
220 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
221 |
|
|
222 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(normDeltaBoundarySRTM,na.rm=TRUE),sd(normDeltaBoundarySRTM,na.rm=TRUE)) |
|
223 |
plot(northRowTbl$cdemNorth,normDeltaBoundarySRTM,main="Delta Norm Elev: SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
224 |
vv <- cbind(northRowTbl$cdemNorth,normDeltaBoundarySRTM) |
|
225 |
vx <- vv[(which(!is.na(vv[,"normDeltaBoundarySRTM"]))),] |
|
226 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
227 |
message("NORMALIZED ColumnID-CDEM Elevation done") |
|
228 |
browser() |
|
229 |
commonXAxis <- c(0,max(pointTable$cdemNorth,na.rm=TRUE)) |
|
230 |
commonYAxis <- range(c(northRowTbl$magDiffMosaicCDEMNorthPct,borderRowTbl$magDiffMosaicCDEMNorthPct,southRowTbl$magDiffMosaicCDEMNorthPct),na.rm=TRUE) |
|
231 |
|
|
232 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(northRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE),sd(northRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE)) |
|
233 |
plot(northRowTbl$cdemNorth,northRowTbl$magDiffMosaicCDEMNorthPct,xlim=commonXAxis, ylim=commonYAxis,main="Delta Vs Elev Mag: ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
234 |
vv <- cbind(northRowTbl$cdemNorth,northRowTbl$magDiffMosaicCDEMNorthPct) |
|
235 |
vx <- vv[(which(!is.na(vv[,2]))),] |
|
236 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
237 |
|
|
238 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(borderRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE),sd(borderRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE)) |
|
239 |
plot(northRowTbl$cdemNorth,borderRowTbl$magDiffMosaicCDEMNorthPct,xlim=commonXAxis, ylim=commonYAxis,main="Delta Vs Elev Mag:: Border",sub="E-W Col",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
240 |
vv <- cbind(northRowTbl$cdemNorth,deltaBoundarySRTM) |
|
241 |
vx <- vv[(which(!is.na(vv[,2]))),] |
|
242 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
243 |
|
|
244 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(southRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE),sd(southRowTbl$magDiffMosaicCDEMNorthPct,na.rm=TRUE)) |
|
245 |
plot(northRowTbl$cdemNorth,southRowTbl$magDiffMosaicCDEMNorthPct,main="Delta Vs Elev Mag:: SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
246 |
vv <- cbind(northRowTbl$cdemNorth,southRowTbl$magDiffMosaicCDEMNorthPct) |
|
247 |
vx <- vv[(which(!is.na(vv[,2]))),] |
|
248 |
lines(stats::lowess(vx),col=lowessLineColor) |
|
249 |
message("Delta as Fcn Elev Mag-X-Axis is done...") |
|
250 |
|
|
251 |
# if 'plot flag' is set, send the plots to a JPG file. |
|
252 |
|
|
253 |
if (JpgPlotFileFlag) |
|
254 |
{ |
|
255 |
message("creating JPG plot files...") |
|
256 |
browser() |
|
257 |
jpeg(file="RowBoundaryDeltaColIDXAxisASTER.jpg") |
|
258 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(deltaBoundaryASTER,na.rm=TRUE),sd(deltaBoundaryASTER,na.rm=TRUE)) |
|
259 |
plot(northRowTbl$ColumnID,deltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Row Boundary Delta: ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
260 |
dev.off() |
|
261 |
jpeg(file="RowBoundaryDeltaColIDXAxisBORDER.jpg") |
|
262 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(deltaBoundaryBorder,na.rm=TRUE),sd(deltaBoundaryBorder,na.rm=TRUE)) |
|
263 |
plot(northRowTbl$ColumnID,deltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Row Boundary Delta: Border",sub="E-W Col",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
264 |
dev.off() |
|
265 |
jpeg(file="RowBoundaryDeltaColIDXAxisSRTM.jpg") |
|
266 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(deltaBoundarySRTM,na.rm=TRUE),sd(deltaBoundarySRTM,na.rm=TRUE)) |
|
267 |
plot(northRowTbl$ColumnID,deltaBoundarySRTM,main="Row Boundary Delta: SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
268 |
message("ColumnID-X-Axis plots are done") |
|
269 |
#dev.new() |
|
270 |
commonXAxis <- c(0,max(pointTable$cdemNorth)) |
|
271 |
commonYAxis <- range(c(deltaBoundarySRTM,deltaBoundaryBorder,deltaBoundaryASTER),na.rm=TRUE) |
|
272 |
jpeg(file="RowBoundaryDeltaCDEMElevXAxisASTER.jpg") |
|
273 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(deltaBoundaryASTER,na.rm=TRUE),sd(deltaBoundaryASTER,na.rm=TRUE)) |
|
274 |
plot(northRowTbl$cdemNorth,deltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Boundary Delta (CDEM Elev): ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
275 |
dev.off() |
|
276 |
jpeg(file="RowBoundaryDeltaCDEMElevXAxisBORDER.jpg") |
|
277 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(deltaBoundaryBorder,na.rm=TRUE),sd(deltaBoundaryBorder,na.rm=TRUE)) |
|
278 |
plot(northRowTbl$cdemNorth,deltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Boundary Delta (CDEM Elev): Border",sub="vs Elev",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
279 |
dev.off() |
|
280 |
jpeg(file="RowBoundaryDeltaCDEMElevXAxisCDEM.jpg") |
|
281 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(deltaBoundarySRTM,na.rm=TRUE),sd(deltaBoundarySRTM,na.rm=TRUE)) |
|
282 |
plot(northRowTbl$cdemNorth,deltaBoundarySRTM,main="Boundary Delta (CDEM Elev): SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
283 |
dev.off() |
|
284 |
message("ColumnID-CDEM Elevation Plots are done") |
|
285 |
#browser() |
|
286 |
commonXAxis <- c(0,max(pointTable$cdemNorth)) |
|
287 |
commonYAxis <- range(c(normDeltaBoundarySRTM,normDeltaBoundaryBorder,normDeltaBoundaryASTER),na.rm=TRUE) |
|
288 |
jpeg(file="NormRowBoundaryDeltaColIDXAxisASTER.jpg") |
|
289 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(normDeltaBoundaryASTER,na.rm=TRUE),sd(normDeltaBoundaryASTER,na.rm=TRUE)) |
|
290 |
plot(northRowTbl$cdemNorth,normDeltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Norm Bdry Delta (CDEM Elev): ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
291 |
dev.off() |
|
292 |
jpeg(file="NormRowBoundaryDeltaColIDXAxisBORDER.jpg") |
|
293 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(normDeltaBoundaryBorder,na.rm=TRUE),sd(normDeltaBoundaryBorder,na.rm=TRUE)) |
|
294 |
plot(northRowTbl$cdemNorth,normDeltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Norm Bdry Delta (CDEM Elev): Border",sub="vs Elev",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
295 |
dev.off() |
|
296 |
jpeg(file="NormRowBoundaryDeltaColIDXAxisSRTM.jpg") |
|
297 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(normDeltaBoundarySRTM,na.rm=TRUE),sd(normDeltaBoundarySRTM,na.rm=TRUE)) |
|
298 |
plot(northRowTbl$cdemNorth,normDeltaBoundarySRTM,main="Norm Bdry Delta (CDEM Elev): SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
299 |
dev.off() |
|
300 |
message("NORMALIZED ColumnID-CDEM Elevation Plots are done") |
|
301 |
browser() |
|
302 |
commonXAxis <- c(0,max(pointTable$ColumnID)) |
|
303 |
commonYAxis <- range(c(normDeltaBoundarySRTM,normDeltaBoundaryBorder,normDeltaBoundaryASTER),na.rm=TRUE) |
|
304 |
jpeg(file="NormRowBoundaryDeltaCDEMElevXAxisASTER.jpg") |
|
305 |
xAxisLbl <- sprintf("M/SD: ASTER: %.2f / %.2f",mean(normDeltaBoundaryASTER,na.rm=TRUE),sd(normDeltaBoundaryASTER,na.rm=TRUE)) |
|
306 |
plot(northRowTbl$ColumnID,normDeltaBoundaryASTER,xlim=commonXAxis, ylim=commonYAxis,main="Norm Bdry Delta: ASTER",xlab=xAxisLbl,col="red",pch=plotCh1) |
|
307 |
dev.off() |
|
308 |
jpeg(file="NormRowBoundaryDeltaCDEMElevXAxisBORDER.jpg") |
|
309 |
xAxisLbl <- sprintf("M/SD: BORDER: %.2f / %.2f",mean(normDeltaBoundaryBorder,na.rm=TRUE),sd(normDeltaBoundaryBorder,na.rm=TRUE)) |
|
310 |
plot(northRowTbl$ColumnID,normDeltaBoundaryBorder,xlim=commonXAxis, ylim=commonYAxis,main="Norm Bdry Delta: Border",sub="E-W Col",xlab=xAxisLbl,col="darkgreen",pch=plotCh2) |
|
311 |
dev.off() |
|
312 |
jpeg(file="NormRowBoundaryDeltaCDEMElevXAxisSRTM.jpg") |
|
313 |
xAxisLbl <- sprintf("M/SD: SRTM: %.2f / %.2f",mean(normDeltaBoundarySRTM,na.rm=TRUE),sd(normDeltaBoundarySRTM,na.rm=TRUE)) |
|
314 |
plot(northRowTbl$ColumnID,normDeltaBoundarySRTM,main="Norm Bdry Delta: SRTM",xlim=commonXAxis, ylim=commonYAxis,xlab=xAxisLbl,col="blue",pch=plotCh3) |
|
315 |
dev.off() |
|
316 |
message("NORMALIZED ColumnID-X-Axis Plot files have been created..") |
|
317 |
} |
|
318 |
message("...All plots created - hit key to delete them...") |
|
319 |
browser() |
|
320 |
graphics.off() |
|
321 |
} |
Also available in: Unified diff
Version of pixel pair plotting script that adds 'Lowess Lines' to center of each scatterplot.
Note: Loess lines feature has only been tested with the input file "pixelPairs36000_5_8EvenSortCol1.csv", used in the script.
Some table column names are hard-coded into the script.