-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
512 lines (512 loc) · 27.5 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
library(raster)
library(rgdal)
library(rasterVis)
setwd("C:/Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers")
Asia2005 <- raster("Asia_PPP_2005_adj_v2.tif")
Asia2010 <- raster("Asia_PPP_2010_adj_v2.tif")
Asia2015 <- raster("Asia_PPP_2015_adj_v2.tif")
log2005 <- log10(Asia2005+10) - 1
log2005
log2010 <- log10(Asia2010+10) - 1
log2015 <- log10(Asia2015+10) - 1
topo <- raster("mastergrid_topography_1km.tif")
topo <- crop(topo, extent(Asia2015))
logElev <- topo
logElev[logElev <= 6] <- 9997
logElev <- log10(logElev+3)
logElev[logElev == 4] <- .99
logElev
SLR0or1 <- topo <= 6
SLRno <- topo
SLRno[!SLR0or1] <- 0
urban <- raster("UrbanExtent.adf")
x <- new("GDALReadOnlyDataset", "UrbanExtent.adf")
getwd()
x <- new("GDALReadOnlyDataset", "C:/Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/UrbanExtent.adf")
library(rArcInfo)
library(RArcInfo)
install.packages("RArcInfo")
x <- new("GDALReadOnlyDataset", "C:/Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/UrbanExtent.adf")
library(RArcInfo)
x <- new("GDALReadOnlyDataset", "C:/Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/UrbanExtent.adf")
urban <- get.arcdata("C:/Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/", "urban", "UrbanExtent.adf")
urban <- get.arcdata("C:Users/Alexis Glenn/Desktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/", "urban", "UrbanExtent.adf")
urban <- get.arcdata("C:Users\Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/", "urban", "UrbanExtent.adf")
urban <- get.arcdata("C:Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers", "urban", "UrbanExtent.adf")
urban <- get.arcdata("C:Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/", "urban", "UrbanExtent.adf")
urban <- get.arcdata("Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/", "urban", "UrbanExtent.adf")
gc()
urban <- get.arcdata("Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/as_grumpv1_urextent_grid_30/", "asurextents", "w001001.adf")
urban <- get.arcdata("Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/as_grumpv1_urextent_grid_30", "asurextents", "w001001.adf")
urban <- get.arcdata("C:/Users/Alexis GlennDesktop/Datasets/Population Dataset/WorldPop Dataverse/Other Data Layers/as_grumpv1_urextent_grid_30/", "asurextents", "w001001.adf")
urban <- get.arcdata("as_grumpv1_urextent_grid_30/", "asurextents", "w001001.adf")
urban
urban <- get.arcdata("as_grumpv1_urextent_grid_30", "asurextents", "w001001.adf")
getwd()
urban <- get.arcdata("/as_grumpv1_urextent_grid_30/", "asurextents", "w001001.adf")
urban <- raster("as_grumpv1_urextent_grid_30/asurextents/w001001.adf")
urban
Asia2015
urban <- crop(urban, extent(Asia2015))
urban
urban <- extend(urban, extent(Asia2015))
urban
countryID <- raster("mastergrid_countrycodeID_1km.tif")
region <- read.csv("ISO Regional Classification.csv")
labeling <- region[,c("country.code", "sub.region.code")]
regionalID <- reclassify(countryID, rcl=labeling)
regionalID <- as.factor(regionalID)
landcover <- raster("mastergrid_globcover2009_1km.tif")
countryID <- crop(countryID, extent(Asia2015))
regionalID <- crop(regionalID, extent(Asia2015))
landcover <- crop(landcover, extent(Asia2015))
ls()
grandAsia <- stack()
grandAsia <- stack(Asia2005, log2005, Asia2010, log2010, Asia2015, log2015, countryID, regionalID, urban, topo, logElev, SLR0or1, SLRno, landcover)
countryID
grandAsia <- stack(Asia2005, log2005, Asia2010, log2010, Asia2015, log2015, countryID, regionalID, topo, logElev, SLR0or1, SLRno, landcover)
names(grandAsia)
names(grandAsia) <- c("Asia2005", "log2005", "Asia2010", "log2010", "Asia2015", "log2015", "countryID", "regionalID", "topo", "logElev", "SLR0or1", "SLRno", "landcover")
names(grandAsia)
urban <- resample(urban, ASia2015, method="ngb")
urban <- resample(urban, Asia2015, method="ngb")
urban
validate <- is.na(urban) == is.na(countryID)
freq(validate)
plot(validate)
par(ann=FALSE)
plot(validate)
arg(raster::plot())
arg(raster::.plot)
args(raster::.plot)
args(raster::plot)
plot(validate, bty='n')
par(mar=c(0,0,0,0))
plot(validate)
plot(validate, legend=FALSE)
plot(validate, legend=FALSE, box=FALSE, axes=FALSE)
par(mar=c(0,0,0,0))
plot(validate, legend=FALSE, box=FALSE, axes=FALSE)
addLayer(grandAsia, urban)
names(grandAsia) <- c("Asia2005", "log2005", "Asia2010", "log2010", "Asia2015", "log2015", "countryID", "regionalID", "topo", "logElev", "SLR0or1", "SLRno", "landcover", "urban")
names(grandAsia) <- c("Asia2005", "log2005", "Asia2010", "log2010", "Asia2015", "log2015", "countryID", "regionalID", "topo", "logElev", "SLR0or1", "SLRno", "landcover", "urban")
my_names <- c("Asia2005", "log2005", "Asia2010", "log2010", "Asia2015", "log2015", "countryID", "regionalID", "topo", "logElev", "SLR0or1", "SLRno", "landcover", "urban")
names(grandAsia) <- my_names
grandAsia
grandAsia <- addLayer(grandAsia, urban)
grandAsia
names(grandAsia) <- my_names
grandAsia
setwd("C:/Users/Alexis Glenn/Desktop/Datasets/Asian Population Raster Layers")
writeRaster(grandAsia, filename=names(grandAsia), bylayer=TRUE)
writeRaster(grandAsia, filename=names(grandAsia), bylayer=TRUE, format="GTiff")
EastAsia <- crop(grandAsia, c(113, 140, 29, 41))
EastAsia
par(mar=c(0,0,0,0))
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
EastAsia <- crop(grandAsia, c(113, 150, 29, 45))
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rm(labeling, region, my_names, EastAsia)
EastAsia <- crop(grandAsia, c(113, 150, 29, 42))
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
EastAsia <- crop(grandAsia, c(113, 143, 29, 42))
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
cities <- read.csv("East Asian Cities.csv")
cities
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities[1]
)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..)
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
points(x=cities$x.coords, y=cities$y.coords, pch=10)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1)
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1, col="white")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, bg="lightblue")
rect(par(EastAsia)[1], par(EastAsia)[3], par(EastAsia)[2], par(EastAsia)[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rect(par(EastAsia)[1], par(EastAsia)[3], par(EastAsia)[2], par(EastAsia)[4], col="lightblue")
par()
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
par(font=2)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
par(font=2)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1)
par(font=2)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue", box=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
gc()
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1, col="white")
par(font=2)
par(font=2)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1, col="white")
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1)
rect(c(116,117.5,139.285), c(36.5, 29.5,35.055), c(119,122,140.193), c(40.5,32.75, 36.005), border="black")
rect(c(116,117.5,139.285), c(36.5, 29.5,35.055), c(119,122,140.193), c(40.5,32.75, 36.005), border="black", density=10)
rect(c(116,117.5,139.285), c(36.5, 29.5,35.055), c(119,122,140.193), c(40.5,32.75, 36.005), border="black")
rect(c(116,117.5,139.285), c(36.5, 29.5,35.055), c(119,122,140.193), c(40.5,32.75, 36.005), border="black", density=0, lwd=5)
par(font=2)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(EastAsia$logElev)
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
savehistory("C:/Users/Alexis Glenn/Desktop/Datasets/Asian Population Raster Layers/June16.Rhistory")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
par(mar=c(0,0,0,0))
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(EastAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï.., pos=1)
rect(c(116,117.5,139.285), c(36.5, 29.5,35.055), c(119,122,140.193), c(40.5,32.75, 36.005), lwd=3.5)
SouthAsiaLogic <- regionalID == 34
plot(SouthAsiaLogic)
regionalID[countryID == 364] <- 145
SouthAsiaLogic <- regionalID == 34
plot(SouthAsiaLogic)
trim(SouthAsiaLogic)
SouthAsia <- trim(SouthAsiaLogic, values=c(o, NA))
SouthAsia <- trim(SouthAsiaLogic, values=c(0, NA))
SouthAsiaLogic[SouthAsia ==0] <- NA
SouthAsiaLogic[SouthAsiaLogic ==0] <- NA
gc()
SouthAsiaLogic <- crop(SouthAsiaLogic, c(59.5, 94, 5, 38))
plot(SouthAsiaLogic)
SouthAsiaLogic <- regionalID == 34
SouthAsiaLogic <- crop(SouthAsiaLogic, c(59.5, 97, 5, 39))
plot(SouthAsiaLogic)
SouthAsia <- trim(SouthAsiaLogic, values=c(0, NA))
plot(SouthAsia)
library(maps)
library(mapdata)
map("WorldHires")
map("WorldHiresMapEnv")
map(WorldHiresMapEnv)
map('worldHires')
extent(SouthAsia)
map.text('worldHires',
c('Afghanistan', 'Pakistan', 'India','Nepal','Bangladesh','Bhutan'),
xlim=c(60.50792,96.99958), ylim=c(4.999584, 38.49125))
map.text('worldHires',
xlim=c(60.50792,96.99958), ylim=c(4.999584, 38.49125))
par(mar=c(0,0,0,0))
plot(SouthAsia, legend=FALSE, box=FALSE, axes=FALSE)
map('worldHires', add=TRUE
c('Afghanistan', 'Pakistan', 'India','Nepal','Bangladesh','Bhutan'),
xlim=c(60.50792,96.99958), ylim=c(4.999584, 38.49125))
map('worldHires', add=TRUE,
c('Afghanistan', 'Pakistan', 'India','Nepal','Bangladesh','Bhutan'),
xlim=c(60.50792,96.99958), ylim=c(4.999584, 38.49125))
SAextent <- extent(SouthAsia)
southAsia <- crop(GrandAsia, SAextent)
southAsia <- crop(g\randAsia, SAextent)
southAsia <- crop(grandAsia, SAextent)
plot(SouthAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
SouthAsia
rm(SouthAsia)
plot(southAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
par(mar=c(0,0,0,0))
plot(southAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
map.text('worldHires',xlim=c(60.50792,96.99958), ylim=c(4.999584, 38.49125))
southAsia
southAsia2 <- crop(southAsia, c(60.50792, 96.99958, 4.999584, 30))
par(mar=c(0,0,0,0))plot(southAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
par(mar=c(0,0,0,0))
plot(southAsia$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
map(worldHiresMapEnv,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
map('worldHiresMapEnv',xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
map('worldHires',xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
map.text('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
rm(SouthAsiaLogic)
cities <- read.csv("South Asian Cities")
cities <- read.csv("South Asian Cities.csv")
countrylabel <- read.csv("South Asian Countries.csv")
par(mar=c(0,0,0,0))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
par(mar=c(0,0,0,0))
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..names, pos=1)
par(font=4)
text(x=countrylabel$x.coords, y=countrylabel$y.coords, labels=countrylabel$ï..names)
countrylabel <- read.csv("South Asian Countries.csv")
text(x=countrylabel$x.coords, y=countrylabel$y.coords, labels=countrylabel$ï..names)
cities
cities_wh <- cities[c(1,6,7,8),]
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..names, pos=1)
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="gray")
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="darkgray")
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="dimgray")
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="white")
cities_wh <- cities[c(1,,7,8),]
cities_wh <- cities[c(1,7,8),]
par(mar=c(0,0,0,0))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..names, pos=1)
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="white")
par(mar=c(0,0,0,0))
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
par(mar=c(0,0,0,0))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
map('worldHires', add=TRUE, xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
data("worldHiresMapEnv")
worldHiresMapEnv
rm(worldHiresMapEnv)
par(mar=c(0,0,0,0))
map('worldHires', add=TRUE, xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="white")
countrylabel <- read.csv("South Asian Countries.csv")
text(x=countrylabel$x.coords, y=countrylabel$y.coords, labels=countrylabel$ï..names)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(mar(0,0,0,0))
par(mar=c(0,0,0,0))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(southAsia2$logElev, col=c("red", terrain.colors(100)), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
points(x=cities_wh$x.coords, y=cities_wh$y.coords, pch=16, col="white")
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..names, pos=1)
text(x=cities_wh$x.coords, y=cities_wh$y.coords, labels=cities_wh$ï..names, pos=1, col="white")
par(font=4)
text(x=countrylabel$x.coords, y=countrylabel$y.coords, labels=countrylabel$ï..names)
growth <- (southAsia2$Asia2015-southAsia2$Asia2010)*100/southAsia2$Asia2010
my_col = colorRampPalette(c("blue", "red"))
maxValue(growth)
minValue(growth)
hist(growth, maxpixels=100000)
par(mar=c(0.5,0.5,0.5,0.5))
hist(growth, maxpixels=1000000)
par(mar=c(1,1,1,1))
hist(growth, maxpixels=1000000)
par(mar=c(2,2,2,2))
hist(growth, maxpixels=1000000)
growth <- growth^0.2
hist(growth, maxpixels=1000000)
growth <- (southAsia2$Asia2015-southAsia2$Asia2010)*100/southAsia2$Asia2010
growth <- (((1+(growth/100))^0.2)-1)*100
hist(growth, maxpixels=1000000)
plot(growth)
plot(growth, col=my_col(100))
growth[growth < 0] <- 0
growth[growth > 3] <- 3
hist(growth, maxpixels=1000000)
my_col2 <- colorRampPalette("blue")
plot(growth, col=c("red", my_col2(100))
)
plot(growth, col=heat.colors(100))
growth2 <- (southAsia2$Asia2015-southAsia2$Asia2005)*100/southAsia2$Asia2005
growth <- (((1+(growth/100))^0.2)-1)*100
growth2 <- (((1+(growth2/100))^0.1)-1)*100
plot(growth2, col=heat.colors(100))
growth2[growth2 < 0] <- 0
growth2[growth2 > 3] <- 3
plot(growth2, col=heat.colors(100))
hist(growth2)
change <- southAsia2$Asia2015-southAsia2$Asia2010
log_change <- log10(change)
plot(log_change)
hist(change, maxpixels=1000000)
change[change < 0] <- 0
log_change <- log10(change+10) - 1
hist(log_change)
plot(log_change)
log_change[log_change > 1.5] <- 1.5
plot(log_change)
plot(log_change, col=heat.colors(100))
plot(log_change, col=heat.colors(-100))
plot(log_change, col=my_col(100)
)
plot(log_change, col=colorRampPalette("green", "blue")(100))
my_col2 <- colorRampPalette("green","blue")
my_col2()
plot(log_change, col=my_col(100))
plot(log_change, col=my_col2(100))
rm(my_col2())
rm(my_col2
)
my_col2 <- colorRampPalette("green", "blue")
my_col2 <- colorRampPalette(c("green", "blue")
)
plot(log_change, col=my_col2(100))
leg.txt <- c("Setosa Petals", "Setosa Sepals",
"Versicolor Petals", "Versicolor Sepals")
y.leg <- c(4.5, 3, 2.1, 1.4, .7)
cexv <- c(1.2, 1, 4/5, 2/3, 1/2)
matplot(c(1, 8), c(0, 4.5), type = "n", xlab = "Length", ylab = "Width",
main = "Petal and Sepal Dimensions in Iris Blossoms")
for (i in seq(cexv)) {
text (1, y.leg[i] - 0.1, paste("cex=", formatC(cexv[i])), cex = 0.8, adj = 0)
legend(3, y.leg[i], leg.txt, pch = "sSvV", col = c(1, 3), cex = cexv[i])
}
plot(log_change, col=my_col2(100))
legend(legend = c("<= 0 change", "> 300 increase"))
legend(1, legend = c("<= 0 change", "> 300 increase"))
legend(1, legend = c("<= 0 change", "> 300 increase"))
legend(1, legend = c("<= 0 change", "> 300 increase"), fill = c("green", "blue"))
par(mar=c(0,0,0,0))
plot(log_change, col=my_col2(100), legend.only=TRUE)
plot(log_change, col=my_col2(100), legend.only=TRUE)
plot(log_change, col=my_col2(100), legend.only=TRUE, legend.width=2, legend.args=list(legend = c("<= 0 change", "> 300 increase"), fill = c("green", "blue")))
change
change.range <- c(0, 300)
plot(log_change, col=my_col2(100), legend.only=FALSE)
par(mar())
rm(cevx, i, leg.txt, y.leg)
rm(9cexv)
rm(cexv)
plot(log_change, col=my_col2(100), legend.only=FALSE, axes=FALSE)
par(mar=c(0,0,0,0))
plot(log_change, col=my_col2(100), legend.only=FALSE, axes=FALSE)
plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE)
plot(change, col=my_col2(100), legend.only=TRUE, legend.width=2)
plot(change.range, col=my_col2(100), legend.only=TRUE, legend.width=2)
plot(change.range, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE)
plot(change, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE)
plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE)
legend(x='bottomleft', legend = c("<= 0 change", ">300 increase"), fill = my_col2)
change2 <- change
change2[change2 > 300] <- 300
change2
plot(change, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE)
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE)
par(bty= "n")
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel'))
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4))
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, font=2, line=2.5, cex=0.8))
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, line=2.5, cex=0.8))
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, line=2.5))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE, add=TRUE)
par(bty= "n")
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, line=2.5))
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
> plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE, add=TRUE)
plot(log_change, col=my_col2(100), legend=FALSE, axes=FALSE, box=FALSE, add=TRUE)
map('worldHires', add=TRUE,xlim=c(60.50792,96.99958), ylim=c(4.999584, 30))
par(font=2)
points(x=cities$x.coords, y=cities$y.coords, pch=16)
text(x=cities$x.coords, y=cities$y.coords, labels=cities$ï..names, pos=1)
par(font=4)
text(x=countrylabel$x.coords, y=countrylabel$y.coords, labels=countrylabel$ï..names)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
par(bty= "n")
> plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, line=2.5))
plot(change2, col=my_col2(100), legend.only=TRUE, legend.width=2, box=FALSE, legend.args=list(text='Increase in Population per Pixel', side=4, line=2.5))
japanPop <- raster("Japan Population.tif")
japanPop
tokyoPop <- crop(japanPop, c(139.285, 140.193, 35.055, 36.005))
tokyoPop
plot(tokyoPop)
plot(log10(tokyoPop+10)-1)
plot(log10(tokyoPop+10)-1, col=rainbow(100, start = 1/6, end= 4/6))
rm(japanPop)
for (i in c(1,2,3,4,5,6)) {}
for (i in c(1,2,3,4,5,6)) {
validate <- SLRno == i
validate <- validate * regionalID
zonal(Asia2015, validate, fun='sum')
}
rm(change, change.range)
rm(i)
validate <- SLRno == 1validate <- validate * regionalID
+ zonal(Asia2015, validate, fun='sum')
validate <- SLRno == 1
validate <- validate * regionalID
zonal(Asia2015, validate, fun='sum')
validate[regionalID == c(14,15,39,53,54,57,143,145,151,901)] <- 0
validate[regionalID == 35] <- 2
validate[regionalID == 30] <- 7
validate[regionalID == 34] <- 11
SLRregion <- validate * SLRno
zonal(Asia2015, SLRregion, fun='sum')
rm(change2, growth, growth2, log_change)
plot(log2015, col=rainbow(100, start=1/6, end=4/6), legend=FALSE, box=FALSE, axes=FALSE)
map('worldHires', add=TRUE)
plot(log2015, col=rainbow(100, start=2/6, end=4/6), legend=FALSE, box=FALSE, axes=FALSE)
urbanSLR <- regionalID * SLR0or1 * urban
levelplot(Asia2015, zscalelog=exp(1), col=rainbow(100, start=2/6, end=4/6), box=FALSE, axes=FALSE)
levelplot(Asia2015, margin=FALSE, zscalelog=exp(1), col=rainbow(100, start=2/6, end=4/6))
levelplot(Asia2015, margin=FALSE, zscalelog=exp(1))
levelplot(Asia2015, margin=FALSE, zscalelog=exp(1), axes=FALSE, box=FALSE)
hist(Asia2015)
hist(Asia2015, maxpixel=1000000)
hist(Asia2015, maxpixel=100000)
hist(Asia2015, maxpixel=1000)
freq(Asia2015 > 1000)
Asia2015v2 <- Asia2015
Asia2015v2[Asia2015v2 > 1000] <- 1000
chinaPop <- raster("China Population.tif")
beijingPop <- crop(chinaPop, c(116,119,36.5,40.5))
shanghaiPop <- crop(chinaPop, c(117.5,122,29.5,32.75))
rm(chinaPop)
levelplot(Asia2015, margin=FALSE, zscalelog=exp(1), axes=FALSE, box=FALSE, col.region=rainbow(100, start=2/6, end=4/6))
levelplot(Asia2015v2, margin=FALSE, zscalelog=exp(1), axes=FALSE, box=FALSE, col.region=rainbow(100, start=2/6, end=4/6))
my_col <- colorRampPalette(c("peachpuff", "springgreen", "steelblue"))
plot(log2015, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
maxvalue(log2015)
maxValue(log2015)
log2015v2 <- log2015
log2015v2[log2015v2 > 3] <- 3
plot(log2015v2, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
plot(tokyoPop, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
plot(log10(beijingPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(beijingPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(beijingPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(TokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(tokyoPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(log10(shanghaiPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
plot(log10(shanghaiPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE)
rect(par("usr")[1], par("usr")[3], par("usr")[2], par("usr")[4], col="lightblue")
plot(log10(shanghaiPop+10)-1, col=my_col(100), legend=FALSE, box=FALSE, axes=FALSE, add=TRUE)
savehistory("C:/Users/Alexis Glenn/Desktop/Datasets/Asian Population Raster Layers/June18.Rhistory")
savehistory("C:/Users/Alexis Glenn/Desktop/Datasets/Asian Population Raster Layers/June18.Rhistory")