-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path09-Reporting.Rmd
96 lines (65 loc) · 2.77 KB
/
09-Reporting.Rmd
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
# Reporting results
The GSNmap consists of a set of mandatory and optional maps that are to be generated as raster files (GeoTiff) at a resolution of 250 x 250 m and at the mandatory depth of 0-30 cm.
The Mandatory data products are:
* total N
* available P
* available K
* CEC
* soil pH
* clay, silt, and sand
* soil organic carbon concentration
* bulk density
Additionally, maps at deeper depths 30-60 cm and/or about micronutrients such as Ca, S, Mg, Fe, B, Cl, Mn, Zn, Cu, Mo, and Ni can be provided. All layers need to be submitted with the corresponding standard deviation layers.
An Rmarkdown script (with the extension .Rmd) is provided in the folder National Report. Script 5 can be used to translate the rmarkdown file into an automated report as a Word docx file.
```{r rmd, eval=FALSE}
#_______________________________________________________________________________
#
# QA/QC
# Soil Property Mapping
#
# GSP-Secretariat
# Contact: [email protected]
#_______________________________________________________________________________
#Empty environment and cache
rm(list = ls())
gc()
# Content of this script =======================================================
# 0 - Setup and user-defined variables
# 1 - User-defined variables
# 2 - Render the .Rmd file to generate an automated report as a docx
#_______________________________________________________________________________
# 0 - Initial Setup ============================================================
#install.packages("rmarkdown")
#tinytex::install_tinytex()
# library(sf)
# library(ggplot2)
# library(tidyverse)
# library(terra)
library(knitr)
# library(tidyterra)
# library(patchwork)
# Working directory
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
setwd("..")
# 1 - User-defined variables ==================================================
# Specify three-digit ISO code for your country
ISO <- 'AOI'
# Specify the properties you mapped (the code assumes harmonized naming)
# using the output data frame from script 2
dxy <- read.csv("02-Outputs/harmonized_soil_data.csv")
target_properties <- names(dxy)[ !(names(dxy)%in% c("ProfID", "x" ,"y"))]
#target_properties<-c('ph_0_30')
# Map background file
bckg<-vect('01-Data/AOI.shp')
#Adjust figure width and height of the map plot
figw <- 12
figh <-8
# Specify where you want your word document to be saved
output_file = paste0("National Report/Report_GSNmap_",ISO,".docx")
# 2 - Render the .Rmd file to generate an automated report as a docx ===========
path = 'National Report/National GSNmap Report.Rmd'
output_format = 'word_document'
rmarkdown::render(path, output_format, output_file)
```
The output report document is to be submitted along with the layers using a submission form provided by the GSP Secretariat.