-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRCPurbanfrac_stacks.R
64 lines (46 loc) · 2.18 KB
/
RCPurbanfrac_stacks.R
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
############ STACK RCP urban frac data ##############
# Load urban frac netcdf data from Hurt et al (2011) #
# And create stacks that can be used in further gridding#
# #
# Author: Niklas Boke-Olen #
# #
#########################################################
##NETCDF RCP urban fraction data downloaded from https://daac.ornl.gov/VEGETATION/guides/Land_Use_Harmonization_V1.html
# Chini, L.P., G.C. Hurtt, and S. Frolking. 2014. Harmonized Global Land Use for Years 1500 – 2100, V1. Data set. Available on-line [http://daac.ornl.gov] from Oak Ridge National Laboratory Distributed Active Archive Center, Oak Ridge, Tennessee, USA. http://dx.doi.org/10.3334/ORNLDAAC/1248
library(raster)
library(rgdal)
world <- readOGR(paste("WORLD.shp",sep=""),layer="WORLD")
world.df <- data.frame(world)
africa <- world[world.df$REGION==2,] #take out africa
##1700-2005 urban fraction
past <- brick('LUHa_u2t1.v1_gurbn.nc4')
past <- crop(past,africa)
#2000-2004
past <- past[[301:305]]
# MESSAGE (8.5 W/m2), AIM (6 W/m2), GCAM (4.5 W/m2), and IMAGE (2.6 W/m2).
# rcp8.5 2005 -2100
r <- brick('LUHa_u2t1.v1_message.v1_gurbn.nc4')
r <- crop(r,africa)
combine <- stack(past,r)
names(combine) <- paste('y',c(2000:2100),sep='')
writeRaster(combine,'hurtt_urbanfrac_rcp_8_5.tif',format='GTiff')
# rcp 6 2005 -2100
r <- brick('LUHa_u2.v1_aim.v1.1_gurbn.nc4')
r <- crop(r,africa)
combine <- stack(past,r)
names(combine) <- paste('y',c(2000:2100),sep='')
writeRaster(combine,'hurtt_urbanfrac_rcp_6.tif',format='GTiff')
# rcp 2.6 2005 -2100
r <- brick('LUHa_u2.v1_image.v1.1_gurbn.nc4')
r <- crop(r,africa)
combine <- stack(past,r)
names(combine) <- paste('y',c(2000:2100),sep='')
writeRaster(combine,'hurtt_urbanfrac_rcp_2_6.tif',format='GTiff')
# rcp 4.5 2005 -2100
r <- brick('LUHa_u2.v1_minicam.v1_gurbn.nc4')
r <- crop(r,africa)
combine <- stack(past,r)
names(combine) <- paste('y',c(2000:2100),sep='')
writeRaster(combine,'hurtt_urbanfrac_rcp_4_5.tif',format='GTiff')