diff options
author | Ranke Johannes <johannes.ranke@agroscope.admin.ch> | 2024-01-31 17:59:04 +0100 |
---|---|---|
committer | Ranke Johannes <johannes.ranke@agroscope.admin.ch> | 2024-01-31 17:59:04 +0100 |
commit | 7bf5aad5e3b89c157d1b31a586ee87a25386117d (patch) | |
tree | f3f0b00d26482349bc8466f8054a9bf33121f01e /inst/data_generation | |
parent | f58caa911add00f02c8be879018f370299ff02bf (diff) |
Drift curve parameters from FOCUS SW Appendix B
Diffstat (limited to 'inst/data_generation')
-rw-r--r-- | inst/data_generation/drift_parameters_Rautmann.R | 5 | ||||
-rw-r--r-- | inst/data_generation/drift_parameters_focus.R | 29 |
2 files changed, 29 insertions, 5 deletions
diff --git a/inst/data_generation/drift_parameters_Rautmann.R b/inst/data_generation/drift_parameters_Rautmann.R deleted file mode 100644 index 2dea272..0000000 --- a/inst/data_generation/drift_parameters_Rautmann.R +++ /dev/null @@ -1,5 +0,0 @@ -library(here) - -save(drift_parameters_Rautmann, - file = "../data/drift_parameters_Rautmann.RData") - diff --git a/inst/data_generation/drift_parameters_focus.R b/inst/data_generation/drift_parameters_focus.R new file mode 100644 index 0000000..d685cdf --- /dev/null +++ b/inst/data_generation/drift_parameters_focus.R @@ -0,0 +1,29 @@ +library(here) +library(docxtractr) +library(dplyr) + +# The file FOCUS_SWS_APPENDIX_B.doc was downloaded +# from https://esdac.jrc.ec.europa.eu/projects/surface-water +# using URL https://esdac.jrc.ec.europa.eu/public_path/projects_data/focus/sw/docs/FOCUS_SWS_APPENDIX_B.doc +# It was then opened in Microsoft Word (Microsoft Office LTSC Professional Plus 2021) +# and saved as a .docx file in inst/extdata +docx <- read_docx(here("inst/extdata/FOCUS_SWS_APPENDIX_B.docx")) + +table_1 <- docx_extract_tbl(docx, 1) +table_2 <- docx_extract_tbl(docx, 2) + +combined <- rbind(table_1[-1, ], table_2[-1, ]) +names(combined) <- c("crop_group", "n_apps", "percentile", "A", "B", "C", "D", "hinge") +combined$crop_group = c( + rep( + c("arable", "hops", "vines, late", "vines, early", "fruit, late", "fruit, early"), + each = 8), + "aerial") + +drift_parameters_focus <- combined |> + mutate(across(2:3, as.integer)) |> + mutate(across(4:8, as.numeric)) + +save(drift_parameters_focus, + file = here("data/drift_parameters_focus.RData")) + |