├── README.md
├── R_scripts
├── 1_Funtions.R
├── 2_get_vars_t_series.R
├── 3.0_LULC_850_2015.R
├── 3.1_LULC_script_45.R
├── 3.2_LULC_script_85.R
├── 4_Accuracy_Mask_out_Greenland.R
├── 5_reclass.Rmd
├── 6_Remove_Greeland.R
├── 7_SSPscompare.R
└── README.md
├── Results
├── GLOBAL LAND-USE AND LAND-COVER DATA: HISTORICAL, CURRENT AND FUTURE SCENARIOS.pdf
├── README.md
└── supplemental material
│ ├── Accuracies.xlsx
│ └── Supplementary Material .pdf
├── data
├── RAW
│ └── README.md
├── README.md
├── data_for_validation
│ └── README.md
└── ssp_data_results
│ ├── Fig4_data&graficcs.xlsx
│ └── README.md
└── doc
└── Figures
├── 2020_2010_loe_resolution.png
├── Fig.2.png
├── Fig4.jpg
├── Fig_3.tif
├── Figure_1.tif
├── LUH2 _LULC@2x (1).png
├── LUH2_logo300.jpg
├── primf_final.tif
└── tex_sspl.png
/README.md:
--------------------------------------------------------------------------------
1 | ### GLOBAL LAND-USE AND LAND-COVER DATA: HISTORICAL, CURRENT AND FUTURE SCENARIOS
2 | #### Dataset available at [zenodo](https://zenodo.org/record/6570919?fbclid=IwAR0-xOZDqmjAUvVDL2Se5zIDycGg9kAQjA5_ajrA11p0GWKt1h2bhVOctfs#.YpjhENLMLiF).
3 |
4 |
5 | #### [Manuscript published in Biodiversity and Informatics journal](https://journals.ku.edu/jbi/article/view/15483/14122)
6 |
7 | #### [Webpage](https://tai-rocha.github.io/LUH2_Data/) of this repo .
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/R_scripts/1_Funtions.R:
--------------------------------------------------------------------------------
1 | ##########################################################################
2 | ## Funtions to extract time-series variables from netCDF file
3 | ## And to rename files from old raw names to new names
4 | ##########################################################################
5 |
6 | #Library
7 |
8 | library(sp)
9 | library(raster)
10 | library(rgdal)
11 | library(ncdf4)
12 |
13 | ### Funtion to extract
14 |
15 | netcdf_extract <- function(x){
16 |
17 | varr$name # Certificating that is a primnf variable
18 | varr_size <- varr$varsize ## There should be 1440 lons, 720 lats, and 86 times
19 | varr_dims <- varr$ndims ## 3 dimensions Long, Lat and time
20 | varr_v <- varr_size[varr_dims] ## Length of time dimension (for loop for)
21 | lat <- states_45_SSP2$dim$latitude$vals # latitude position
22 | lon <- states_45_SSP2$dim$longitude$vals # longitude position
23 | listaa <- list() # primf variable list
24 |
25 |
26 | #4 Loop to get 2015 to 2100 raster of primf
27 | for (i in 1:varr_v) {
28 | start <- rep(1,varr_dims) # begin with start=(1,1,...,1)
29 | start[varr_dims] <- i # change to start=(1,1,...,i) to read timestep i
30 | count <- varr_size # begin with count=(nx,ny,...,varr_v), reads entire var
31 | count[varr_dims] <- 1 # change to count=(nx,ny,...,1) to read 1 tstep
32 |
33 |
34 | ## Seleciona variável
35 | if(varr$name == "primf")
36 | {
37 | var_var <-ncvar_get(states_45_SSP2, varid = 'primf', start = start, count = count)
38 | }
39 | else if(varr$name == "primn")
40 | {
41 | var_var <-ncvar_get(states_45_SSP2, varid = 'primn', start = start, count = count)
42 | }
43 | else if(varr$name == "secdf")
44 | {
45 | var_var <-ncvar_get(states_45_SSP2, varid = 'secdf', start = start, count = count)
46 | }
47 | else if(varr$name == "secdn")
48 | {
49 | var_var <-ncvar_get(states_45_SSP2, varid = 'secdn', start = start, count = count)
50 | }
51 | else if(varr$name == "urban")
52 | {
53 | var_var <-ncvar_get(states_45_SSP2, varid = 'urabn', start = start, count = count)
54 | }
55 | else if(varr$name == "c3ann")
56 | {
57 | var_var <-ncvar_get(states_45_SSP2, varid = 'c3ann', start = start, count = count)
58 | }
59 | else if(varr$name == "c4ann")
60 | {
61 | var_var <-ncvar_get(states_45_SSP2, varid = 'c4ann', start = start, count = count)
62 | }
63 | else if(varr$name == "c3per")
64 | {
65 | var_var <-ncvar_get(states_45_SSP2, varid = 'c3per', start = start, count = count)
66 | }
67 | else if(varr$name == "c4per")
68 | {
69 | var_var <-ncvar_get(states_45_SSP2, varid = 'c4per', start = start, count = count)
70 | }
71 | else if(varr$name == "c3nfx")
72 | {
73 | var_var <-ncvar_get(states_45_SSP2, varid = 'c3nfx', start = start, count = count)
74 | }
75 | else if(varr$name == "pastr")
76 | {
77 | var_var <-ncvar_get(states_45_SSP2, varid = 'pastr', start = start, count = count)
78 | }
79 | else if(varr$name == "range")
80 | {
81 | var_var <-ncvar_get(states_45_SSP2, varid = 'range', start = start, count = count)
82 | }
83 |
84 | #5 convert to raster
85 | listaa[i] <- raster(var_var)
86 | }
87 |
88 | # Create layer stack with time dimension
89 | listaa <- stack(listaa)
90 |
91 | #7 Transpose the raster to have correct orientation
92 | listaa_final<-t(listaa)
93 |
94 | listaa_final
95 | # Set the coordinate reference system (CRS) and extent
96 | crs(listaa_final) <- crs_object # set crs of raster stack
97 | extent(listaa_final) <- c(-180,180, -90,90) # set extent
98 |
99 |
100 | # Write and save rasters in a year folders
101 |
102 | writeRaster(listaa_final, filename=file.path("./Results/SSP2_45_2015_2100/"), format="GTiff", bylayer=TRUE)
103 |
104 | return()
105 | }
106 |
107 |
108 | ### Funtions to rename files and than remove old files
109 |
110 | new_fnames <- function(x)
111 | {file.copy(from = old_files, to = new_files)
112 | file.remove(old_files)
113 | }
114 |
115 | ########
116 |
117 |
--------------------------------------------------------------------------------
/R_scripts/2_get_vars_t_series.R:
--------------------------------------------------------------------------------
1 | ########################################################################################
2 | # Get states
3 | # 4.1 prerelease R version
4 | ########################################################################################
5 |
6 | #Librarys
7 | library(sp)
8 | library(raster)
9 | library(rgdal)
10 | library(ncdf4)
11 | library(logr)
12 | library(rdtLite)
13 |
14 | ## Provenance Collector (for reproducibility purposes)
15 | prov.init(
16 | prov.dir = "./",
17 | overwrite = TRUE,
18 | snapshot.size = 0,
19 | hash.algorithm = "md5",
20 | save.debug = FALSE)
21 |
22 |
23 | ## Log collector (for reproducibility purposes)
24 | log_open(file_name = "", logdir = TRUE, show_notes = TRUE, autolog = TRUE)
25 |
26 | ## Initial setting
27 | # Get the coordinate reference system (CRS) for raster
28 | epsg <- make_EPSG() # call the list of epsg
29 | head(epsg) # search for epsg 4326 and put below
30 | crs_object <-"+proj=longlat +datum=WGS84" #object of crs
31 |
32 | #3 Get the coordinate reference system (CRS) for raster
33 | epsg <- make_EPSG() # call the list of epsg
34 | head(epsg) # search for epsg 4326 and put below
35 | crs_object <-"+proj=longlat +datum=WGS84" #object of crs
36 |
37 | #Open NetCDF
38 | states_45_SSP2 <- nc_open("./data/raw_data/LUH2 v2f Release (12_21_17)/RCP4.5 SSP2 (from MESSAGE-GLOBIOM)/multiple-states_input4MIPs_landState_ScenarioMIP_UofMD-MESSAGE-ssp245-2-1-f_gn_2015-2100.nc", write=TRUE, readunlim=TRUE, verbose = TRUE, auto_GMT = TRUE, suppress_dimvals = FALSE)
39 |
40 |
41 | ########################################################################################
42 | # Get states
43 | ########################################################################################
44 |
45 | #Call variables.It's deliminted by index, i.e "[[]]". The object must call "varr" for funtions of 1_Funtions.R scritp works.
46 |
47 | # primf
48 | varr <- states_45_SSP2$var[[1]]
49 |
50 | # Call function creates in script 1_funtions
51 |
52 | primf <- netcdf_extract(varr)
53 |
54 | log_print(primf)
55 |
56 | # List Old names
57 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
58 | old_files
59 |
60 | # Create new names. You need write the new name here.
61 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_primf_ssp2_45_",2015:2100,".tif")
62 | new_files
63 |
64 | ## Call new_fnames funtion, rename files and then remove olds files
65 | new_fnames(old_files)
66 |
67 | ## Clean environment and plots
68 | rm(list=ls()) ## list all environment objects and remove
69 |
70 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
71 |
72 | ## primn
73 |
74 | varr <- states_45_SSP2$var[[2]] ## Take primn variable
75 |
76 | # Call function creates in script 1_funtions
77 |
78 | primn <- netcdf_extract(varr)
79 |
80 | log_print(primn)
81 |
82 |
83 | # List Old names
84 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
85 | old_files
86 |
87 | # Create new names. You need write the new name here.
88 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_primn_ssp2_45_",2015:2100,".tif")
89 | new_files
90 |
91 | ## Call new_fnames funtion, rename files and then remove olds files
92 | new_fnames(old_files)
93 |
94 | ## Clean environment and plots
95 | rm(list=ls()) ## list all environment objects and remove
96 |
97 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
98 |
99 | ## secdf
100 | varr <- states_45_SSP2$var[[3]] ## Take secdf variable
101 |
102 | secdf <- netcdf_extract(varr)
103 |
104 | log_print(secdf)
105 |
106 | # List Old names
107 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
108 | old_files
109 |
110 | # Create new names. You need write the new name here.
111 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_secdf_ssp2_45_",2015:2100,".tif")
112 | new_files
113 |
114 | ## Call new_fnames funtion, rename files and then remove olds files
115 | new_fnames(old_files)
116 |
117 | ## Clean environment and plots
118 | rm(list=ls()) ## list all environment objects and remove
119 |
120 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
121 |
122 |
123 | ## secdn
124 | varr <- states_45_SSP2$var[[4]] ## Take secdn variable
125 |
126 | secdn <- netcdf_extract(varr)
127 |
128 | log_print(secdn)
129 |
130 | # List Old names
131 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
132 | old_files
133 |
134 | # Create new names. You need write the new name here.
135 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_secdn_ssp2_45_",2015:2100,".tif")
136 | new_files
137 |
138 | ## Call new_fnames funtion, rename files and then remove olds files
139 | new_fnames(old_files)
140 |
141 | ## Clean environment and plots
142 | rm(list=ls()) ## list all environment objects and remove
143 |
144 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
145 |
146 | ## urban
147 | varr <- states_45_SSP2$var[[5]] ## Take urban variable
148 |
149 | urban <- netcdf_extract(varr)
150 |
151 | log_print(urban)
152 |
153 | # List Old names
154 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
155 | old_files
156 |
157 | # Create new names. You need write the new name here.s
158 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_urban_ssp2_45_",2015:2100,".tif")
159 | new_files
160 |
161 | ## Call new_fnames funtion, rename files and then remove olds files
162 | new_fnames(old_files)
163 |
164 | ## Clean environment and plots
165 | rm(list=ls()) ## list all environment objects and remove
166 |
167 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
168 |
169 | ## c3ann
170 | varr <- states_45_SSP2$var[[6]] ## Take c3ann variable
171 |
172 | c3ann <- netcdf_extract(varr)
173 |
174 | log_print(c3ann)
175 |
176 | # List Old names
177 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
178 | old_files
179 |
180 | # Create new names. You need write the new name here.
181 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_c3ann_ssp2_45_",2015:2100,".tif")
182 | new_files
183 |
184 | ## Call new_fnames funtion, rename files and then remove olds files
185 | new_fnames(old_files)
186 |
187 | ## Clean environment and plots
188 | rm(list=ls()) ## list all environment objects and remove
189 |
190 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
191 |
192 | ## c4ann
193 | varr <- states_45_SSP2$var[[7]] ## Take c4ann variable
194 |
195 | c4ann <- netcdf_extract(varr)
196 |
197 | log_print(c4ann)
198 |
199 | # List Old names
200 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
201 | old_files
202 |
203 | # Create new names. You need write the new name here.
204 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_c4ann_ssp2_45_",2015:2100,".tif")
205 | new_files
206 |
207 | ## Call new_fnames funtion, rename files and then remove olds files
208 | new_fnames(old_files)
209 |
210 | ## Clean environment and plots
211 | rm(list=ls()) ## list all environment objects and remove
212 |
213 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
214 |
215 |
216 | ## c3per
217 | varr <- states_45_SSP2$var[[8]] ## Take c3per variable
218 |
219 | c3per <- netcdf_extract(varr)
220 |
221 | log_print(c3per)
222 |
223 | # List Old names
224 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
225 | old_files
226 |
227 | # Create new names. You need write the new name here.
228 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_c3per_ssp2_45_",2015:2100,".tif")
229 | new_files
230 |
231 | ## Call new_fnames funtion, rename files and then remove olds files
232 | new_fnames(old_files)
233 |
234 | ## Clean environment and plots
235 | rm(list=ls()) ## list all environment objects and remove
236 |
237 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
238 |
239 |
240 | ## c4per
241 | varr <- states_45_SSP2$var[[9]] ## Take c4per variable
242 |
243 | c4per <- netcdf_extract(varr)
244 |
245 | log_print(c4per)
246 |
247 | # List Old names
248 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
249 | old_files
250 |
251 | # Create new names. You need write the new name here.
252 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_c4per_ssp2_45_",2015:2100,".tif")
253 | new_files
254 |
255 | ## Call new_fnames funtion, rename files and then remove olds files
256 | new_fnames(old_files)
257 |
258 | ## Clean environment and plots
259 | rm(list=ls()) ## list all environment objects and remove
260 |
261 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
262 |
263 |
264 | ## c3nfx
265 | varr <- states_45_SSP2$var[[10]] ## Take c3nfx variable
266 |
267 | c3nfx <- netcdf_extract(varr)
268 |
269 | log_print(c3nfx)
270 |
271 | # List Old names
272 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
273 | old_files
274 |
275 | # Create new names. You need write the new name here.
276 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_c3nfx_ssp2_45_",2015:2100,".tif")
277 | new_files
278 |
279 | ## Call new_fnames funtion, rename files and then remove olds files
280 | new_fnames(old_files)
281 |
282 | ## Clean environment and plots
283 | rm(list=ls()) ## list all environment objects and remove
284 |
285 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
286 |
287 |
288 | ## pastr
289 | varr <- states_45_SSP2$var[[11]] ## Take pastr variable
290 |
291 | pastr <- netcdf_extract(varr)
292 |
293 | log_print(pastr)
294 |
295 | # List Old names
296 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
297 | old_files
298 |
299 | # Create new names. You need write the new name here.
300 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_pastr_ssp2_45_",2015:2100,".tif")
301 | new_files
302 |
303 | ## Call new_fnames funtion, rename files and then remove olds files
304 | new_fnames(old_files)
305 |
306 | ## Clean environment and plots
307 | rm(list=ls()) ## list all environment objects and remove
308 |
309 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
310 |
311 |
312 | ## range
313 | varr <- states_45_SSP2$var[[12]] ## Take range variable
314 |
315 | range <- netcdf_extract(varr)
316 |
317 | log_print(range)
318 |
319 | # List Old names
320 | old_files <- list.files("./Results/SSP2_45_2015_2100/", pattern = "*.tif", full.names = TRUE)
321 | old_files
322 |
323 | # Create new names. You need write the new name here.
324 | new_files <- paste0("./Results/SSP2_45_2015_2100/CMIP6_Land_Use_Harmonization_range_ssp2_45_",2015:2100,".tif")
325 | new_files
326 |
327 | ## Call new_fnames funtion, rename files and then remove olds files
328 | new_fnames(old_files)
329 |
330 | ## Clean environment and plots
331 | rm(list=ls()) ## list all environment objects and remove
332 |
333 | dev.off(dev.list()["RStudioGD"]) ## remove all plots
334 |
335 | log_close()
336 |
337 | prov.quit()
338 |
--------------------------------------------------------------------------------
/R_scripts/3.1_LULC_script_45.R:
--------------------------------------------------------------------------------
1 | #################################################################################################################
2 | ## Land-use Land-cover (LULC-files)
3 | ## To build this raster, we assumed the highest value among 12 states given a pixel (and so on for other pixels)
4 | ## Author script: Tainá Rocha
5 | ## R version 4.0.2
6 | #################################################################################################################
7 |
8 | ## Librarys
9 |
10 | library(raster)
11 | library(stats)
12 |
13 | ## Initial set
14 |
15 | setwd("./Results/SSP2_45_2015_2100/") # Set the parental folder
16 |
17 | ## Creating a list and select the subdirectories
18 |
19 |
20 | stack.list <- list() # Create a empty list for years stacks
21 |
22 | sub <- list.dirs(full.names=TRUE, recursive=FALSE) # List the subdirectories
23 |
24 |
25 | ### Automating through loop "for"
26 |
27 | for(j in 1:length(sub)) {
28 | print(sub[j])
29 |
30 | h <- list.files(path=sub[j], recursive= FALSE, full.names=TRUE, pattern='.tif')
31 | print(h)
32 |
33 | stack.list[[j]] <- stack(h)
34 |
35 | }
36 |
37 | LULC_2015_SSP2_45 <- which.max(stack.list[[1]])
38 | writeRaster(LULC_2015_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2015/LULC_2015_SSP2_45_CMIP6.tif")
39 |
40 | LULC_2016_SSP2_45 <- which.max(stack.list[[2]])
41 | writeRaster(LULC_2016_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2016/LULC_2016_SSP2_45_CMIP6.tif")
42 |
43 | LULC_2017_SSP2_45 <- which.max(stack.list[[3]])
44 | writeRaster(LULC_2017_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2017/LULC_2017_SSP2_45_CMIP6.tif")
45 |
46 | LULC_2018_SSP2_45 <- which.max(stack.list[[4]])
47 | writeRaster(LULC_2018_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2018/LULC_2018_SSP2_45_CMIP6.tif")
48 |
49 | LULC_2019_SSP2_45 <- which.max(stack.list[[5]])
50 | writeRaster(LULC_2019_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2019/LULC_2019_SSP2_45_CMIP6.tif")
51 |
52 | LULC_2020_SSP2_45 <- which.max(stack.list[[6]])
53 | writeRaster(LULC_2020_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2020/LULC_2020_SSP2_45_CMIP6.tif")
54 |
55 | LULC_2021_SSP2_45 <- which.max(stack.list[[7]])
56 | writeRaster(LULC_2021_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2021/LULC_2021_SSP2_45_CMIP6.tif")
57 |
58 | LULC_2022_SSP2_45 <- which.max(stack.list[[8]])
59 | writeRaster(LULC_2022_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2022/LULC_2022_SSP2_45_CMIP6.tif")
60 |
61 | LULC_2023_SSP2_45 <- which.max(stack.list[[9]])
62 | writeRaster(LULC_2023_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2023/LULC_2023_SSP2_45_CMIP6.tif")
63 |
64 | LULC_2024_SSP2_45 <- which.max(stack.list[[10]])
65 | writeRaster(LULC_2024_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2024/LULC_2024_SSP2_45_CMIP6.tif")
66 |
67 | LULC_2025_SSP2_45 <- which.max(stack.list[[11]])
68 | writeRaster(LULC_2025_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2025/LULC_2025_SSP2_45_CMIP6.tif")
69 |
70 | LULC_2026_SSP2_45 <- which.max(stack.list[[12]])
71 | writeRaster(LULC_2026_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2026/LULC_2026_SSP2_45_CMIP6.tif")
72 |
73 | LULC_2027_SSP2_45 <- which.max(stack.list[[13]])
74 | writeRaster(LULC_2027_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2027/LULC_2027_SSP2_45_CMIP6.tif")
75 |
76 | LULC_2028_SSP2_45 <- which.max(stack.list[[14]])
77 | writeRaster(LULC_2028_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2028/LULC_2028_SSP2_45_CMIP6.tif")
78 |
79 | LULC_2029_SSP2_45 <- which.max(stack.list[[15]])
80 | writeRaster(LULC_2029_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2029/LULC_2029_SSP2_45_CMIP6.tif")
81 |
82 | LULC_2030_SSP2_45 <- which.max(stack.list[[16]])
83 | writeRaster(LULC_2030_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2030/LULC_2030_SSP2_45_CMIP6.tif")
84 |
85 | LULC_2031_SSP2_45 <- which.max(stack.list[[17]])
86 | writeRaster(LULC_2031_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2031/LULC_2031_SSP2_45_CMIP6.tif")
87 |
88 | LULC_2032_SSP2_45 <- which.max(stack.list[[18]])
89 | writeRaster(LULC_2032_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2032/LULC_2032_SSP2_45_CMIP6.tif")
90 |
91 | LULC_2033_SSP2_45 <- which.max(stack.list[[19]])
92 | writeRaster(LULC_2033_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2033/LULC_2033_SSP2_45_CMIP6.tif")
93 |
94 | LULC_2034_SSP2_45 <- which.max(stack.list[[20]])
95 | writeRaster(LULC_2034_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2034/LULC_2034_SSP2_45_CMIP6.tif")
96 |
97 | LULC_2035_SSP2_45 <- which.max(stack.list[[21]])
98 | writeRaster(LULC_2035_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2035/LULC_2035_SSP2_45_CMIP6.tif")
99 |
100 | LULC_2036_SSP2_45 <- which.max(stack.list[[22]])
101 | writeRaster(LULC_2036_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2036/LULC_2036_SSP2_45_CMIP6.tif")
102 |
103 | LULC_2037_SSP2_45 <- which.max(stack.list[[23]])
104 | writeRaster(LULC_2037_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2037/LULC_2037_SSP2_45_CMIP6.tif")
105 |
106 | LULC_2038_SSP2_45 <- which.max(stack.list[[24]])
107 | writeRaster(LULC_2038_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2038/LULC_2038_SSP2_45_CMIP6.tif")
108 |
109 | LULC_2039_SSP2_45 <- which.max(stack.list[[25]])
110 | writeRaster(LULC_2039_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2039/LULC_2039_SSP2_45_CMIP6.tif")
111 |
112 | LULC_2040_SSP2_45 <- which.max(stack.list[[26]])
113 | writeRaster(LULC_2040_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2040/LULC_2040_SSP2_45_CMIP6.tif")
114 |
115 | LULC_2041_SSP2_45 <- which.max(stack.list[[27]])
116 | writeRaster(LULC_2041_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2041/LULC_2041_SSP2_45_CMIP6.tif")
117 |
118 | LULC_2042_SSP2_45 <- which.max(stack.list[[28]])
119 | writeRaster(LULC_2042_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2042/LULC_2042_SSP2_45_CMIP6.tif")
120 |
121 | LULC_2043_SSP2_45 <- which.max(stack.list[[29]])
122 | writeRaster(LULC_2043_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2043/LULC_2043_SSP2_45_CMIP6.tif")
123 |
124 | LULC_2044_SSP2_45 <- which.max(stack.list[[30]])
125 | writeRaster(LULC_2044_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2044/LULC_2044_SSP2_45_CMIP6.tif")
126 |
127 | LULC_2045_SSP2_45 <- which.max(stack.list[[31]])
128 | writeRaster(LULC_2045_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2045/LULC_2045_SSP2_45_CMIP6.tif")
129 |
130 | LULC_2046_SSP2_45 <- which.max(stack.list[[32]])
131 | writeRaster(LULC_2046_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2046/LULC_2046_SSP2_45_CMIP6.tif")
132 |
133 | LULC_2047_SSP2_45 <- which.max(stack.list[[33]])
134 | writeRaster(LULC_2047_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2047/LULC_2047_SSP2_45_CMIP6.tif")
135 |
136 | LULC_2048_SSP2_45 <- which.max(stack.list[[34]])
137 | writeRaster(LULC_2048_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2048/LULC_2048_SSP2_45_CMIP6.tif")
138 |
139 | LULC_2049_SSP2_45 <- which.max(stack.list[[35]])
140 | writeRaster(LULC_2049_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2049/LULC_2049_SSP2_45_CMIP6.tif")
141 |
142 | LULC_2050_SSP2_45 <- which.max(stack.list[[36]])
143 | writeRaster(LULC_2050_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2050/LULC_2050_SSP2_45_CMIP6.tif")
144 |
145 | LULC_2051_SSP2_45 <- which.max(stack.list[[37]])
146 | writeRaster(LULC_2051_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2051/LULC_2051_SSP2_45_CMIP6.tif")
147 |
148 | LULC_2052_SSP2_45 <- which.max(stack.list[[38]])
149 | writeRaster(LULC_2052_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2052/LULC_2052_SSP2_45_CMIP6.tif")
150 |
151 | LULC_2053_SSP2_45 <- which.max(stack.list[[39]])
152 | writeRaster(LULC_2053_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2053/LULC_2053_SSP2_45_CMIP6.tif")
153 |
154 | LULC_2054_SSP2_45 <- which.max(stack.list[[40]])
155 | writeRaster(LULC_2054_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2054/LULC_2054_SSP2_45_CMIP6.tif")
156 |
157 | LULC_2055_SSP2_45 <- which.max(stack.list[[41]])
158 | writeRaster(LULC_2055_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2055/LULC_2055_SSP2_45_CMIP6.tif")
159 |
160 | LULC_2056_SSP2_45 <- which.max(stack.list[[42]])
161 | writeRaster(LULC_2056_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2056/LULC_2056_SSP2_45_CMIP6.tif")
162 |
163 | LULC_2057_SSP2_45 <- which.max(stack.list[[43]])
164 | writeRaster(LULC_2057_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2057/LULC_2057_SSP2_45_CMIP6.tif")
165 |
166 | LULC_2058_SSP2_45 <- which.max(stack.list[[44]])
167 | writeRaster(LULC_2058_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2058/LULC_2058_SSP2_45_CMIP6.tif")
168 |
169 | LULC_2059_SSP2_45 <- which.max(stack.list[[45]])
170 | writeRaster(LULC_2059_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2059/LULC_2059_SSP2_45_CMIP6.tif")
171 |
172 | LULC_2060_SSP2_45 <- which.max(stack.list[[46]])
173 | writeRaster(LULC_2060_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2060/LULC_2060_SSP2_45_CMIP6.tif")
174 |
175 | LULC_2061_SSP2_45 <- which.max(stack.list[[47]])
176 | writeRaster(LULC_2061_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2061/LULC_2061_SSP2_45_CMIP6.tif")
177 |
178 | LULC_2062_SSP2_45 <- which.max(stack.list[[48]])
179 | writeRaster(LULC_2062_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2062/LULC_2062_SSP2_45_CMIP6.tif")
180 |
181 | LULC_2063_SSP2_45 <- which.max(stack.list[[49]])
182 | writeRaster(LULC_2063_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2063/LULC_2063_SSP2_45_CMIP6.tif")
183 |
184 | LULC_2064_SSP2_45 <- which.max(stack.list[[50]])
185 | writeRaster(LULC_2064_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2064/LULC_2064_SSP2_45_CMIP6.tif")
186 |
187 | LULC_2065_SSP2_45 <- which.max(stack.list[[51]])
188 | writeRaster(LULC_2065_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2065/LULC_2065_SSP2_45_CMIP6.tif")
189 |
190 | LULC_2066_SSP2_45 <- which.max(stack.list[[52]])
191 | writeRaster(LULC_2066_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2066/LULC_2066_SSP2_45_CMIP6.tif")
192 |
193 | LULC_2067_SSP2_45 <- which.max(stack.list[[53]])
194 | writeRaster(LULC_2067_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2067/LULC_2067_SSP2_45_CMIP6.tif")
195 |
196 | LULC_2068_SSP2_45 <- which.max(stack.list[[54]])
197 | writeRaster(LULC_2068_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2068/LULC_2068_SSP2_45_CMIP6.tif")
198 |
199 | LULC_2069_SSP2_45 <- which.max(stack.list[[55]])
200 | writeRaster(LULC_2069_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2069/LULC_2069_SSP2_45_CMIP6.tif")
201 |
202 | LULC_2070_SSP2_45 <- which.max(stack.list[[56]])
203 | writeRaster(LULC_2070_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2070/LULC_2070_SSP2_45_CMIP6.tif")
204 |
205 | LULC_2071_SSP2_45 <- which.max(stack.list[[57]])
206 | writeRaster(LULC_2071_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2071/LULC_2071_SSP2_45_CMIP6.tif")
207 |
208 | LULC_2072_SSP2_45 <- which.max(stack.list[[58]])
209 | writeRaster(LULC_2072_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2072/LULC_2072_SSP2_45_CMIP6.tif")
210 |
211 | LULC_2073_SSP2_45 <- which.max(stack.list[[59]])
212 | writeRaster(LULC_2073_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2073/LULC_2073_SSP2_45_CMIP6.tif")
213 |
214 | LULC_2074_SSP2_45 <- which.max(stack.list[[60]])
215 | writeRaster(LULC_2074_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2074/LULC_2074_SSP2_45_CMIP6.tif")
216 |
217 | LULC_2075_SSP2_45 <- which.max(stack.list[[61]])
218 | writeRaster(LULC_2075_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2075/LULC_2075_SSP2_45_CMIP6.tif")
219 |
220 | LULC_2076_SSP2_45 <- which.max(stack.list[[62]])
221 | writeRaster(LULC_2076_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2076/LULC_2076_SSP2_45_CMIP6.tif")
222 |
223 | LULC_2077_SSP2_45 <- which.max(stack.list[[63]])
224 | writeRaster(LULC_2077_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2077/LULC_2077_SSP2_45_CMIP6.tif")
225 |
226 | LULC_2078_SSP2_45 <- which.max(stack.list[[64]])
227 | writeRaster(LULC_2078_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2078/LULC_2078_SSP2_45_CMIP6.tif")
228 |
229 | LULC_2079_SSP2_45 <- which.max(stack.list[[65]])
230 | writeRaster(LULC_2079_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2079/LULC_2079_SSP2_45_CMIP6.tif")
231 |
232 | LULC_2080_SSP2_45 <- which.max(stack.list[[66]])
233 | writeRaster(LULC_2080_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2080/LULC_2080_SSP2_45_CMIP6.tif")
234 |
235 | LULC_2081_SSP2_45 <- which.max(stack.list[[67]])
236 | writeRaster(LULC_2081_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2081/LULC_2081_SSP2_45_CMIP6.tif")
237 |
238 | LULC_2082_SSP2_45 <- which.max(stack.list[[68]])
239 | writeRaster(LULC_2082_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2082/LULC_2082_SSP2_45_CMIP6.tif")
240 |
241 | LULC_2083_SSP2_45 <- which.max(stack.list[[69]])
242 | writeRaster(LULC_2083_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2083/LULC_2083_SSP2_45_CMIP6.tif")
243 |
244 | LULC_2084_SSP2_45 <- which.max(stack.list[[70]])
245 | writeRaster(LULC_2084_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2084/LULC_2084_SSP2_45_CMIP6.tif")
246 |
247 | LULC_2085_SSP2_45 <- which.max(stack.list[[71]])
248 | writeRaster(LULC_2085_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2085/LULC_2085_SSP2_45_CMIP6.tif")
249 |
250 | LULC_2086_SSP2_45 <- which.max(stack.list[[72]])
251 | writeRaster(LULC_2086_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2086/LULC_2086_SSP2_45_CMIP6.tif")
252 |
253 | LULC_2087_SSP2_45 <- which.max(stack.list[[73]])
254 | writeRaster(LULC_2087_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2087/LULC_2087_SSP2_45_CMIP6.tif")
255 |
256 | LULC_2088_SSP2_45 <- which.max(stack.list[[74]])
257 | writeRaster(LULC_2088_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2088/LULC_2088_SSP2_45_CMIP6.tif")
258 |
259 | LULC_2089_SSP2_45 <- which.max(stack.list[[75]])
260 | writeRaster(LULC_2089_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2089/LULC_2089_SSP2_45_CMIP6.tif")
261 |
262 | LULC_2090_SSP2_45 <- which.max(stack.list[[76]])
263 | writeRaster(LULC_2090_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2090/LULC_2090_SSP2_45_CMIP6.tif")
264 |
265 | LULC_2091_SSP2_45 <- which.max(stack.list[[77]])
266 | writeRaster(LULC_2091_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2091/LULC_2091_SSP2_45_CMIP6.tif")
267 |
268 | LULC_2092_SSP2_45 <- which.max(stack.list[[78]])
269 | writeRaster(LULC_2092_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2092/LULC_2092_SSP2_45_CMIP6.tif")
270 |
271 | LULC_2093_SSP2_45 <- which.max(stack.list[[79]])
272 | writeRaster(LULC_2093_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2093/LULC_2093_SSP2_45_CMIP6.tif")
273 |
274 | LULC_2094_SSP2_45 <- which.max(stack.list[[80]])
275 | writeRaster(LULC_2094_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2094/LULC_2094_SSP2_45_CMIP6.tif")
276 |
277 | LULC_2095_SSP2_45 <- which.max(stack.list[[81]])
278 | writeRaster(LULC_2095_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2095/LULC_2095_SSP2_45_CMIP6.tif")
279 |
280 | LULC_2096_SSP2_45 <- which.max(stack.list[[82]])
281 | writeRaster(LULC_2096_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2096/LULC_2096_SSP2_45_CMIP6.tif")
282 |
283 | LULC_2097_SSP2_45 <- which.max(stack.list[[83]])
284 | writeRaster(LULC_2097_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2097/LULC_2097_SSP2_45_CMIP6.tif")
285 |
286 | LULC_2098_SSP2_45 <- which.max(stack.list[[84]])
287 | writeRaster(LULC_2098_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2098/LULC_2098_SSP2_45_CMIP6.tif")
288 |
289 | LULC_2099_SSP2_45 <- which.max(stack.list[[85]])
290 | writeRaster(LULC_2099_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2099/LULC_2099_SSP2_45_CMIP6.tif")
291 |
292 | LULC_2100_SSP2_45 <- which.max(stack.list[[86]])
293 | writeRaster(LULC_2100_SSP2_45, "./CMIP6_Land_Use_Harmonization_SSP2_45_2100/LULC_2100_SSP2_45_CMIP6.tif")
294 |
295 |
296 |
297 |
298 | ################# End
299 |
300 |
--------------------------------------------------------------------------------
/R_scripts/3.2_LULC_script_85.R:
--------------------------------------------------------------------------------
1 | #################################################################################################################
2 | ## Land-use Land-cover (LULC-files)
3 | ## To build this raster, we assumed the highest value among 12 states given a pixel (and so on for other pixels)
4 | ## Author script: Tainá Rocha
5 | ## R version 4.0.2
6 | #################################################################################################################
7 |
8 | ## Librarys
9 |
10 | library(raster)
11 | library(stats)
12 |
13 | ## Initial set
14 |
15 | setwd("./Results/SSP5_85_2015_2100/") # Set the parental folder
16 |
17 | ## Creating a list and select the subdirectories
18 |
19 |
20 | stack.list <- list() # Create a empty list for years stacks
21 |
22 | sub <- list.dirs(full.names=TRUE, recursive=FALSE) # List the subdirectories
23 |
24 |
25 | ### Automating through loop "for"
26 |
27 | for(j in 1:length(sub)) {
28 | print(sub[j])
29 |
30 | h <- list.files(path=sub[j], recursive= FALSE, full.names=TRUE, pattern='.tif')
31 | print(h)
32 |
33 | stack.list[[j]] <- stack(h)
34 |
35 | }
36 |
37 | LULC_2015_SSP5_85 <- which.max(stack.list[[1]])
38 | writeRaster(LULC_2015_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2015/LULC_2015_SSP5_85_CMIP6.tif")
39 |
40 | LULC_2016_SSP5_85 <- which.max(stack.list[[2]])
41 | writeRaster(LULC_2016_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2016/LULC_2016_SSP5_85_CMIP6.tif")
42 |
43 | LULC_2017_SSP5_85 <- which.max(stack.list[[3]])
44 | writeRaster(LULC_2017_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2017/LULC_2017_SSP5_85_CMIP6.tif")
45 |
46 | LULC_2018_SSP5_85 <- which.max(stack.list[[4]])
47 | writeRaster(LULC_2018_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2018/LULC_2018_SSP5_85_CMIP6.tif")
48 |
49 | LULC_2019_SSP5_85 <- which.max(stack.list[[5]])
50 | writeRaster(LULC_2019_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2019/LULC_2019_SSP5_85_CMIP6.tif")
51 |
52 | LULC_2020_SSP5_85 <- which.max(stack.list[[6]])
53 | writeRaster(LULC_2020_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2020/LULC_2020_SSP5_85_CMIP6.tif")
54 |
55 | LULC_2021_SSP5_85 <- which.max(stack.list[[7]])
56 | writeRaster(LULC_2021_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2021/LULC_2021_SSP5_85_CMIP6.tif")
57 |
58 | LULC_2022_SSP5_85 <- which.max(stack.list[[8]])
59 | writeRaster(LULC_2022_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2022/LULC_2022_SSP5_85_CMIP6.tif")
60 |
61 | LULC_2023_SSP5_85 <- which.max(stack.list[[9]])
62 | writeRaster(LULC_2023_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2023/LULC_2023_SSP5_85_CMIP6.tif")
63 |
64 | LULC_2024_SSP5_85 <- which.max(stack.list[[10]])
65 | writeRaster(LULC_2024_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2024/LULC_2024_SSP5_85_CMIP6.tif")
66 |
67 | LULC_2025_SSP5_85 <- which.max(stack.list[[11]])
68 | writeRaster(LULC_2025_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2025/LULC_2025_SSP5_85_CMIP6.tif")
69 |
70 | LULC_2026_SSP5_85 <- which.max(stack.list[[12]])
71 | writeRaster(LULC_2026_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2026/LULC_2026_SSP5_85_CMIP6.tif")
72 |
73 | LULC_2027_SSP5_85 <- which.max(stack.list[[13]])
74 | writeRaster(LULC_2027_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2027/LULC_2027_SSP5_85_CMIP6.tif")
75 |
76 | LULC_2028_SSP5_85 <- which.max(stack.list[[14]])
77 | writeRaster(LULC_2028_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2028/LULC_2028_SSP5_85_CMIP6.tif")
78 |
79 | LULC_2029_SSP5_85 <- which.max(stack.list[[15]])
80 | writeRaster(LULC_2029_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2029/LULC_2029_SSP5_85_CMIP6.tif")
81 |
82 | LULC_2030_SSP5_85 <- which.max(stack.list[[16]])
83 | writeRaster(LULC_2030_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2030/LULC_2030_SSP5_85_CMIP6.tif")
84 |
85 | LULC_2031_SSP5_85 <- which.max(stack.list[[17]])
86 | writeRaster(LULC_2031_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2031/LULC_2031_SSP5_85_CMIP6.tif")
87 |
88 | LULC_2032_SSP5_85 <- which.max(stack.list[[18]])
89 | writeRaster(LULC_2032_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2032/LULC_2032_SSP5_85_CMIP6.tif")
90 |
91 | LULC_2033_SSP5_85 <- which.max(stack.list[[19]])
92 | writeRaster(LULC_2033_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2033/LULC_2033_SSP5_85_CMIP6.tif")
93 |
94 | LULC_2034_SSP5_85 <- which.max(stack.list[[20]])
95 | writeRaster(LULC_2034_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2034/LULC_2034_SSP5_85_CMIP6.tif")
96 |
97 | LULC_2035_SSP5_85 <- which.max(stack.list[[21]])
98 | writeRaster(LULC_2035_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2035/LULC_2035_SSP5_85_CMIP6.tif")
99 |
100 | LULC_2036_SSP5_85 <- which.max(stack.list[[22]])
101 | writeRaster(LULC_2036_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2036/LULC_2036_SSP5_85_CMIP6.tif")
102 |
103 | LULC_2037_SSP5_85 <- which.max(stack.list[[23]])
104 | writeRaster(LULC_2037_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2037/LULC_2037_SSP5_85_CMIP6.tif")
105 |
106 | LULC_2038_SSP5_85 <- which.max(stack.list[[24]])
107 | writeRaster(LULC_2038_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2038/LULC_2038_SSP5_85_CMIP6.tif")
108 |
109 | LULC_2039_SSP5_85 <- which.max(stack.list[[25]])
110 | writeRaster(LULC_2039_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2039/LULC_2039_SSP5_85_CMIP6.tif")
111 |
112 | LULC_2040_SSP5_85 <- which.max(stack.list[[26]])
113 | writeRaster(LULC_2040_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2040/LULC_2040_SSP5_85_CMIP6.tif")
114 |
115 | LULC_2041_SSP5_85 <- which.max(stack.list[[27]])
116 | writeRaster(LULC_2041_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2041/LULC_2041_SSP5_85_CMIP6.tif")
117 |
118 | LULC_2042_SSP5_85 <- which.max(stack.list[[28]])
119 | writeRaster(LULC_2042_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2042/LULC_2042_SSP5_85_CMIP6.tif")
120 |
121 | LULC_2043_SSP5_85 <- which.max(stack.list[[29]])
122 | writeRaster(LULC_2043_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2043/LULC_2043_SSP5_85_CMIP6.tif")
123 |
124 | LULC_2044_SSP5_85 <- which.max(stack.list[[30]])
125 | writeRaster(LULC_2044_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2044/LULC_2044_SSP5_85_CMIP6.tif")
126 |
127 | LULC_2045_SSP5_85 <- which.max(stack.list[[31]])
128 | writeRaster(LULC_2045_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2045/LULC_2045_SSP5_85_CMIP6.tif")
129 |
130 | LULC_2046_SSP5_85 <- which.max(stack.list[[32]])
131 | writeRaster(LULC_2046_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2046/LULC_2046_SSP5_85_CMIP6.tif")
132 |
133 | LULC_2047_SSP5_85 <- which.max(stack.list[[33]])
134 | writeRaster(LULC_2047_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2047/LULC_2047_SSP5_85_CMIP6.tif")
135 |
136 | LULC_2048_SSP5_85 <- which.max(stack.list[[34]])
137 | writeRaster(LULC_2048_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2048/LULC_2048_SSP5_85_CMIP6.tif")
138 |
139 | LULC_2049_SSP5_85 <- which.max(stack.list[[35]])
140 | writeRaster(LULC_2049_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2049/LULC_2049_SSP5_85_CMIP6.tif")
141 |
142 | LULC_2050_SSP5_85 <- which.max(stack.list[[36]])
143 | writeRaster(LULC_2050_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2050/LULC_2050_SSP5_85_CMIP6.tif")
144 |
145 | LULC_2051_SSP5_85 <- which.max(stack.list[[37]])
146 | writeRaster(LULC_2051_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2051/LULC_2051_SSP5_85_CMIP6.tif")
147 |
148 | LULC_2052_SSP5_85 <- which.max(stack.list[[38]])
149 | writeRaster(LULC_2052_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2052/LULC_2052_SSP5_85_CMIP6.tif")
150 |
151 | LULC_2053_SSP5_85 <- which.max(stack.list[[39]])
152 | writeRaster(LULC_2053_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2053/LULC_2053_SSP5_85_CMIP6.tif")
153 |
154 | LULC_2054_SSP5_85 <- which.max(stack.list[[40]])
155 | writeRaster(LULC_2054_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2054/LULC_2054_SSP5_85_CMIP6.tif")
156 |
157 | LULC_2055_SSP5_85 <- which.max(stack.list[[41]])
158 | writeRaster(LULC_2055_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2055/LULC_2055_SSP5_85_CMIP6.tif")
159 |
160 | LULC_2056_SSP5_85 <- which.max(stack.list[[42]])
161 | writeRaster(LULC_2056_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2056/LULC_2056_SSP5_85_CMIP6.tif")
162 |
163 | LULC_2057_SSP5_85 <- which.max(stack.list[[43]])
164 | writeRaster(LULC_2057_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2057/LULC_2057_SSP5_85_CMIP6.tif")
165 |
166 | LULC_2058_SSP5_85 <- which.max(stack.list[[44]])
167 | writeRaster(LULC_2058_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2058/LULC_2058_SSP5_85_CMIP6.tif")
168 |
169 | LULC_2059_SSP5_85 <- which.max(stack.list[[45]])
170 | writeRaster(LULC_2059_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2059/LULC_2059_SSP5_85_CMIP6.tif")
171 |
172 | LULC_2060_SSP5_85 <- which.max(stack.list[[46]])
173 | writeRaster(LULC_2060_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2060/LULC_2060_SSP5_85_CMIP6.tif")
174 |
175 | LULC_2061_SSP5_85 <- which.max(stack.list[[47]])
176 | writeRaster(LULC_2061_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2061/LULC_2061_SSP5_85_CMIP6.tif")
177 |
178 | LULC_2062_SSP5_85 <- which.max(stack.list[[48]])
179 | writeRaster(LULC_2062_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2062/LULC_2062_SSP5_85_CMIP6.tif")
180 |
181 | LULC_2063_SSP5_85 <- which.max(stack.list[[49]])
182 | writeRaster(LULC_2063_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2063/LULC_2063_SSP5_85_CMIP6.tif")
183 |
184 | LULC_2064_SSP5_85 <- which.max(stack.list[[50]])
185 | writeRaster(LULC_2064_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2064/LULC_2064_SSP5_85_CMIP6.tif")
186 |
187 | LULC_2065_SSP5_85 <- which.max(stack.list[[51]])
188 | writeRaster(LULC_2065_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2065/LULC_2065_SSP5_85_CMIP6.tif")
189 |
190 | LULC_2066_SSP5_85 <- which.max(stack.list[[52]])
191 | writeRaster(LULC_2066_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2066/LULC_2066_SSP5_85_CMIP6.tif")
192 |
193 | LULC_2067_SSP5_85 <- which.max(stack.list[[53]])
194 | writeRaster(LULC_2067_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2067/LULC_2067_SSP5_85_CMIP6.tif")
195 |
196 | LULC_2068_SSP5_85 <- which.max(stack.list[[54]])
197 | writeRaster(LULC_2068_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2068/LULC_2068_SSP5_85_CMIP6.tif")
198 |
199 | LULC_2069_SSP5_85 <- which.max(stack.list[[55]])
200 | writeRaster(LULC_2069_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2069/LULC_2069_SSP5_85_CMIP6.tif")
201 |
202 | LULC_2070_SSP5_85 <- which.max(stack.list[[56]])
203 | writeRaster(LULC_2070_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2070/LULC_2070_SSP5_85_CMIP6.tif")
204 |
205 | LULC_2071_SSP5_85 <- which.max(stack.list[[57]])
206 | writeRaster(LULC_2071_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2071/LULC_2071_SSP5_85_CMIP6.tif")
207 |
208 | LULC_2072_SSP5_85 <- which.max(stack.list[[58]])
209 | writeRaster(LULC_2072_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2072/LULC_2072_SSP5_85_CMIP6.tif")
210 |
211 | LULC_2073_SSP5_85 <- which.max(stack.list[[59]])
212 | writeRaster(LULC_2073_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2073/LULC_2073_SSP5_85_CMIP6.tif")
213 |
214 | LULC_2074_SSP5_85 <- which.max(stack.list[[60]])
215 | writeRaster(LULC_2074_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2074/LULC_2074_SSP5_85_CMIP6.tif")
216 |
217 | LULC_2075_SSP5_85 <- which.max(stack.list[[61]])
218 | writeRaster(LULC_2075_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2075/LULC_2075_SSP5_85_CMIP6.tif")
219 |
220 | LULC_2076_SSP5_85 <- which.max(stack.list[[62]])
221 | writeRaster(LULC_2076_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2076/LULC_2076_SSP5_85_CMIP6.tif")
222 |
223 | LULC_2077_SSP5_85 <- which.max(stack.list[[63]])
224 | writeRaster(LULC_2077_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2077/LULC_2077_SSP5_85_CMIP6.tif")
225 |
226 | LULC_2078_SSP5_85 <- which.max(stack.list[[64]])
227 | writeRaster(LULC_2078_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2078/LULC_2078_SSP5_85_CMIP6.tif")
228 |
229 | LULC_2079_SSP5_85 <- which.max(stack.list[[65]])
230 | writeRaster(LULC_2079_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2079/LULC_2079_SSP5_85_CMIP6.tif")
231 |
232 | LULC_2080_SSP5_85 <- which.max(stack.list[[66]])
233 | writeRaster(LULC_2080_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2080/LULC_2080_SSP5_85_CMIP6.tif")
234 |
235 | LULC_2081_SSP5_85 <- which.max(stack.list[[67]])
236 | writeRaster(LULC_2081_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2081/LULC_2081_SSP5_85_CMIP6.tif")
237 |
238 | LULC_2082_SSP5_85 <- which.max(stack.list[[68]])
239 | writeRaster(LULC_2082_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2082/LULC_2082_SSP5_85_CMIP6.tif")
240 |
241 | LULC_2083_SSP5_85 <- which.max(stack.list[[69]])
242 | writeRaster(LULC_2083_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2083/LULC_2083_SSP5_85_CMIP6.tif")
243 |
244 | LULC_2084_SSP5_85 <- which.max(stack.list[[70]])
245 | writeRaster(LULC_2084_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2084/LULC_2084_SSP5_85_CMIP6.tif")
246 |
247 | LULC_2085_SSP5_85 <- which.max(stack.list[[71]])
248 | writeRaster(LULC_2085_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2085/LULC_2085_SSP5_85_CMIP6.tif")
249 |
250 | LULC_2086_SSP5_85 <- which.max(stack.list[[72]])
251 | writeRaster(LULC_2086_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2086/LULC_2086_SSP5_85_CMIP6.tif")
252 |
253 | LULC_2087_SSP5_85 <- which.max(stack.list[[73]])
254 | writeRaster(LULC_2087_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2087/LULC_2087_SSP5_85_CMIP6.tif")
255 |
256 | LULC_2088_SSP5_85 <- which.max(stack.list[[74]])
257 | writeRaster(LULC_2088_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2088/LULC_2088_SSP5_85_CMIP6.tif")
258 |
259 | LULC_2089_SSP5_85 <- which.max(stack.list[[75]])
260 | writeRaster(LULC_2089_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2089/LULC_2089_SSP5_85_CMIP6.tif")
261 |
262 | LULC_2090_SSP5_85 <- which.max(stack.list[[76]])
263 | writeRaster(LULC_2090_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2090/LULC_2090_SSP5_85_CMIP6.tif")
264 |
265 | LULC_2091_SSP5_85 <- which.max(stack.list[[77]])
266 | writeRaster(LULC_2091_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2091/LULC_2091_SSP5_85_CMIP6.tif")
267 |
268 | LULC_2092_SSP5_85 <- which.max(stack.list[[78]])
269 | writeRaster(LULC_2092_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2092/LULC_2092_SSP5_85_CMIP6.tif")
270 |
271 | LULC_2093_SSP5_85 <- which.max(stack.list[[79]])
272 | writeRaster(LULC_2093_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2093/LULC_2093_SSP5_85_CMIP6.tif")
273 |
274 | LULC_2094_SSP5_85 <- which.max(stack.list[[80]])
275 | writeRaster(LULC_2094_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2094/LULC_2094_SSP5_85_CMIP6.tif")
276 |
277 | LULC_2095_SSP5_85 <- which.max(stack.list[[81]])
278 | writeRaster(LULC_2095_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2095/LULC_2095_SSP5_85_CMIP6.tif")
279 |
280 | LULC_2096_SSP5_85 <- which.max(stack.list[[82]])
281 | writeRaster(LULC_2096_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2096/LULC_2096_SSP5_85_CMIP6.tif")
282 |
283 | LULC_2097_SSP5_85 <- which.max(stack.list[[83]])
284 | writeRaster(LULC_2097_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2097/LULC_2097_SSP5_85_CMIP6.tif")
285 |
286 | LULC_2098_SSP5_85 <- which.max(stack.list[[84]])
287 | writeRaster(LULC_2098_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2098/LULC_2098_SSP5_85_CMIP6.tif")
288 |
289 | LULC_2099_SSP5_85 <- which.max(stack.list[[85]])
290 | writeRaster(LULC_2099_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2099/LULC_2099_SSP5_85_CMIP6.tif")
291 |
292 | LULC_2100_SSP5_85 <- which.max(stack.list[[86]])
293 | writeRaster(LULC_2100_SSP5_85, "./CMIP6_Land_Use_Harmonization_SSP5_85_2100/LULC_2100_SSP5_85_CMIP6.tif")
294 |
295 |
296 | ################# End
297 |
298 |
--------------------------------------------------------------------------------
/R_scripts/4_Accuracy_Mask_out_Greenland.R:
--------------------------------------------------------------------------------
1 | #####Este script corta variáveis raster (.asc) por shapes (.shp)
2 |
3 |
4 | # library -----------------------------------------------------------------
5 |
6 |
7 | library(raster)
8 | library(diffeR)
9 | library(rgdal)
10 | library(maptools)
11 |
12 | # Read shape --------------------------------------------------------------
13 |
14 |
15 | Mask_Greenland <- readOGR("./data/Shapes/Sem_Greeland.shp") # carregando o shape pela função OGR do pacote rgdal
16 | plot(Mask_Greenland) #plotando
17 |
18 |
19 | # Read raster -------------------------------------------------------------
20 |
21 | FAO <-raster("./data/FAO/FAO_reclassified.tif")
22 |
23 | LUH2 <-raster("./data/Accuracy/Reclassified/LULC_2000_CMIP6_reclass.tif")
24 |
25 |
26 |
27 | ### FAO Crop and Mask
28 | FAO_masked <- mask(x = FAO, mask = Mask_Greenland) #aplicando a máscara (shape) pela função mask do pacote raster
29 | #plot(FAO_masked) # plot
30 |
31 | FAO_extention <- crop(x = FAO_masked, y = extent(Mask_Greenland)) #agora corte por essa máscara
32 |
33 | ext <- extent(-180, 180, -90, 83)
34 | extent(FAO_extention) <- ext
35 | FAO_extention <- setExtent(FAO_extention, ext, keepres=TRUE)
36 |
37 | plot(FAO_extention)
38 |
39 | ## Reclassify again
40 |
41 | Matriz_FAO_2 <-matrix(data=c(0,1,2,3,4,NA,1,2,3,4),nrow=5,ncol=2)
42 |
43 | FAO_final <-reclassify(x = FAO_extention, #objeto raster
44 | rcl = Matriz_FAO_2, #matriz criada com os valores de origem e destino
45 | filename="FAO_reclassified") #nome do arquivo de output
46 |
47 | plot(FAO_final)
48 |
49 | writeRaster(FAO_final, "./data/Accuracy/Reclassified/FAO_reclass_final.tif", format="GTiff") ### Isto vai salvar no local em que estiver o projeto. Veja este local no canto superior direito
50 |
51 |
52 | ### LUH2 Crop and Mask
53 | LUh2_masked <- mask(x = LUH2, mask = Mask_Greenland) #aplicando a máscara (shape) pela função mask do pacote raster
54 | plot(LUh2_masked) # plot
55 |
56 | LUh2_extention <- crop(x = LUh2_masked, y = extent(Mask_Greenland)) #agora corte por essa máscara
57 | plot(LUh2_extention)
58 |
59 | writeRaster(LUh2_extention, "./data/Accuracy/Reclassified/LUH2_reclass_final.tif", format="GTiff") ### Isto vai salvar no local em que estiver o projeto. Veja este local no canto superior direito
60 |
61 |
62 | ######################
63 |
64 |
--------------------------------------------------------------------------------
/R_scripts/5_reclass.Rmd:
--------------------------------------------------------------------------------
1 | ## Reclassifing LULC raster and FAO (reference map) for accuracy
2 | #### Author: Tainá Rocha
3 | ###### 4.02 R version
4 |
5 |
6 | Library
7 | ```{r}
8 | library(raster)
9 | library(rgeos)
10 | library(rgdal)
11 | ```
12 |
13 | ## GLC-SHARE reclassification
14 |
15 | | Original class code | Original GCL-SHARE class names | Code(names) after reclassification |
16 | |----------------------|-----------------------------------------------------|------------------------------------|
17 | | 1 | Artificial surfaces | 4 (urban) |
18 | | 2 | Cropland | 2 (crops) |
19 | | 3 | Grassland | 3 (open areas) |
20 | | 4 | Tree covered areas | 1 (forest) |
21 | | 5 | Shrubs covered areas | 3 (open areas) |
22 | | 6 | Herbaceous vegetation, aquatic or regularly flooded | 3 (open areas) |
23 | | 7 | Mangroves | 1 (forest) |
24 | | 8 | Sparse vegetation | 3 (open areas) |
25 | | 9 | Bare soil | 3 (open areas) |
26 | | 10 | Snow and glaciers | masked-out |
27 | | 11 | Water bodies | masked-out |
28 |
29 |
30 | Create a matrix where the current pixel values will be replaced by new values
31 |
32 | ```{r}
33 | FAO_matriz_reclass <-matrix(data=c(1,2,3,4,5,6,7,8,9,10,11,4,2,3,1,3,3,1,3,3,NA,NA),nrow=11,ncol=2)
34 | ```
35 |
36 | Load reference map
37 | ```{r}
38 | raster_FAO <-raster("./data/FAO/GlcShare_v10_Dominant/glc_shv10_DOM.Tif")
39 | as.factor(raster_FAO)
40 | plot(raster_FAO)
41 | ```
42 |
43 | Reclassification
44 |
45 | ```{r}
46 | raster_reclass_2<-reclassify(x = raster_FAO, #objeto raster
47 | rcl = FAO_matriz_reclass, #matriz criada com os valores de origem e destino
48 | filename="FAO_reclassified") #nome do arquivo de output
49 |
50 | ## Plot and Save
51 | as.factor(raster_reclass_2)
52 | plot(raster_reclass_2)
53 | writeRaster(raster_reclass_2,"./data/FAO/FAO_reclassified.tif")
54 | ```
55 |
56 | ## LUH2 reclassification
57 |
58 | | Original class code | Original LUH2 class names | Code(names) after reclassification |
59 | |---------------------|-------------------------------------------------|------------------------------------|
60 | | 1 | C3 Annual Crops (c3ann) | 2 (crops) |
61 | | 2 | C3 Nitrogen-Fixing Crops (c3nfx) | 2 (crops) |
62 | | 3 | C3 Perennial Crops (c3per) | 2 (crops) |
63 | | 4 | C4 Annual Crops (c4ann) | 2 (crops) |
64 | | 5 | C4 Perennial Crops (c4per) | 2 (crops) |
65 | | 6 | Managed Pasture (pastr) | 3 (open areas) |
66 | | 7 | Forested Primary Land (primnf) | 1 (forest) |
67 | | 8 | Non-Forested Primary Land (primn) | 3 (open areas) |
68 | | 9 | Rangeland (range) | 3 (open areas) |
69 | | 10 | Potentially Forested Secondary Land (secdf) | 1 (forest) |
70 | | 11 | Potentially Non-Forested Secondary Land (secdn) | 3 (open areas) |
71 | | 12 | Urban Land (urban) | 4 (urban) |
72 |
73 | Create a matrix where the current pixel values will be replaced by new values
74 | ```{r}
75 | matriz_2000_reclass<-matrix(data=c(1,2,3,4,5,6,7,8,9,10,11,12,2,2,2,2,2,3,1,3,3,1,3,4),nrow=12,ncol=2)
76 | ```
77 |
78 | Load LUH2 map
79 |
80 | ```{r}
81 | raster_2000 <-raster("./data/Accuracy/LULC_2000_CMPI_accucary_input.tif")
82 | plot(raster_2000)
83 | ```
84 |
85 | Reclassification
86 |
87 | ```{r}
88 | raster_2000_reclass <-reclassify(x = raster_2000, #objeto raster
89 | rcl = matriz_2000_reclass, #matriz criada com os valores de origem e destino
90 | filename="2000_reclass") #nome do arquivo de output
91 |
92 | ## Save ad plot
93 | writeRaster(raster_2000_reclass,"./data/Accuracy/Reclassified/LULC_2000_CMIP6_reclass.tif")
94 | plot(raster_2000_reclass)
95 | ```
96 |
97 | ## End
98 |
--------------------------------------------------------------------------------
/R_scripts/6_Remove_Greeland.R:
--------------------------------------------------------------------------------
1 | ############################################
2 | ## Remove Greenlan from LULc files
3 | ## Author: Tainá Rocha
4 | ## Date : 27/04/202
5 | ## 4.02 R version
6 | ############################################
7 |
8 | library(raster)
9 | library(rgdal)
10 |
11 | ## Shape Mask for all files
12 |
13 | mascara <- readOGR("./data/Accuracy/Shapes/Sem_Greeland.shp") # Load shape
14 | #plot(mascara)
15 |
16 | #################################### 850 _2015 ####################################
17 |
18 | ##### List of directories
19 |
20 | lista_850 <-list.dirs("./Results/850_2015/")
21 |
22 | #plot(mascara) # plot shape
23 |
24 | ## Stack all files
25 |
26 | stack_LULC <- stack(list.files(path=lista_850, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
27 | plot(stack_LULC)
28 |
29 | # Aplly mask
30 | mascara_LULC <- mask(x = stack_LULC, mask = mascara)
31 |
32 | ## Crop by mask
33 |
34 | final_LULC <- crop(x = mascara_LULC, y = extent(mascara))
35 |
36 | ## Get correct names
37 |
38 | a <- paste0(names(stack_LULC), ".tif")
39 |
40 | ## Save raster in parental folder
41 |
42 | writeRaster(final_LULC, filename=a, bylayer=TRUE)
43 |
44 | ## Remove old file from subfolders
45 |
46 | file.remove(list.files(path=lista_850, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
47 |
48 | #################################### SSP2_45_2015_2100 ####################################
49 |
50 |
51 | ##### List of directories
52 |
53 | lista_SSP_2 <-list.dirs("./Results/SSP2_45_2015_2100/")
54 |
55 | ## Stack all files
56 |
57 | stack_2_SSP <- stack(list.files(path=lista_SSP_2, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
58 |
59 | #plot(stcak_2_SSP)
60 |
61 | # Aplly mask
62 |
63 | mascara_2_SSP <- mask(x = stack_2_SSP, mask = mascara)
64 |
65 | ## Crop by mask
66 |
67 | SSP_2 <- crop(x = mascara_2_SSP, y = extent(mascara))
68 |
69 | ## Get correct names
70 |
71 | b <- paste0(names(stack_2_SSP), ".tif")
72 |
73 | ## Save raster in parental folder
74 |
75 | writeRaster(SSP_2, filename=b, bylayer=TRUE)
76 |
77 | ## Remove old file from subfolders
78 |
79 | file.remove(list.files(path=lista_SSP_2, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
80 |
81 |
82 | #################################### SSP5_85_2015_2100 ####################################
83 |
84 |
85 | ##### List of directories
86 |
87 | lista_SSP_5 <-list.dirs("./Results/SSP5_85_2015_2100/")
88 |
89 | ## Stack all files
90 |
91 | stack_5_SSP <- stack(list.files(path=lista_SSP_5, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
92 |
93 | #plot(stack_5_SSP)
94 |
95 | # Aplly mask
96 |
97 | mascara_5_SSP <- mask(x = stack_5_SSP, mask = mascara)
98 |
99 | ## Crop by mask
100 |
101 | SSP_5 <- crop(x = mascara_5_SSP, y = extent(mascara))
102 |
103 | ## Get correct names
104 |
105 | c <- paste0(names(stack_5_SSP), ".tif")
106 |
107 | ## Save raster in parental folder
108 |
109 | writeRaster(SSP_5, filename=c, bylayer=TRUE)
110 |
111 | ## Remove old file from subfolders
112 |
113 | file.remove(list.files(path=lista_SSP_5, recursive=TRUE, full.names=TRUE, pattern='LULC_'))
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/R_scripts/7_SSPscompare.R:
--------------------------------------------------------------------------------
1 | #######################################
2 | ## SSPs comparison
3 | ## Author Tainá Rocha
4 | ## 4.02 R version
5 | #######################################
6 |
7 |
8 | # library
9 | library(ggplot2)
10 | ### 2020
11 |
12 | ssps_2020 <- read.csv("./data/Accuracy/ssps_ggplot_2020.csv")
13 |
14 | # create a dataset
15 | tiff(file="SSPs_2020",
16 | width=12, height=10, units="in", res=150)
17 | ggplot(ssps_2020, aes(fill=SSPs, y=ha, x=States)) +
18 | geom_bar(position="dodge", stat="identity")
19 |
20 | dev.off()
21 |
22 | ### 2100
23 |
24 | ssps_100 <- read.csv("./data/Accuracy/ssps_ggplot_2100.csv")
25 |
26 | tiff(file="SSPs_2100",
27 | width=12, height=10, units="in", res=150)
28 | ggplot(ssps_100, aes(fill=SSPs, y=ha, x=States)) +
29 | geom_bar(position="dodge", stat="identity")
30 |
31 | dev.off()
32 |
33 | ## SSP_45 2020 and 2100
34 |
35 | SSP_2_45 <- read.csv("./data/Accuracy/ssps2_45.csv")
36 |
37 | # create a dataset
38 | tiff(file="SSP_2_45",
39 | width=12, height=10, units="in", res=150)
40 | ggplot(SSP_2_45, aes(fill=Year, y=ha, x=States)) +
41 | geom_bar(position="dodge", stat="identity")
42 |
43 | dev.off()
44 |
45 | ## SSP_45 2020 and 2100
46 |
47 | SSP_5_85 <- read.csv("./data/Accuracy/ssps5_85.csv")
48 |
49 | # create a dataset
50 | tiff(file="SSP_5_85",
51 | width=12, height=10, units="in", res=150)
52 | ggplot(SSP_5_85, aes(fill=Year, y=ha, x=States)) +
53 | geom_bar(position="dodge", stat="identity")
54 |
55 | dev.off()
56 |
--------------------------------------------------------------------------------
/R_scripts/README.md:
--------------------------------------------------------------------------------
1 | ## Instruction to run scripts.
2 |
3 | - 1- Execute ``Functions.R script`` to create the functions which extracting layer from netCDF and then saving as TIFF format. This script also has a function that renames the variables.
4 | - 2- Execute ``2_get_vars_t_series.R`` script to apply the functions in the netCDF file.
5 | - 3- Execute scritps ``3.0_LULC_850_2015.R``, ``3.1_LULC_script_45.R`` and ``3.2_LULC_script_85.R`` to build LULC-files
6 | - 4- Execute the ``4_Accuracy_Mask_out_Greenland.R`` script to remove Greeland from reference map GLC-SHARE and LUH2
7 | - 5- Execute the ``5_reclass.R script`` to reclassify reference map GLC-SHARE and LUH2
8 | - 6- Execute the ``6_Remove_Greeland.R`` script to remove Greeland for all layers
9 | - 7- Execute the ``7_SSPscompare.R`` script to build plots of scenarios comparison. [Input here](https://github.com/Tai-Rocha/LUH2_Data/raw/master/data/ssp_data_results/Fig4_data%26graficcs.xlsx)
10 |
--------------------------------------------------------------------------------
/Results/GLOBAL LAND-USE AND LAND-COVER DATA: HISTORICAL, CURRENT AND FUTURE SCENARIOS.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/Results/GLOBAL LAND-USE AND LAND-COVER DATA: HISTORICAL, CURRENT AND FUTURE SCENARIOS.pdf
--------------------------------------------------------------------------------
/Results/README.md:
--------------------------------------------------------------------------------
1 | ### Directories of results layers
2 | Most data (rasters or netcdf files) are too large to put here. Besides, GitHub is proper to store and version control codes, and not to store large data files. However for reproducibility purposes, I created here the same directories structure used in the project.
--------------------------------------------------------------------------------
/Results/supplemental material/Accuracies.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/Results/supplemental material/Accuracies.xlsx
--------------------------------------------------------------------------------
/Results/supplemental material/Supplementary Material .pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/Results/supplemental material/Supplementary Material .pdf
--------------------------------------------------------------------------------
/data/RAW/README.md:
--------------------------------------------------------------------------------
1 |
2 | **RAW** directory contains two subdirectories :
3 |
4 | FAO: contains [GLS-SHARE](https://data.apps.fao.org/map/catalog/srv/eng/catalog.search#/metadata/ba4526fd-cdbf-4028-a1bd-5a559c4bff38) RAW file in zip file
5 |
6 | LUH2_netcdf : contains raw netcdf files from [Land Use Harmonization Project](https://luh.umd.edu/data.shtml)
7 |
--------------------------------------------------------------------------------
/data/README.md:
--------------------------------------------------------------------------------
1 | Most data (rasters or NetCDF files) are too large to put here. Besides, GitHub is proper to store and version control codes, and not to store large data files. However, for reproducibility purposes, I created here the same directories structure used in the project. Each directory contains a README with instructions about which files you should put in the folder. Also, I put the links to obtained data.
2 |
3 |
--------------------------------------------------------------------------------
/data/data_for_validation/README.md:
--------------------------------------------------------------------------------
1 |
2 | *data_for_validation* contains 4 layers:
3 | 1- ``glc_shv10_DOM.Tif`` (Land-use Land-cover of GLC-SHARE| Input of reclassification)
4 | 2- ``LULC_year_2000_CMPI_accucary_input.tif`` (Land-use Land cover of LUH2| Input of reclassification)
5 | 3- ``FAO_reclassified.tif`` (Output of reclassification)
6 | 4- ``LULC_2000_CMIP6_reclass.tif`` (Output of reclassification)
7 |
8 |
9 |
--------------------------------------------------------------------------------
/data/ssp_data_results/Fig4_data&graficcs.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/data/ssp_data_results/Fig4_data&graficcs.xlsx
--------------------------------------------------------------------------------
/data/ssp_data_results/README.md:
--------------------------------------------------------------------------------
1 | This directory contains an xlsx file with LULC data for 2020 and 2100 and SPPs (SSP2-4.5 and SSP5-8.5). The values for each class are presented Kilometers
2 |
--------------------------------------------------------------------------------
/doc/Figures/2020_2010_loe_resolution.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/2020_2010_loe_resolution.png
--------------------------------------------------------------------------------
/doc/Figures/Fig.2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/Fig.2.png
--------------------------------------------------------------------------------
/doc/Figures/Fig4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/Fig4.jpg
--------------------------------------------------------------------------------
/doc/Figures/Fig_3.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/Fig_3.tif
--------------------------------------------------------------------------------
/doc/Figures/Figure_1.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/Figure_1.tif
--------------------------------------------------------------------------------
/doc/Figures/LUH2 _LULC@2x (1).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/LUH2 _LULC@2x (1).png
--------------------------------------------------------------------------------
/doc/Figures/LUH2_logo300.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/LUH2_logo300.jpg
--------------------------------------------------------------------------------
/doc/Figures/primf_final.tif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/primf_final.tif
--------------------------------------------------------------------------------
/doc/Figures/tex_sspl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Tai-Rocha/LUH2_Data/c192766608f795e9a3a2f1b4201181b52a23d9f5/doc/Figures/tex_sspl.png
--------------------------------------------------------------------------------