-
Notifications
You must be signed in to change notification settings - Fork 0
/
01_nlcd_to_raster.R
67 lines (43 loc) · 1.81 KB
/
01_nlcd_to_raster.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
65
66
67
library(glue)
library(magrittr)
sg <- function(...) system(glue(...))
yrs <- c("2001", "2006", "2011", "2016")
#### converting to rasters ####
# s3://mrlc/NLCD_Land_Cover_L48_20190424_full_zip.zip
long_name <- "NLCD_Land_Cover_L48_20190424_full_zip"
short_name <- "nlcd"
sg("aws s3 cp s3://mrlc/{long_name}.zip {short_name}.zip")
sg("unzip {short_name}.zip")
sg("rm {short_name}.zip")
glue("gdal_translate -of GTiff NLCD_{yrs}_Impervious_L48_20190424.img nlcd_{yrs}.tif") %>%
walk(system)
sg("rm *.xml *.rrd *.rde *.img *.ige")
sg("rm -r NLCD2016_spatial_metadata")
# s3://mrlc/NLCD_Impervious_L48_20190405_full_zip.zip
long_name <- "NLCD_Impervious_L48_20190405_full_zip"
short_name <- "impervious"
sg("aws s3 cp s3://mrlc/{long_name}.zip {short_name}.zip")
sg("unzip {short_name}.zip")
sg("rm {short_name}.zip")
glue("gdal_translate -of GTiff NLCD_{yrs}_Impervious_L48_20190405.img impervious_{yrs}.tif") %>%
walk(system)
glue("gdal_translate -of GTiff NLCD_{yrs}_Impervious_descriptor_L48_20190405.img imperviousdescriptor_{yrs}.tif") %>%
walk(system)
sg("rm *.xml *.rrd *.rde *.img *.ige")
sg("rm -r NLCD2016_spatial_metadata")
# s3://mrlc/nlcd_2016_treecanopy_2019_08_31.zip
long_name <- "nlcd_2016_treecanopy_2019_08_31"
short_name <- "treecanopy_2016"
sg("aws s3 cp s3://mrlc/{long_name}.zip {short_name}.zip")
sg("unzip {short_name}.zip")
sg("rm {short_name}.zip")
sg("gdal_translate -of GTiff {long_name}.img {short_name}.tif")
sg("rm *.xml nlcd_*.html *.img *.ige")
# s3://mrlc/nlcd_2011_treecanopy_2019_08_31.zip
long_name <- "nlcd_2011_treecanopy_2019_08_31"
short_name <- "treecanopy_2011"
sg("aws s3 cp s3://mrlc/{long_name}.zip {short_name}.zip")
sg("unzip {short_name}.zip")
sg("rm {short_name}.zip")
sg("gdal_translate -of GTiff {long_name}.img {short_name}.tif")
sg("rm *.xml nlcd_*.html *.img *.ige")