-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun_post_heritage.r
67 lines (40 loc) · 1.08 KB
/
run_post_heritage.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
62
63
64
#!/usr/bin/Rscript
# Fire History Pre-processing
## NSW Test
library(tidyverse)
library(sf)
library(raster)
library(foreach)
library(doParallel)
library(mapview)
library(fasterize)
library(velox)
library(lwgeom)
library(sfheaders)
source("../config/global_config.r")
args = commandArgs(trailingOnly=TRUE)
if (length(args)==0) {
source("../config/config_post.r")
}else{
source(args[1])
}
if("future.apply" %in% rownames(installed.packages()) | OS=="Windows"){
library(future.apply)
}
c_sfaz = ""
# Determine resolution etc. from existing raster
template_r <- raster(paste0(fire_folder,"/rLastYearBurnt.tif"))
ras_res <- res(template_r)[1]
proj_crs <- proj4string(template_r)
source("fire_cell_function.r")
# Load template raster to determine resolution
# Prepare empty environment
prepare()
current_year = as.numeric(current_year)
ras_res = as.numeric(ras_res)
## Run file
log_it(paste0("Env Var:",Sys.getenv("TMPDIR")))
log_it(paste0("Temp Dir: ",tempdir()))
log_it("**** Preparing fire history rasters")
source("heritage_postprocess.r")
log_it("#!#!#!# ANALYSIS COMPLETE")