├── .Rbuildignore ├── .github ├── .gitignore └── workflows │ ├── check-standard.yaml │ ├── pkgdown.yaml │ ├── pr-commands.yaml │ └── test-coverage.yaml ├── .gitignore ├── DESCRIPTION ├── DEV ├── data │ ├── Wosten2001_Tabel.csv │ ├── aaltjes_gewas_schema.csv │ ├── binnenveld.csv │ ├── bodem.csv │ ├── bodemopties_helptabel.csv │ ├── brp_crops_2020.csv │ ├── column_description.csv │ ├── column_description_obic.rds │ ├── crumbleability.csv │ ├── ea_aaltjes.csv │ ├── maatregel_description_bkp.csv │ ├── maatregel_effect.csv │ ├── maatregel_effect_bkp.csv │ ├── maatregel_groep.csv │ ├── makkink.csv │ ├── nematodes.csv │ ├── nretention_groenendijk_gw.csv │ ├── nretention_groenendijk_ow.csv │ ├── parameters.csv │ ├── recom_measures_code.csv │ ├── season.obic.csv │ ├── season_obic.csv │ ├── tbl_ph_delta.csv │ ├── weather.csv │ └── weight_obic.csv ├── scripts │ ├── check_dust_scores_several_croprots.R │ ├── merge_nema_tables.R │ ├── ppr_binnenveld.R │ ├── ppr_bouwplan_tables.R │ ├── ppr_column_description.R │ ├── ppr_crops_crumbleability.R │ ├── ppr_crops_obic.R │ ├── ppr_maatregel.R │ ├── ppr_makkink.R │ ├── ppr_management.R │ ├── ppr_nema_obic.R │ ├── ppr_nretention.R │ ├── ppr_ph_delta.R │ ├── ppr_recommendations_bkp.R │ ├── ppr_season_obic.R │ ├── ppr_soils.R │ ├── ppr_waterretention_wosten2001.R │ ├── ppr_waterstress.R │ ├── ppr_weather.R │ └── ppr_weights.R └── tests │ ├── input.json │ ├── obi2.json │ ├── testing_obic1.R │ ├── testing_obic2.R │ └── workability_testcases.R ├── LICENSE ├── NAMESPACE ├── NEWS.md ├── Open-Bodem-Index-Calculator.Rproj ├── R ├── bodemconditiescore.R ├── bulk_density.R ├── cec.R ├── compaction.R ├── crop_classification.R ├── crop_rotation.R ├── crumbleability.R ├── evaluate.R ├── grass_age.R ├── groundwater_recharge.R ├── magnesium.R ├── makkink.R ├── management.R ├── management_defaults.R ├── metals.R ├── nematode.R ├── nitrogen.R ├── nitrogen_efficiency.R ├── nretention.r ├── obic.R ├── obic_format_inputs.R ├── obic_recommendations.R ├── organic_carbon.R ├── pesticides.R ├── ph.R ├── phosphate_availability.R ├── pmn.R ├── potassium.R ├── precipitation_surplus.R ├── resistance.R ├── root_depth.R ├── sealing.R ├── sombalance.R ├── sulfur.R ├── tables.R ├── wateravailability.R ├── waterretention.R ├── winderodibility.R └── workability.R ├── README.md ├── codecov.yml ├── data-raw └── crops_obic │ └── crops_obic.csv ├── data ├── binnenveld.rda ├── bouwsteen_tb.rda ├── column_description.obic.rda ├── crops.makkink.rda ├── crops.obic.rda ├── eval.crumbleability.rda ├── management.obic.rda ├── nema.crop.rot.obic.rda ├── nema.obic.rda ├── nleach_table.rda ├── recom.obic.rda ├── recom.obic_bkp.rda ├── season.obic.rda ├── soils.obic.rda ├── tbl.ph.delta.rda ├── waterstress.obic.rda ├── weather.obic.rda └── weight.obic.rda ├── inst └── CITATION ├── man ├── add_management.Rd ├── binnenveld.Rd ├── bouwsteen_tb.Rd ├── calc_aggregatestability.Rd ├── calc_bcs.Rd ├── calc_bulk_density.Rd ├── calc_cec.Rd ├── calc_copper_availability.Rd ├── calc_cropclass.Rd ├── calc_crumbleability.Rd ├── calc_grass_age.Rd ├── calc_magnesium_availability.Rd ├── calc_makkink.Rd ├── calc_man_ess.Rd ├── calc_management.Rd ├── calc_n_efficiency.Rd ├── calc_nleach.Rd ├── calc_nlv.Rd ├── calc_organic_carbon.Rd ├── calc_permeability.Rd ├── calc_pesticide_leaching.Rd ├── calc_ph_delta.Rd ├── calc_phosphate_availability.Rd ├── calc_pmn.Rd ├── calc_potassium_availability.Rd ├── calc_psp.Rd ├── calc_root_depth.Rd ├── calc_rotation_fraction.Rd ├── calc_sbal_arable.Rd ├── calc_sealing_risk.Rd ├── calc_slv.Rd ├── calc_sombalance.Rd ├── calc_waterretention.Rd ├── calc_waterstressindex.Rd ├── calc_winderodibility.Rd ├── calc_workability.Rd ├── calc_zinc_availability.Rd ├── cf_ind_importance.Rd ├── column_description.obic.Rd ├── crops.makkink.Rd ├── crops.obic.Rd ├── eval.crumbleability.Rd ├── evaluate_logistic.Rd ├── evaluate_parabolic.Rd ├── format_aer.Rd ├── format_gwt.Rd ├── format_soilcompaction.Rd ├── ind_aggregatestability.Rd ├── ind_bcs.Rd ├── ind_cec.Rd ├── ind_compaction.Rd ├── ind_copper.Rd ├── ind_crumbleability.Rd ├── ind_gw_recharge.Rd ├── ind_magnesium.Rd ├── ind_man_ess.Rd ├── ind_management.Rd ├── ind_n_efficiency.Rd ├── ind_nematodes.Rd ├── ind_nematodes_list.Rd ├── ind_nitrogen.Rd ├── ind_nretention.Rd ├── ind_permeability.Rd ├── ind_pesticide_leaching.Rd ├── ind_ph.Rd ├── ind_phosphate_availability.Rd ├── ind_pmn.Rd ├── ind_potassium.Rd ├── ind_psp.Rd ├── ind_resistance.Rd ├── ind_sealing.Rd ├── ind_sulfur.Rd ├── ind_sulpher.Rd ├── ind_waterretention.Rd ├── ind_waterstressindex.Rd ├── ind_winderodibility.Rd ├── ind_workability.Rd ├── ind_zinc.Rd ├── management.obic.Rd ├── nema.crop.rot.obic.Rd ├── nema.obic.Rd ├── nleach_table.Rd ├── obic_evalmeasure.Rd ├── obic_farm.Rd ├── obic_field.Rd ├── obic_field_dt.Rd ├── obic_recommendations.Rd ├── obic_recommendations_bkp.Rd ├── pF_curve.Rd ├── pFpara_class.Rd ├── pFpara_ptf_Wosten1999.Rd ├── pFpara_ptf_Wosten2001.Rd ├── recom.obic.Rd ├── recom.obic_bkp.Rd ├── season.obic.Rd ├── soils.obic.Rd ├── tbl.ph.delta.Rd ├── waterstress.obic.Rd ├── weather.obic.Rd └── weight.obic.Rd ├── tests ├── testthat.R └── testthat │ ├── test-bodemconditiescore.R │ ├── test-bulk_density.R │ ├── test-cec.R │ ├── test-compaction.R │ ├── test-crop_classification.R │ ├── test-crop_rotation.R │ ├── test-crumbleability.R │ ├── test-format_gwt.R │ ├── test-format_soilcompaction.R │ ├── test-grass_age.R │ ├── test-groundwater_recharge.R │ ├── test-magnesium.R │ ├── test-management.R │ ├── test-metals.R │ ├── test-nematode.R │ ├── test-nitrogen.R │ ├── test-nitrogen_efficiency.R │ ├── test-nretention.R │ ├── test-obic_farm.R │ ├── test-obic_field.R │ ├── test-obic_field_dt.R │ ├── test-organic_carbon.R │ ├── test-permeability.R │ ├── test-pesticide_leaching.R │ ├── test-ph.R │ ├── test-phosphate-availability.R │ ├── test-pmn.R │ ├── test-potassium.R │ ├── test-precipitation_surplus.R │ ├── test-precipitation_surpluss.R │ ├── test-recommendations.R │ ├── test-resistance.R │ ├── test-root_depth.R │ ├── test-sealing.R │ ├── test-sombalance.R │ ├── test-sulfur.R │ ├── test-waterretention.R │ ├── test-waterstress.R │ ├── test-winderodibility.R │ └── test-workability.R └── vignettes ├── .gitignore ├── Formula_K-unsaturated.png ├── OBIC_score_integratie_2.png ├── description-of-the-columns.Rmd ├── obic_introduction.Rmd ├── obic_score_aggregation.Rmd ├── obic_water_functions.Rmd ├── obic_workability.Rmd ├── packages.bib ├── vignettes_references.bib ├── water_funs_references.bib └── workability_references.bib /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^doc$ 4 | ^docs$ 5 | ^Meta$ 6 | ^dev$ 7 | ^DEV$ 8 | ^data-raw$ 9 | ^\.github$ 10 | ^codecov\.yml$ 11 | ^LICENSE 12 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/workflows/check-standard.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master, development] 6 | pull_request: 7 | branches: [main, master, development] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - uses: actions/checkout@v3 33 | 34 | - uses: r-lib/actions/setup-pandoc@v2 35 | 36 | - uses: r-lib/actions/setup-r@v2 37 | with: 38 | r-version: ${{ matrix.config.r }} 39 | http-user-agent: ${{ matrix.config.http-user-agent }} 40 | use-public-rspm: true 41 | 42 | - uses: r-lib/actions/setup-r-dependencies@v2 43 | with: 44 | extra-packages: any::rcmdcheck 45 | needs: check 46 | 47 | - uses: r-lib/actions/check-r-package@v2 48 | with: 49 | upload-snapshots: true 50 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | release: 9 | types: [published] 10 | workflow_dispatch: 11 | 12 | name: pkgdown 13 | 14 | jobs: 15 | pkgdown: 16 | runs-on: ubuntu-latest 17 | # Only restrict concurrency for non-PR jobs 18 | concurrency: 19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 20 | env: 21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 22 | steps: 23 | - uses: actions/checkout@v3 24 | 25 | - uses: r-lib/actions/setup-pandoc@v2 26 | 27 | - uses: r-lib/actions/setup-r@v2 28 | with: 29 | use-public-rspm: true 30 | 31 | - uses: r-lib/actions/setup-r-dependencies@v2 32 | with: 33 | extra-packages: any::pkgdown, local::. 34 | needs: website 35 | 36 | - name: Build site 37 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 38 | shell: Rscript {0} 39 | 40 | - name: Deploy to GitHub pages 🚀 41 | if: github.event_name != 'pull_request' 42 | uses: JamesIves/github-pages-deploy-action@v4.4.1 43 | with: 44 | clean: false 45 | branch: gh-pages 46 | folder: docs 47 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: test-coverage 10 | 11 | jobs: 12 | test-coverage: 13 | runs-on: ubuntu-latest 14 | env: 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | 20 | - uses: r-lib/actions/setup-r@v2 21 | with: 22 | use-public-rspm: true 23 | 24 | - uses: r-lib/actions/setup-r-dependencies@v2 25 | with: 26 | extra-packages: any::covr 27 | needs: coverage 28 | 29 | - name: Test coverage 30 | run: | 31 | covr::codecov( 32 | quiet = FALSE, 33 | clean = FALSE, 34 | install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") 35 | ) 36 | shell: Rscript {0} 37 | 38 | - name: Show testthat output 39 | if: always() 40 | run: | 41 | ## -------------------------------------------------------------------- 42 | find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true 43 | shell: bash 44 | 45 | - name: Upload test results 46 | if: failure() 47 | uses: actions/upload-artifact@v3 48 | with: 49 | name: coverage-test-failures 50 | path: ${{ runner.temp }}/package 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | .Renviron 6 | .Rproj 7 | inst/doc 8 | doc 9 | Meta 10 | dev/*.tif 11 | dev/*.gpkg 12 | dev/*brp19.Rdata 13 | dev/brp*.rds 14 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: OBIC 2 | Type: Package 3 | Title: Calculate the Open Bodem Index (OBI) Score 4 | Version: 3.0.4 5 | Authors@R: c( 6 | person(given = "Sven", 7 | family = "Verweij", 8 | email = "sven.verweij@nmi-agro.nl", 9 | role = c("aut","cre"), 10 | comment = c(ORCID = '0000-0002-5573-3952')), 11 | person(given = "Gerard", 12 | family = "Ros", 13 | email = "gerard.ros@nmi-agro.nl", 14 | role = "aut", 15 | comment = c(ORCID = '0000-0002-6062-9770')), 16 | person(given = "Yuki", 17 | family = "Fujita", 18 | email = "yuki.fujita@nmi-agro.nl", 19 | role = "aut", 20 | comment = c(ORCID = '0000-0002-0541-2798')), 21 | person(given = c("Wilbrand", "Hendrik"), 22 | family = "Riechelman", 23 | email = 'brent.riechelman@nmi-agro.nl', 24 | role = "aut", 25 | comment = c(ORCID = '0000-0003-1501-1573')), 26 | person(given = "Kees", 27 | family = "van den Dool", 28 | email = 'kees.vandendool@nmi-agro.nl', 29 | role = "aut", 30 | comment = c(ORCID = '0009-0003-8963-2556')), 31 | person(given = "Job", 32 | family = "de Pater", 33 | email = "job.depater@nmi-agro.nl", 34 | role = "ctb"), 35 | person(given = "Nutriënten Managment Instituut", 36 | email = "nmi@nmi-agro.nl", 37 | role = "cph")) 38 | Description: The Open Bodem Index (OBI) is a method to evaluate the quality of soils of agricultural fields in The Netherlands and the sustainability of the current agricultural practices. 39 | The OBI score is based on four main criteria: chemical, physical, biological and management, which consist of more than 21 indicators. 40 | By providing results of a soil analysis and management info the 'OBIC' package can be use to calculate he scores, indicators and derivatives that are used by the OBI. 41 | More information about the Open Bodem Index can be found at . 42 | Depends: 43 | R (>= 3.5.0) 44 | Imports: 45 | checkmate, 46 | data.table 47 | License: 48 | GPL-3 49 | URL: https://github.com/AgroCares/Open-Bodem-Index-Calculator 50 | BugReports: https://github.com/AgroCares/Open-Bodem-Index-Calculator/issues 51 | Encoding: UTF-8 52 | LazyData: true 53 | RoxygenNote: 7.3.2 54 | Suggests: 55 | testthat (>= 2.1.0), 56 | knitr, 57 | rmarkdown, 58 | ggplot2, 59 | patchwork, 60 | covr, 61 | roxygen2 62 | VignetteBuilder: knitr 63 | -------------------------------------------------------------------------------- /DEV/data/bodem.csv: -------------------------------------------------------------------------------- 1 | soiltype;soiltype.ph;soiltype.n 2 | duinzand;1;zand 3 | dekzand;1;zand 4 | zeeklei;2;klei 5 | rivierklei;2;klei 6 | maasklei;2;klei 7 | dalgrond;1;zand 8 | moerige_klei;2;veen 9 | veen;1;veen 10 | loess;2;zand 11 | -------------------------------------------------------------------------------- /DEV/data/column_description_obic.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/DEV/data/column_description_obic.rds -------------------------------------------------------------------------------- /DEV/data/crumbleability.csv: -------------------------------------------------------------------------------- 1 | group_desc;crop_group;lower;upper 2 | graslandvernieuwing, graszaad;1;3;8 3 | granen,mais,natuur;2;0;8 4 | (poot)aardappelen;3;6;9 5 | Fabrieksaardappelen, witlof, selderij, uien, prei,spruiten, koolsoorten;4;5;8 6 | cons.aardappelen, peen, schorseneren, teelten onder glas;5;6;8 7 | suikerbieten;6;4;8 8 | erwten,bonen, koolsoorten;7;2;7.5 9 | asperge;8;8;8.5 10 | bladgewassen;9;8;9 11 | dahlias, hyacinten;10;8;9 12 | bloembollen (najaarsplanting);11;6.5;8 13 | groot en klein fruit;12;4;8 14 | bos- en haagplantsoen;13;5;6.5 15 | sierteelten;14;8;8.5 16 | laanbomen en onderstammen;15;4;6 17 | overig;16;0;8 18 | -------------------------------------------------------------------------------- /DEV/data/ea_aaltjes.csv: -------------------------------------------------------------------------------- 1 | "";"x" 2 | "1";"A_DSN_PA_NAN" 3 | "2";"A_DSN_PA_PAC" 4 | "3";"A_DSN_PA_TER" 5 | "4";"A_DSN_RO_UNI" 6 | "5";"A_DSN_TR_PRI" 7 | "6";"A_DSN_TR_SIM" 8 | "7";"A_DSN_TR_VIR" 9 | "8";"A_OPN_CYA_CYS" 10 | "9";"A_OPN_CYA_LLE" 11 | "10";"A_OPN_CYO_LLE" 12 | "11";"A_OPN_HA_CYS" 13 | "12";"A_OPN_HA_LLE" 14 | "13";"A_OPN_HBE_CYS" 15 | "14";"A_OPN_HBE_LLE" 16 | "15";"A_OPN_HBI_CYS" 17 | "16";"A_OPN_HBI_LLE" 18 | "17";"A_OPN_HCA_CYS" 19 | "18";"A_OPN_HCA_LLE" 20 | "19";"A_OPN_HCR_CYS" 21 | "20";"A_OPN_HCR_LLE" 22 | "21";"A_OPN_HG_CYS" 23 | "22";"A_OPN_HG_LLE" 24 | "23";"A_OPN_HM_CYS" 25 | "24";"A_OPN_HM_LLE" 26 | "25";"A_OPN_HS_CYS" 27 | "26";"A_OPN_HS_LLE" 28 | "27";"A_OPN_HT_CYS" 29 | "28";"A_OPN_HT_LLE" 30 | "29";"A_OPN_PA_BUK" 31 | "30";"A_OPN_PP_CYS" 32 | "31";"A_OPN_PP_LLE" 33 | "32";"A_RKN_ME_CHI" 34 | "33";"A_RKN_ME_FAL" 35 | "34";"A_RKN_ME_HAP" 36 | "35";"A_RKN_ME_MIN" 37 | "36";"A_RKN_ME_NAA" 38 | "37";"A_RLN_PR_CREN" 39 | "38";"A_RLN_PR_NEG" 40 | "39";"A_RLN_PR_PEN" 41 | "40";"A_RLN_PR_THO" 42 | "41";"A_RLN_PR_VUL" 43 | "42";"A_SN_DI_DES" 44 | "43";"A_SN_DI_DIP" 45 | "44";"A_DSN_RO_TOT" 46 | "45";"A_OPN_PA_TOT" 47 | "46";"A_RKN_ME_TOT" 48 | "47";"A_RLN_PR_TOT" 49 | -------------------------------------------------------------------------------- /DEV/data/maatregel_description_bkp.csv: -------------------------------------------------------------------------------- 1 | m_description,new_description 2 | bodem bekalken tot advies-pH,Bekalk de bodem tot de geadviseerde pH is bereikt 3 | Compost aanvoeren,Voer (extra) compost aan 4 | niet-kerende grondbewerking,Pas niet-kerende grondbewerking toe 5 | afrikaantjes (tagetes) verbouwen,Verbouw tagetes (afrikaantjes) 6 | diepwortelende gewassen verbouwen,Verbouw (meer) diepwortelende gewassen 7 | groenbemester verbouwen,Verbouw (meer) groenbemesters 8 | leeftijd grasland verlengen,Verleng de leeftijd van grasland 9 | Bemesten conform bemestingsadvies,Bemest confrom het bemestingsadvies 10 | Gras/klaver verbouwen,Verbouw een gras/klaver mengsel 11 | Botanische samenstelling grasland verbreden,Verbeter de botanische samenstelling van grasland 12 | Herstel ondergrondsverdichting,Herstel de verdichte ondergrond 13 | Organische bemesting,Gebruik (meer) organische meststoffen 14 | Groencompost,Voer (extra) groencompost aan 15 | Biofumigatie,Pas biofumicatie toe (telen en inwerken Brassica juncea) 16 | Grasklaver,Gebruik grasklaver als groenbemester 17 | Groenbemestermengsel,Gerbuik een mengsel van groenbemesters 18 | "Combinatie - ASD, compst en haarmeel",Combineer anaerobe grondontsmetting met compost en haarmeel aanvoer 19 | NKG en groencompost,Pas niet kerende grondbewerk toe in combinatie met aanvoer van groencompst 20 | Groenbemster telen,Verbouw (meer) groenbemesters 21 | NKG en groenbemester,Pas niet kerende grondbewerk toe in combinatie met teelt van groenbemesters 22 | NGK en maaimeststof,Pas niet kerende grondbewerk toe in combinatie met aanvoer van maaimeststoffen 23 | -------------------------------------------------------------------------------- /DEV/data/maatregel_effect_bkp.csv: -------------------------------------------------------------------------------- 1 | maatregel_nr;omschrijving;Prio_M;Dremp_S;Order;m_soilfunction;OBICvariable;Ef_M;filter;melkveehouderij_alleen_gras;melkveehouderij_incl_mais_naast_gras;akkerbouw;groente;boomteelt;klei;veen;zand;loess 2 | 12;Organische bemesting;1;0.6;12;koolstofvastlegging;S_M;+;1;1;1;1;1;1;0;0;1;0 3 | 12;Organische bemesting;1;0.6;12;habitat en biodiversiteit;NA;+;0;1;1;1;1;1;0;0;1;0 4 | 13;Groencompost;1;0.6;13;waterkwaliteit;I_E_NSW;--;1;1;1;1;1;1;0;0;1;0 5 | 13;Groencompost;1;0.6;13;recyclen nutrienten;NA;-;0;1;1;1;1;1;1;0;1;0 6 | 13;Groencompost;1;0.56;13;koolstofvastlegging;S_M;+;1;1;1;1;1;1;1;0;1;0 7 | 14;Biofumigatie;1;0.6;14;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;0;0;1;0 8 | 14;Biofumigatie;1;0.6;14;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;0;0;1;0 9 | 15;Grasklaver;1;0.6;15;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;0;0;1;0 10 | 15;Grasklaver;1;0.6;15;habitat en biodiversiteit;;+;0;0;0;1;1;0;0;0;1;0 11 | 16;afrikaantjes (tagetes) verbouwen;1;0.6;16;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;0;0;1;0 12 | 16;afrikaantjes (tagetes) verbouwen;1;0.6;16;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;0;0;1;0 13 | 17;Groenbemestermengsel;1;0.6;17;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;0;0;1;0 14 | 17;Groenbemestermengsel;1;0.6;17;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;0;0;1;0 15 | 18;Combinatie - ASD, compst en haarmeel;1;0.6;18;habitat en biodiversiteit;NA;++;0;0;0;1;1;0;0;0;1;0 16 | 18;Combinatie - ASD, compst en haarmeel;1;0.6;18;waterkwaliteit;I_E_NSW;-;1;0;0;1;1;0;0;0;1;0 17 | 18;Combinatie - ASD, compst en haarmeel;1;0.6;18;recyclen nutrienten;NA;-;0;0;0;1;1;0;1;0;1;0 18 | 19;NKG en groencompost;1;0.6;19;habitat en biodiversiteit;;+;0;0;0;1;1;0;1;0;1;0 19 | 19;NKG en groencompost;1;0.6;19;waterregulatie;I_P_WRI;-;1;0;0;1;1;0;1;0;0;0 20 | 20;Groenbemster telen;1;0.6;20;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;1;0;0;0 21 | 20;Groenbemster telen;1;0.6;20;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;1;0;0;0 22 | 21;NKG en groenbemester;1;0.6;21;waterregulatie;I_P_WRI;+;1;0;0;1;1;0;1;0;0;0 23 | 21;NKG en groenbemester;1;0.6;21;waterkwaliteit;I_E_NSW;+;1;0;0;1;1;0;1;0;0;0 24 | 21;NKG en groenbemester;1;0.6;21;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;1;0;0;0 25 | 22;NGK en maaimeststof;1;0.6;22;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;1;0;0;0 26 | 22;NGK en maaimeststof;1;0.6;22;waterregulatie;I_P_WRI;+;1;0;0;1;1;0;1;0;0;0 27 | 23;Maaimeststoffen;1;0.6;23;habitat en biodiversiteit;NA;+;0;0;0;1;1;0;1;0;0;0 28 | -------------------------------------------------------------------------------- /DEV/data/maatregel_groep.csv: -------------------------------------------------------------------------------- 1 | measure;description;I_M_SOILFERTILITY;I_M_CLIMATE;I_M_WATERQUALITY;I_M_BIODIVERSITY 2 | M_COMPOST;Frequency of compost application;1;1;0;1 3 | M_DITCH;Ditch is cleaned and sludge is applied;0;0;1;0 4 | M_DRAIN;Drains available;0;1;1;0 5 | M_EARLYCROP;Use of early crops;1;1;1;1 6 | M_GREEN;Use of green manure;1;1;1;1 7 | M_LIME;Has field been limed in last three years;1;0;0;0 8 | M_MECHWEEDS;Use of mechanical weed protection;0;0;1;0 9 | M_NONBARE;Field 80% of the year green;0;1;1;0 10 | M_NONINVTILL;Non inversion tillage;1;1;0;1 11 | M_PESTICIDES_DST;Use of DST for pesticides;0;0;1;1 12 | M_SLEEPHOSE;Manure application using sleep hoses;1;0;0;0 13 | M_SOLIDMANURE;Use of solid manure;1;1;0;1 14 | M_SSPM;Soil Structure Protection Measures;1;0;1;1 15 | M_STRAWRESIDUE;Application of straw residues;1;1;0;1 16 | M_UNDERSEED;Underseed of grass at maize;0;1;1;0 17 | -------------------------------------------------------------------------------- /DEV/data/makkink.csv: -------------------------------------------------------------------------------- 1 | crop_makkink;1;2;3;4;5;6;7;8;9;10;11;12 2 | aardappels;;;;;0.65;1.1;1.13;1.1;0.47;;; 3 | bladrammenas;;;;;;;0.8;0.78;0.72;0.72;0.64; 4 | bloembollen;;;;;0.52;0.93;1.2;1.2;1.2;;; 5 | bloemkool;;;;;0.4;0.93;1.2;1.2;1.2;;; 6 | bol en knolgewassen;;;;;0.5;0.93;1.13;1.2;1.2;;; 7 | bos;0.4;0.4;0.52;1.15;1.16;1.2;1.18;1.15;1.2;0.85;0.52;0.4 8 | braak;0.36;0.36;0.36;0.36;0.36;0.36;0.36;0.36;0.36;0.36;0.36;0.36 9 | fruit;0.4;0.4;0.52;1;1.4;1.6;1.7;1.26;1.2;0.85;0.52;0.4 10 | graan;;;0.7;0.8;1;1.2;0.9;0.44;;;; 11 | grasklaver;0.8;0.9;0.95;1;1;1;1;0.97;0.9;0.8;0.9;0.95 12 | grasland;0.8;0.9;0.95;1.2;1.2;1.2;1.1;1.1;1.1;1;0.9;0.8 13 | groenten;;;;0.4;0.9;1.2;0.6;;;;; 14 | jong bos;0.37;0.37;0.37;1.09;1.09;1.1;1.1;1.06;1;0.63;0.37;0.37 15 | natuurlijk grasland;0.47;0.47;0.47;1.2;1.2;1.2;1.1;1.1;1.1;1;0.47;0.47 16 | overig;0.95;0.95;0.95;1;1;1;1;1;1;0.95;0.95;0.95 17 | peen;;;;0.39;0.39;0.52;0.98;1.07;1.05;;; 18 | prei;;;;;0.45;0.56;0.77;0.9;0.9;;; 19 | selderij;;;;;0.41;0.7;0.9;1.1;0.85;;; 20 | sla;;;;0.4;0.47;0.63;0.8;;;;; 21 | snijmais;;;;;0.67;1.03;1.27;1.2;1.2;;; 22 | spitskool;;;;;0.4;0.93;1.2;1.2;1.2;;; 23 | tuinbonen;;;;0.52;0.9;1.2;0.72;;;;; 24 | wintertarwe;0.6;0.6;0.6;0.8;1;1.2;0.9;0.5;;;; 25 | zaaiuien;;;;0.42;0.63;0.83;1;0.97;0.47;;; 26 | -------------------------------------------------------------------------------- /DEV/data/nematodes.csv: -------------------------------------------------------------------------------- 1 | species;element;geel;rood;standaard 2 | Pratylenchus spp.;A_RLN_PR_TOT;150;300; 3 | Pratylenchus crenatus;A_RLN_PR_CREN;200;500;TRUE 4 | Pratylenchus neglectus;A_RLN_PR_NEG;500;1000; 5 | Pratylenchus penetrans;A_RLN_PR_PEN;150;300; 6 | Pratylenchus pratensis;A_RLN_PR_PRA;500;1000; 7 | Pratylenchus thornei;A_RLN_PR_THO;500;1000; 8 | Pratylenchus flakkensis;A_RLN_PR_FLA;500;1000; 9 | Pratylenchus fallax;A_RLN_PR_FAL;500;1000; 10 | Pratylenchus pinguicaudatus;A_RLN_PR_PIN;500;1000; 11 | Pratylenchus pseudopratensis;A_RLN_PR_PSE;500;1000; 12 | Pratylenchus vulnus;A_RLN_PR_VUL;500;1000; 13 | Pratylenchus dunensis;A_RLN_PR_DUN;500;1000; 14 | Pratylenchus zeae;A_RLN_PR_ZEA;500;1000; 15 | Meloidogyne spp.;A_RKN_ME_TOT;50;200; 16 | Meloidogyne hapla;A_RKN_ME_HAP;100;300;TRUE 17 | Meloidogyne chitwoodi/fallax;A_RKN_ME_CHIFAL;50;200;TRUE 18 | Meloidogyne chitwoodi;A_RKN_ME_CHI;50;200; 19 | Meloidogyne naasi;A_RKN_ME_NAA;50;500;TRUE 20 | Meloidogyne fallax;A_RKN_ME_FAL;50;200; 21 | Meloidogyne minor;A_RKN_ME_MIN;50;200; 22 | Meloidogyne incognita;A_RKN_ME_INC;50;200; 23 | Meloidogyne javanica;A_RKN_ME_JAV;50;200; 24 | Meloidogyne artiellia;A_RKN_ME_ART;50;200; 25 | Meloidogyne arenaria;A_RKN_ME_ARE;50;200; 26 | Meloidogyne ardenensis;A_RKN_ME_ARD;50;200; 27 | (Para)Trichodoridae spp.;A_DSN_TR_TOT;5;5; 28 | Trichodorus similis;A_DSN_TR_SIM;5;5; 29 | Trichodorus primitivus;A_DSN_TR_PRI;5;5; 30 | Trichodorus viruliferus;A_DSN_TR_VIR;5;5; 31 | Trichodorus sparsus;A_DSN_TR_SPA;5;5; 32 | Trichodorus cylindricus;A_DSN_TR_CYL;5;5; 33 | Trichodorus hooperi;A_DSN_TR_HOO;5;5; 34 | Paratrichodorus teres;A_DSN_PA_TER;5;5; 35 | Paratrichodorus pachydermus;A_DSN_PA_PAC;5;5; 36 | Paratrichodorus anemones;A_DSN_PA_ANE;5;5; 37 | Paratrichodorus nanus;A_DSN_PA_NAN;5;5; 38 | Tylenchorhynchus spp.;A_DSN_TY_TOT;200;500; 39 | Rotylenchus spp.;A_DSN_RO_TOT;30;100; 40 | Xiphinema spp.;A_DSN_XI_TOT;1;10;TRUE 41 | Longidorus spp.;A_DSN_LOI_TOT;1;10;TRUE 42 | Hemicycliophora spp.;A_DSN_HEM_TOT;100;500; 43 | Helicotylenchus spp.;A_DSN_HEL_TOT;200;500; 44 | Ditylenchus spp.;A_SN_DI_TOT;1;5;TRUE 45 | Ditylenchus dipsaci;A_SN_DI_DIP;1;5; 46 | Ditylenchus destructor;A_SN_DI_DES;1;5; 47 | Paratylenchus spp.;A_OPN_PA_TOT;50;100; 48 | Paratylenchus bukowinensis;A_OPN_PA_BUK;50;100; 49 | Cysteaaltjes;A_OPN_CY_TOT;100;300;TRUE 50 | Aphelenchoides spp.;A_OPN_AP_TOT;5;10; 51 | Aphelenchoides fragariae;A_OPN_AP_FRA;5;10; 52 | Aphelenchoides ritzemabosi;A_OPN_AP_RIT;5;10; 53 | Aphelenchoides subtenuis;A_OPN_AP_SUB;5;10; 54 | Criconematidae spp.;A_OPN_CR_TOT;10;50; 55 | Subanguina spp.;A_OPN_SU_TOT;10;50; 56 | -------------------------------------------------------------------------------- /DEV/data/nretention_groenendijk_gw.csv: -------------------------------------------------------------------------------- 1 | Gewas,bodem,GT1,GT2,GT2b,GT3,GT3b,GT4,GT5,GT5b,GT6,GT7,GT7b 2 | ghg,all,10,20,32.5,20,32.5,60,20,32.5,60,80,140 3 | glg,all,50,65,65,100,100,100,120,120,120,140,180 4 | akkerbouw,Klei,,,,,,,,0.28,0.3,0.45,0.33 5 | akkerbouw,Veen,,,,0.19,0.19,0.18,0.08,,0.14,, 6 | akkerbouw,Zand,,,,,0.58,0.35,,0.49,0.49,0.58,0.57 7 | gras,Klei,,,,,0.08,,0.09,0.09,0.16,0.22, 8 | gras,Veen,,0.03,,0.03,0.09,0.12,,,,, 9 | gras,Zand,,0.2,,0.31,0.37,0.82,0.22,0.32,0.62,0.88,0.86 10 | mais,Klei,,,,,,,,0.05,0.17,0.41,0.37 11 | mais,Veen,,0.04,,0.14,0.11,0.17,,,0.18,, 12 | mais,Zand,,,,0.47,0.44,0.65,,0.43,0.92,1.17,1.14 13 | -------------------------------------------------------------------------------- /DEV/data/nretention_groenendijk_ow.csv: -------------------------------------------------------------------------------- 1 | Gewas,bodem,GT1,GT2,GT2b,GT3,GT3b,GT4,GT5,GT5b,GT6,GT7,GT7b 2 | ghg,all,10,20,32.5,20,32.5,60,20,32.5,60,80,140 3 | glg,all,50,65,65,100,100,100,120,120,120,140,180 4 | akkerbouw,Klei,NA,NA,NA,NA,NA,NA,NA,0.14,0.1,0.08,0.03 5 | akkerbouw,Veen,NA,0.04,NA,0.08,NA,NA,0.06,NA,0.05,NA,NA 6 | akkerbouw,Zand,NA,NA,NA,NA,0.24,0.09,NA,0.22,0.15,0.1,0.04 7 | gras,Klei,NA,NA,NA,0.04,0.03,NA,0.05,0.05,0.05,0.02,NA 8 | gras,Veen,0.01,0.01,NA,0.02,0.03,0.02,0.03,0.02,0.01,NA,NA 9 | gras,Zand,NA,0.07,NA,0.1,0.15,0.19,0.08,0.15,0.17,0.11,0.07 10 | mais,Klei,NA,NA,NA,NA,NA,NA,NA,0.03,0.05,0.05,0.04 11 | mais,Veen,NA,0.03,NA,0.07,NA,0.04,NA,NA,0.04,NA,NA 12 | mais,Zand,NA,NA,NA,0.24,0.2,0.26,NA,0.19,0.21,0.11,0.04 13 | -------------------------------------------------------------------------------- /DEV/data/recom_measures_code.csv: -------------------------------------------------------------------------------- 1 | m_nr;m_code;m_description 2 | 0;M0;geen advies nodig 3 | 100;M100;geen advies beschikbaar 4 | 1;M1;bodem bekalken tot advies-pH 5 | 2;M2;compost aanvoeren 6 | 3;M3;niet-kerende grondbewerking 7 | 4;M4;afrikaantjes (tagetes) verbouwen 8 | 5;M5;diepwortelende gewassen verbouwen 9 | 6;M6;groenbemester verbouwen 10 | 7;M7;leeftijd grasland verlengen 11 | 8;M8;bemesten conform bemestingsadvies 12 | 9;M9;gras/klaver verbouwen 13 | 10;M10;botanische samenstelling grasland verbreden 14 | 11;M11;herstel ondergrondsverdichting 15 | -------------------------------------------------------------------------------- /DEV/data/season_obic.csv: -------------------------------------------------------------------------------- 1 | "","landuse","req_days_pre_glg","req_days_post_glg","total_days","derving" 2 | "1","naaldbos",170,75,245,"boomteelt" 3 | "2","loofbos",170,75,245,"boomteelt" 4 | "3","groot fruit",170,75,245,"boomteelt" 5 | "4","klein fruit",170,75,245,"boomteelt" 6 | "5","aardappelen",155,35,190,"plant groenten" 7 | "6","pootaardappelen",150,0,150,"plant groenten" 8 | "7","fabrieksaardappelen",155,65,220,"plant groenten" 9 | "8","suikerbieten",155,75,230,"zaai groenten" 10 | "9","wintertarwe",165,10,175,"wintergranen" 11 | "10","zomergerst",165,0,170,"zomergranen" 12 | "11","snijmais",130,35,165,"zomergranen" 13 | "12","laanbomen_onderstammen",170,75,245,"boomteelt" 14 | "13","overige boomteelt",170,55,225,"boomteelt" 15 | "14","graszaad",170,15,185,"zomergranen" 16 | "15","asperge",170,75,245,"boomteelt" 17 | "16","schorseneren",170,75,245,"zaai groenten" 18 | "17","prei, spruiten, koolsoorten",100,125,225,"plant groenten" 19 | "18","erwten, bonen",135,-15,130,"zaai groenten" 20 | "19","witlof, selderij, uien",75,65,140,"plant groenten" 21 | "20","was bospeen",100,25,125,"zaai groenten" 22 | "21","tulpen, narcis, hyacint",180,140,320,"zaai groenten" 23 | "22","dahlia",100,140,320,"boomteelt" 24 | "23","bladgroenten",100,75,175,"plant groenten" 25 | "24","beweid bemaaid gras",180,75,255,"grasland" 26 | "25","plantsoenen",180,75,255,"overig" 27 | "26","gazons",100,75,210,"overig" 28 | "27","kampeerterreinen, ligweiden",100,45,145,"overig" 29 | "28","sportvelden",100,75,255,"overig" 30 | "29","overig",1,1,2,"overig" 31 | -------------------------------------------------------------------------------- /DEV/data/weather.csv: -------------------------------------------------------------------------------- 1 | month;A_TEMP_MEAN;A_PREC_MEAN;A_ET_MEAN 2 | 1;3.6;70.8;8.5 3 | 2;3.9;63.1;15.5 4 | 3;6.5;57.8;35.3 5 | 4;9.8;41.6;62.4 6 | 5;13.4;59.3;87.3 7 | 6;16.2;70.5;93.3 8 | 7;18.3;85.2;98.3 9 | 8;17.9;83.6;82.7 10 | 9;14.7;77.9;51.7 11 | 10;10.9;81.1;28 12 | 11;7;80;11.3 13 | 12;4.2;83.8;6.5 14 | -------------------------------------------------------------------------------- /DEV/scripts/check_dust_scores_several_croprots.R: -------------------------------------------------------------------------------- 1 | # Illustrate I_P_DU when there is one year with maize and the rest is permanent grassland 2 | 3 | library(data.table) 4 | library(OBIC) 5 | 6 | # load data 7 | odt <- binnenveld[ID == 4] # Field four has the lowest clay content of all binnenveld fields 8 | cr <- crops.obic[,.(crop_code, crop_category, crop_name)] 9 | 10 | # remove bodemconditiscore columns 11 | cols <- names(odt)[!grepl('BCS', names(odt))] 12 | odt <- odt[,..cols] 13 | 14 | # merge 15 | odt <- merge(odt, cr[,.(crop_code, crop_name)], by.x = 'B_LU_BRP', by.y = 'crop_code') 16 | 17 | # parcel with permanent grass 18 | grass.dt <- copy(odt) 19 | grass.dt <- grass.dt[,B_LU_BRP := 265] 20 | grass.dt <- grass.dt[,treatment := 'gras'] 21 | 22 | grass.s <- obic_field_dt(grass.dt) 23 | grass.s <- grass.s[,treatment := 'gras'] 24 | 25 | # parcel with maize 26 | mais.dt <- copy(odt) 27 | mais.dt <- mais.dt[,B_LU_BRP := 259] 28 | mais.dt <- mais.dt[,treatment := 'mais'] 29 | 30 | mais.s <- obic_field_dt(mais.dt) 31 | mais.s <- mais.s[,treatment := 'mais'] 32 | 33 | # parcel with one maize year 34 | mix.dt <- copy(odt) 35 | mix.dt <- mix.dt[,B_LU_BRP := 265] 36 | mix.dt <- mix.dt[1,B_LU_BRP := 259] 37 | mix.dt <- mix.dt[,treatment := 'onemais'] 38 | 39 | mix.s <- obic_field_dt(mix.dt) 40 | mix.s <- mix.s[,treatment := 'one_mais_year'] 41 | 42 | # combine 43 | dt <- rbindlist(list(grass.dt, mais.dt, mix.dt)) 44 | s.dt <- rbindlist(list(grass.s, mais.s, mix.s)) 45 | 46 | s.dt[,.(treatment, I_P_DU, S_T_OBI_A, S_P_OBI_A,S_C_OBI_A, I_C_K, I_C_MG, I_C_N)] 47 | 48 | pcols <- grep('I_P', names(s.dt)) 49 | s.dt[,..pcols] 50 | -------------------------------------------------------------------------------- /DEV/scripts/merge_nema_tables.R: -------------------------------------------------------------------------------- 1 | # Script to merge bouwplan table with crops.obic and nema.obic 2 | library(data.table) 3 | library(OBIC) 4 | 5 | # Load tables 6 | crops.obic <- OBIC::crops.obic 7 | nema.obic <- OBIC::nema.obic 8 | bp <- OBIC::nema.crop.rot.obic 9 | 10 | ## Merge bp and nema.obic 11 | bp <- bp[,name_scientific := gsub('_', ' ', name_scientific)] 12 | # check which species occur aaltjesschema and not in nema.obic 13 | bpnames <- unique(bp$name_scientific) 14 | miss.bpnames <- bpnames[!bpnames %in% nema.obic$species] 15 | miss.bpnames <- sort(miss.bpnames) 16 | 17 | # check which species occur in nema.obic but not in aaltjesschema 18 | nonames <- unique(nema.obic$species) 19 | miss.nonames <- nonames[!nonames %in% bp$name_scientific] 20 | miss.nonames <- sort(miss.nonames) 21 | miss.nonames 22 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_binnenveld.R: -------------------------------------------------------------------------------- 1 | 2 | # make example dataset Binnenveld for use in the package 3 | # the csv dataset is prepared in OBIC-helpers 4 | 5 | # require package 6 | require(data.table) 7 | 8 | # read in the csv file with soil properties 9 | binnenveld <- fread('dev/data/binnenveld.csv') 10 | 11 | # save file 12 | usethis::use_data(binnenveld, version = 3, overwrite = TRUE, compress = 'xz') 13 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_column_description.R: -------------------------------------------------------------------------------- 1 | # this R script makes a data.table with all inputs and outputs of the OBIC 2 | 3 | # require library 4 | library(data.table) 5 | 6 | # load description csv file 7 | column_description.obic <- fread("dev/data/column_description.csv") 8 | 9 | # a few adaptations to ensure correct format 10 | column_description.obic[column_description.obic == ''] <- NA 11 | column_description.obic <- na.omit(column_description.obic, cols = "column") 12 | 13 | # save as Rdata file for the package 14 | usethis::use_data(column_description.obic, version = 3, overwrite = TRUE, compress = 'xz') 15 | 16 | # save as temporary file in dev/data 17 | saveRDS(column_description.obic,file='dev/data/column_description_obic.rds') 18 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_crops_crumbleability.R: -------------------------------------------------------------------------------- 1 | # ppr_eval_crumbleability 2 | 3 | # read in csv file 4 | eval.crumbleability <- fread('dev/data/crumbleability.csv',sep=';') 5 | 6 | # save file 7 | usethis::use_data(eval.crumbleability, version = 3, overwrite = TRUE, compress = 'xz') 8 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_crops_obic.R: -------------------------------------------------------------------------------- 1 | # Script to modify crops.obic 2 | 3 | # load package 4 | library(data.table) 5 | 6 | # Load crops.obic (copied csv from pandex) 7 | crops.obic <- pandex::crops.obic 8 | 9 | # update the Rdata file 10 | usethis::use_data(crops.obic,version = 3, overwrite = TRUE, compress = 'xz') 11 | devtools::document() 12 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_makkink.R: -------------------------------------------------------------------------------- 1 | # make makkink table 2 | 3 | # load csv file with makkink per crop per month 4 | dt <- fread('dev/data/makkink.csv', header = TRUE) 5 | 6 | # colnames for the 12 months 7 | cols <- colnames(dt)[-1] 8 | 9 | # replace all missing values with the value 0.36 for braak soil 10 | dt[,c(cols) := lapply(.SD,function(x) fifelse(is.na(x),0.23,x)),.SDcols = cols] 11 | 12 | # write file to data 13 | crops.makkink <- copy(dt) 14 | usethis::use_data(crops.makkink,version = 3, overwrite = TRUE, compress = 'xz') 15 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_management.R: -------------------------------------------------------------------------------- 1 | # ppr maatregel groupings in relation to ecosystem services 2 | 3 | # require package 4 | require(data.table) 5 | 6 | # read in csv file 7 | d1 <- fread('dev/data/maatregel_groep.csv') 8 | 9 | # measure.group 10 | management.obic <- copy(d1) 11 | 12 | # save file as RData-object 13 | usethis::use_data(management.obic, version = 3, overwrite = TRUE, compress = 'xz') 14 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_ph_delta.R: -------------------------------------------------------------------------------- 1 | library(data.table) 2 | 3 | tbl.ph.delta <- fread("DEV/data/tbl_ph_delta.csv", na.strings = 'NA') 4 | tbl.ph.delta$table <- as.character(tbl.ph.delta$table) 5 | usethis::use_data(tbl.ph.delta, version = 3, overwrite = TRUE, compress = 'xz') 6 | -------------------------------------------------------------------------------- /DEV/scripts/ppr_season_obic.R: -------------------------------------------------------------------------------- 1 | # Script to make season.obic table 2 | 3 | # require package 4 | library(data.table) 5 | 6 | # Table is based on Tabel 2 in Huinink (2018) and links to crops.obic$crop_season 7 | # Not all landuses in the original table appear in brp and some of the brp crops have been assigned to "overig" and could be reclassified later. 8 | season.obic <- fread('dev/data/season_obic.csv') 9 | 10 | # remove column numbers 11 | season.obic <- season.obic[,.(landuse, req_days_pre_glg, req_days_post_glg, total_days, derving)] 12 | 13 | # add soiltype columns to be molten based on soils.obic$soiltype.m 14 | season.obic[, zand := 'zand'] 15 | season.obic[, klei := 'klei'] 16 | season.obic[, veen := 'veen'] 17 | season.obic[, loess := 'loess'] 18 | 19 | # melt soiltype 20 | season.obic <- melt(season.obic, measure.vars = c('zand', 'klei', 'veen', 'loess'), variable.name = 'soiltype.m') 21 | 22 | # remove value column (only column names were really needed in melting) 23 | season.obic <- season.obic[,.(landuse, req_days_pre_glg, req_days_post_glg, total_days, derving, soiltype.m)] 24 | 25 | # set req days post glg for mais on sand/loess to match 1 october and other soils to 20 october 26 | season.obic <- season.obic[landuse == 'snijmais',req_days_post_glg := 27 | fifelse(soiltype.m %in% c('zand', 'loess'), 274-227, 293-227)] # where numbers are doy resulting in number of days after glg (doy = 227) 28 | 29 | # set negative required days to 0 but preserve this data in csv 30 | season.obic <- season.obic[req_days_post_glg < 0,req_days_post_glg := 0] 31 | 32 | # ensure that total days equal to or larger than required days pre and/or post glg 33 | season.obic <- season.obic[total_days<(req_days_pre_glg+req_days_post_glg)| 34 | total_days dealt with in calc_crop_rotation 51 | dt.gws <- merge(dt.gws,dt.mak, by = c("crop_makkink", "month"), all.x = TRUE) 52 | 53 | # Add crop cover 54 | dt.gws[,crop_cover := fifelse(mcf>0.36,1,0)] 55 | 56 | # sort dt on the original order 57 | out <- setorder(dt.gws,year) 58 | 59 | # return value 60 | value <- out 61 | 62 | # return 63 | return(value) 64 | } 65 | 66 | -------------------------------------------------------------------------------- /R/organic_carbon.R: -------------------------------------------------------------------------------- 1 | #' Calculate amount of organic carbon 2 | #' 3 | #' This function calculates the amount of organic carbon in the soil 4 | #' 5 | #' @param A_SOM_LOI (numeric) The percentage organic matter in the soil 6 | #' @param D_BDS (numeric) The bulk density of the soil 7 | #' @param D_RD (numeric) The root depth of the crop 8 | #' 9 | #' @examples 10 | #' calc_organic_carbon(A_SOM_LOI = 4.3, D_BDS = 1100, D_RD = 0.2) 11 | #' calc_organic_carbon(A_SOM_LOI = c(1,4.3), D_BDS = c(1100,1300), D_RD = c(0.2,0.6)) 12 | #' 13 | #' @return 14 | #' The total amount of Carbon in the soil (kg C / ha). A numeric value. 15 | #' 16 | #' @export 17 | calc_organic_carbon <- function(A_SOM_LOI, D_BDS, D_RD) { 18 | 19 | # Check inputs 20 | arg.length <- max(length(A_SOM_LOI), length(D_BDS), length(D_RD)) 21 | checkmate::assert_numeric(A_SOM_LOI, lower = 0, upper = 100, any.missing = FALSE, len = arg.length) 22 | checkmate::assert_numeric(D_BDS, lower = 100, upper = 1900, any.missing = FALSE, len = arg.length) 23 | checkmate::assert_numeric(D_RD, lower = 0, upper = 2, any.missing = FALSE, len = arg.length) 24 | 25 | # Calculate the value 26 | ha <- 100 * 100 27 | A_OS_FR <- A_SOM_LOI / 100 28 | value <- 0.58 * A_OS_FR * ha * D_RD * D_BDS 29 | 30 | return(value) 31 | } 32 | -------------------------------------------------------------------------------- /R/resistance.R: -------------------------------------------------------------------------------- 1 | #' Calculate indicator for soil resistance 2 | #' 3 | #' This function calculates the indicator for the resistance of the soil against diseases and is indicated by the amount of soil life. 4 | #' 5 | #' @param A_SOM_LOI (numeric) The organic matter content of the soil in percentage 6 | #' 7 | #' @examples 8 | #' ind_resistance(A_SOM_LOI = 3.5) 9 | #' ind_resistance(A_SOM_LOI = c(3.5,5.5,15,25)) 10 | #' 11 | #' @return 12 | #' The evaluated score for the soil function to resist diseases. A numeric value between 0 and 1. 13 | #' 14 | #' @export 15 | ind_resistance <- function(A_SOM_LOI) { 16 | 17 | # Check inputs 18 | checkmate::assert_numeric(A_SOM_LOI, lower = 0, upper = 100, any.missing = FALSE) 19 | 20 | # Evaluate the soil resistance 21 | value <- OBIC::evaluate_logistic(A_SOM_LOI, b = 1.2, x0 = 1.7, v = 0.4) 22 | 23 | return(value) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /R/root_depth.R: -------------------------------------------------------------------------------- 1 | #' Determine the root depth of the soil for this crop 2 | #' 3 | #' This function determines the depth of the soil 4 | #' 5 | #' @param B_LU_BRP (numeric) The crop code (gewascode) from the BRP 6 | #' 7 | #' @import data.table 8 | #' 9 | #' @details 10 | #' This is a helper function to estimate the rooting depth of crops, as being used for calculations for soil nutrient supplies. 11 | #' Be aware, this is not the real rooting depth; it rather represents the sampling depth of the soils collected for routine soil analsyis. 12 | #' 13 | #' @examples 14 | #' calc_root_depth(B_LU_BRP = 256) 15 | #' calc_root_depth(B_LU_BRP = c(256,265,1019,992)) 16 | #' 17 | #' @return 18 | #' The root depth of a crop corresponding to the sampling depth analyzed by agricultural labs. A numeric value. 19 | #' 20 | #' @export 21 | calc_root_depth <- function(B_LU_BRP) { 22 | 23 | crop_category = crop_code = id = NULL 24 | 25 | # Load data 26 | crops.obic <- as.data.table(OBIC::crops.obic) 27 | setkey(crops.obic, crop_code) 28 | 29 | # Check inputs 30 | checkmate::assert_numeric(B_LU_BRP, any.missing = FALSE) 31 | checkmate::assert_subset(B_LU_BRP, choices = unique(crops.obic$crop_code), empty.ok = FALSE) 32 | 33 | # Collect the data into a table 34 | dt <- data.table( 35 | id = 1:length(B_LU_BRP), 36 | B_LU_BRP = B_LU_BRP, 37 | value = NA_real_ 38 | ) 39 | dt <- merge(dt, crops.obic[, list(crop_code, crop_category)], by.x = "B_LU_BRP", by.y = "crop_code") 40 | setorder(dt, id) 41 | 42 | # Determine depth 43 | dt[crop_category %in% c("akkerbouw", "mais", "natuur"), value := 0.25] 44 | dt[crop_category %in% c("grasland"), value := 0.1] 45 | 46 | value <- dt[, value] 47 | return(value) 48 | } 49 | 50 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Open Bodem Index Calculator (OBIC) 2 | 3 | 4 | [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-green.svg)](https://lifecycle.r-lib.org/articles/stages.html) 5 | [![R-CMD-check](https://github.com/AgroCares/Open-Bodem-Index-Calculator/actions/workflows/check-standard.yaml/badge.svg)](https://github.com/AgroCares/Open-Bodem-Index-Calculator/actions/workflows/check-standard.yaml) 6 | [![Codecov test coverage](https://codecov.io/gh/AgroCares/Open-Bodem-Index-Calculator/branch/master/graph/badge.svg)](https://app.codecov.io/gh/AgroCares/Open-Bodem-Index-Calculator?branch=master) 7 | [![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/OBIC)](https://cran.r-project.org/package=OBIC) 8 | [![](https://cranlogs.r-pkg.org/badges/grand-total/OBIC)](https://cran.r-project.org/package=OBIC) 9 | 10 | 11 | This R package can be used to calculate the Open Bodem Index (OBI). 12 | The OBI is a tool that evaluate the soil of agricultural fields based on four main criteria: chemical, physical, biological and management. 13 | These four criteria consist of more than 21 indicators to get a comprehensive picture of the soil. 14 | More information about the Open Bodem Index can be found at [Open Bodem Index](https://openbodemindex.nl). 15 | 16 | ## Installation 17 | ```R 18 | # Install from latest stable version from CRAN 19 | install.packages("OBIC") 20 | 21 | # Or install the development version from GitHub 22 | remotes::install_github("AgroCares/Open-Bodem-Index-Calculator") 23 | 24 | # Load the OBIC package in your script 25 | library("OBIC") 26 | ``` 27 | Previous releases of `OBIC` can be found at `releases` section on the GitHub repository. 28 | 29 | ## Documentation 30 | Documentation of the R functions in the OBIC package can be found [here](https://agrocares.github.io/Open-Bodem-Index-Calculator/) 31 | 32 | ## More information 33 | The [Open Bodem Index](https://openbodemindex.nl) (OBI) is a collaboration between Wageningen UR, NMI and FarmHack in collaboration with agricultural experts. 34 | The Open Bodem Index Calculator is a tool used by the OBI and developed by [NMI](https://www.nmi-agro.nl/). 35 | 36 | ![Logo of NMI](https://media.licdn.com/dms/image/C560BAQEYGcm4HjNnxA/company-logo_200_200/0?e=2159024400&v=beta&t=u40rJ7bixPWB2SAqaj3KCKzJRoKcqf0wUXCdmsTDQvw) 37 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 1% 9 | informational: true 10 | patch: 11 | default: 12 | target: auto 13 | threshold: 1% 14 | informational: true 15 | -------------------------------------------------------------------------------- /data/binnenveld.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/binnenveld.rda -------------------------------------------------------------------------------- /data/bouwsteen_tb.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/bouwsteen_tb.rda -------------------------------------------------------------------------------- /data/column_description.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/column_description.obic.rda -------------------------------------------------------------------------------- /data/crops.makkink.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/crops.makkink.rda -------------------------------------------------------------------------------- /data/crops.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/crops.obic.rda -------------------------------------------------------------------------------- /data/eval.crumbleability.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/eval.crumbleability.rda -------------------------------------------------------------------------------- /data/management.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/management.obic.rda -------------------------------------------------------------------------------- /data/nema.crop.rot.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/nema.crop.rot.obic.rda -------------------------------------------------------------------------------- /data/nema.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/nema.obic.rda -------------------------------------------------------------------------------- /data/nleach_table.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/nleach_table.rda -------------------------------------------------------------------------------- /data/recom.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/recom.obic.rda -------------------------------------------------------------------------------- /data/recom.obic_bkp.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/recom.obic_bkp.rda -------------------------------------------------------------------------------- /data/season.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/season.obic.rda -------------------------------------------------------------------------------- /data/soils.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/soils.obic.rda -------------------------------------------------------------------------------- /data/tbl.ph.delta.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/tbl.ph.delta.rda -------------------------------------------------------------------------------- /data/waterstress.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/waterstress.obic.rda -------------------------------------------------------------------------------- /data/weather.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/weather.obic.rda -------------------------------------------------------------------------------- /data/weight.obic.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/data/weight.obic.rda -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | citHeader("To cite the OBIC in publications please use:") 2 | 3 | bibentry("Article", 4 | title = "An Open Soil Health Assessment Framework Facilitating Sustainable Soil Management", 5 | author = c(person("Gerard H", "Ros", 6 | email = "gerard.ros@wur.nl", 7 | comment = c(ORCID = "0000-0002-6062-9770")), 8 | person("Sven E", "Verweij", 9 | comment = c(ORCID = "0000-0002-5573-3952")), 10 | person('Sander J C', "Janssen"), 11 | person("Janjo", "de Haan"), 12 | person("Yuki", "Fujita", 13 | comment = c(ORCID = "0000-0002-0541-2798"))), 14 | journal = "Environmental Science & Technology", 15 | year = "2022", 16 | doi = "10.1021/acs.est.2c04516" 17 | ) 18 | -------------------------------------------------------------------------------- /man/bouwsteen_tb.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{bouwsteen_tb} 5 | \alias{bouwsteen_tb} 6 | \title{Table with water retention properties of 'bouwstenen'} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 36 rows and 14 columns. 9 | } 10 | \usage{ 11 | bouwsteen_tb 12 | } 13 | \description{ 14 | This table contains water retention curve parameters and typical mineral composition of 18 'bouwstenen' 15 | } 16 | \details{ 17 | \describe{ 18 | \item{bouwsteen}{soil type bouwsteen} 19 | \item{omschrijving}{description of 'bouwsteen'} 20 | \item{thres}{residual water content (cm3/cm3). Table 3 of Wosten 2001} 21 | \item{thsat}{water content at saturation (cm3/cm3). Table 3 of Wosten 2001} 22 | \item{Ks}{saturated hydraulic conductivity (cm/d). Table 3 of Wosten 2001} 23 | \item{alpha}{parameter alpha of pF curve (1/cm) Table 3 of Wosten 2001} 24 | \item{l}{parameter l of pF curve (-). Table 3 of Wosten 2001} 25 | \item{n}{parameter n of pF curve (-). Table 3 of Wosten 2001} 26 | \item{sand\%}{sand content (\%) within soil mineral parts. Middle value of Table 1 of Wosten 2001} 27 | \item{silt\%}{silt content (\%) within soil mineral parts. Middle value of Table 1 of Wosten 2001} 28 | \item{clay\%}{clay content (\%) within soil mineral parts. Middle value of Table 1 of Wosten 2001} 29 | \item{OM\%}{organic matter content (\%). Middle value of Table 1 of Wosten 2001} 30 | \item{bulkdensity}{soil bulk density (g/cm3). Middle value of Table 2 of Wosten 2001} 31 | \item{M50}{size of sand particles (um). Middle value of Table 2 of Wosten 2001} 32 | } 33 | } 34 | \keyword{datasets} 35 | -------------------------------------------------------------------------------- /man/calc_aggregatestability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cec.R 3 | \name{calc_aggregatestability} 4 | \alias{calc_aggregatestability} 5 | \title{Calculate aggregate stability index based on occupation CEC} 6 | \usage{ 7 | calc_aggregatestability( 8 | B_SOILTYPE_AGR, 9 | A_SOM_LOI, 10 | A_K_CO_PO, 11 | A_CA_CO_PO, 12 | A_MG_CO_PO 13 | ) 14 | } 15 | \arguments{ 16 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 17 | 18 | \item{A_SOM_LOI}{(numeric) The organic matter content of soil in percentage} 19 | 20 | \item{A_K_CO_PO}{(numeric) The occupation of the CEC with K (\%)} 21 | 22 | \item{A_CA_CO_PO}{(numeric) The occupation of the CEC with Ca (\%)} 23 | 24 | \item{A_MG_CO_PO}{(numeric) The occupation of the CEC with Mg (\%)} 25 | } 26 | \value{ 27 | The aggregate stability index of a soil given the Cation Exchange Capacity and its composition with major cations. A numeric value. 28 | } 29 | \description{ 30 | This function calculates an aggregate stability index given the CEC and its occupation with major cations. 31 | } 32 | \examples{ 33 | calc_aggregatestability(B_SOILTYPE_AGR = 'dekzand', A_SOM_LOI = 3.5, 34 | A_K_CO_PO = 6,A_CA_CO_PO = 83 ,A_MG_CO_PO = 9) 35 | calc_aggregatestability(B_SOILTYPE_AGR = c('dekzand','rivierklei'), A_SOM_LOI = c(3.5,6.5), 36 | A_K_CO_PO = c(6,9),A_CA_CO_PO = c(83,75) ,A_MG_CO_PO = c(9,4)) 37 | 38 | } 39 | -------------------------------------------------------------------------------- /man/calc_bulk_density.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bulk_density.R 3 | \name{calc_bulk_density} 4 | \alias{calc_bulk_density} 5 | \title{Calculate the bulk density} 6 | \usage{ 7 | calc_bulk_density(B_SOILTYPE_AGR, A_SOM_LOI, A_CLAY_MI = NULL) 8 | } 9 | \arguments{ 10 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 11 | 12 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil (\%)} 13 | 14 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 15 | } 16 | \value{ 17 | The bulk density of an arable soil (kg / m3). A numeric value. 18 | } 19 | \description{ 20 | This function calculates the bulk density of the soil based on texture and organic matter 21 | } 22 | \examples{ 23 | calc_bulk_density(B_SOILTYPE_AGR = 'zeeklei', A_SOM_LOI = 6.5, A_CLAY_MI = 28) 24 | calc_bulk_density(B_SOILTYPE_AGR = 'dekzand', A_SOM_LOI = 3.5) 25 | calc_bulk_density(B_SOILTYPE_AGR = c('dekzand','rivierklei'), A_SOM_LOI = c(3.5,8.5)) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/calc_cec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cec.R 3 | \name{calc_cec} 4 | \alias{calc_cec} 5 | \title{Calculate a soil fertility index based on the CEC} 6 | \usage{ 7 | calc_cec(A_CEC_CO) 8 | } 9 | \arguments{ 10 | \item{A_CEC_CO}{(numeric) The cation exchange capacity (mmol+ / kg)} 11 | } 12 | \value{ 13 | The capacity of the soil to buffer cations. A numeric value. 14 | } 15 | \description{ 16 | This function calculates the capacity of the soil to buffer cations 17 | } 18 | \examples{ 19 | calc_cec(A_CEC_CO = 85) 20 | calc_cec(A_CEC_CO = c(85,125,326)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/calc_copper_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metals.R 3 | \name{calc_copper_availability} 4 | \alias{calc_copper_availability} 5 | \title{Calculate the availability of the metal Cu} 6 | \usage{ 7 | calc_copper_availability( 8 | B_LU_BRP, 9 | A_SOM_LOI, 10 | A_CLAY_MI, 11 | A_K_CC, 12 | A_MN_CC, 13 | A_CU_CC 14 | ) 15 | } 16 | \arguments{ 17 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 18 | 19 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (\%)} 20 | 21 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 22 | 23 | \item{A_K_CC}{(numeric) The plant available potassium, extracted with 0.01M CaCl2 (mg / kg),} 24 | 25 | \item{A_MN_CC}{(numeric) The plant available Mn content, extracted with 0.01M CaCl2 (ug / kg)} 26 | 27 | \item{A_CU_CC}{(numeric) The plant available Cu content, extracted with 0.01M CaCl2 (ug / kg)} 28 | } 29 | \value{ 30 | The function of the soil to supply Copper. A numeric value. 31 | } 32 | \description{ 33 | This function calculates the availability of Cu for plant uptake 34 | } 35 | \examples{ 36 | calc_copper_availability(B_LU_BRP = 265, A_SOM_LOI = 3.5, A_CLAY_MI = 4,A_K_CC = 65, 37 | A_MN_CC = 110, A_CU_CC = 250) 38 | calc_copper_availability(B_LU_BRP = 265, 3.5, 4,65, 110, 250) 39 | calc_copper_availability(B_LU_BRP = c(1019,265), c(3.5,5), c(4,8),c(65,95), c(110,250), c(250,315)) 40 | 41 | } 42 | -------------------------------------------------------------------------------- /man/calc_cropclass.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crop_classification.R 3 | \name{calc_cropclass} 4 | \alias{calc_cropclass} 5 | \title{Determine classification rules for crops used to prepare crops.obic} 6 | \usage{ 7 | calc_cropclass(B_LU_BRP, B_SOILTYPE_AGR, nutrient) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 13 | 14 | \item{nutrient}{(character) The nutrient for which crop classification is needed. Options include P, K and S.} 15 | } 16 | \value{ 17 | The crop class representing its sensitivity for P, K or S deficiency. A character value. 18 | } 19 | \description{ 20 | This function determines crop classes given crop response to P, K and S fertilizers 21 | } 22 | \examples{ 23 | calc_cropclass(B_LU_BRP = 256, B_SOILTYPE_AGR = 'dekzand', nutrient = 'P') 24 | calc_cropclass(B_LU_BRP = c(256,1027), B_SOILTYPE_AGR = c('dekzand','rivierklei'),nutrient = 'P') 25 | 26 | } 27 | \references{ 28 | CBAV (2022) Handboek Bodem en Bemesting,https://www.handboekbodemenbemesting.nl/ 29 | } 30 | -------------------------------------------------------------------------------- /man/calc_crumbleability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crumbleability.R 3 | \name{calc_crumbleability} 4 | \alias{calc_crumbleability} 5 | \title{Calculate the crumbleability} 6 | \usage{ 7 | calc_crumbleability(A_SOM_LOI, A_CLAY_MI, A_PH_CC) 8 | } 9 | \arguments{ 10 | \item{A_SOM_LOI}{(numeric) The organic matter content of soil (\%)} 11 | 12 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 13 | 14 | \item{A_PH_CC}{(numeric) The pH of the soil, measured in 0.01M CaCl2} 15 | } 16 | \value{ 17 | The crumbleability index of a soil, a measure for a physical soil property. A numeric value. 18 | } 19 | \description{ 20 | This function calculates the crumbleability. This value can be evaluated by \code{\link{ind_crumbleability}} 21 | } 22 | \examples{ 23 | calc_crumbleability(A_SOM_LOI = 3.5, A_CLAY_MI = 12, A_PH_CC = 5.4) 24 | calc_crumbleability(A_SOM_LOI = c(3.5,12), A_CLAY_MI = c(4,12), A_PH_CC = c(5.4, 7.1)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/calc_grass_age.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/grass_age.R 3 | \name{calc_grass_age} 4 | \alias{calc_grass_age} 5 | \title{Calculate the average age of the grass} 6 | \usage{ 7 | calc_grass_age(ID, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{ID}{(numeric) The ID of the field} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | } 14 | \value{ 15 | The age of the grassland within a crop rotation plan. A numeric value. 16 | } 17 | \description{ 18 | This function calculates the average age of the grass 19 | } 20 | \details{ 21 | The function assumes that the order of crop codes are descending, so the latest year is on top. 22 | } 23 | \examples{ 24 | calc_grass_age(ID = rep(1,5), B_LU_BRP = c(1091,265,256,256,1091)) 25 | calc_grass_age(ID = rep(1,5), B_LU_BRP = c(265,265,265,265,1091)) 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/calc_magnesium_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/magnesium.R 3 | \name{calc_magnesium_availability} 4 | \alias{calc_magnesium_availability} 5 | \title{Calculate the capacity of soils to supply Magnesium} 6 | \usage{ 7 | calc_magnesium_availability( 8 | B_LU_BRP, 9 | B_SOILTYPE_AGR, 10 | A_SOM_LOI, 11 | A_CLAY_MI, 12 | A_PH_CC, 13 | A_CEC_CO, 14 | A_K_CO_PO, 15 | A_MG_CC, 16 | A_K_CC 17 | ) 18 | } 19 | \arguments{ 20 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 21 | 22 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 23 | 24 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil (\%)} 25 | 26 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 27 | 28 | \item{A_PH_CC}{(numeric) The acidity of the soil, measured in 0.01M CaCl2 (-)} 29 | 30 | \item{A_CEC_CO}{(numeric) The cation exchange capacity of the soil (mmol+ per kg), analyzed via Cobalt-hexamine extraction} 31 | 32 | \item{A_K_CO_PO}{(numeric) The occupation of the CEC with potassium (\%)} 33 | 34 | \item{A_MG_CC}{(numeric) The plant available content of Mg in the soil (mg Mg per kg) extracted by 0.01M CaCl2} 35 | 36 | \item{A_K_CC}{(numeric) The plant available potassium, extracted with 0.01M CaCl2 (mg per kg),} 37 | } 38 | \value{ 39 | An index representing the availability of Magnesium in a soil. A numeric value. 40 | } 41 | \description{ 42 | This function calculates an index for the availability of Magnesium in soil 43 | } 44 | \examples{ 45 | calc_magnesium_availability(B_LU_BRP = 265, B_SOILTYPE_AGR = 'dekzand', 46 | A_SOM_LOI = 3.5,A_CLAY_MI = 8.5,A_PH_CC = 5.4, 47 | A_CEC_CO = 185,A_K_CO_PO = 4.5,A_MG_CC = 125,A_K_CC = 65) 48 | 49 | } 50 | -------------------------------------------------------------------------------- /man/calc_makkink.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/makkink.R 3 | \name{calc_makkink} 4 | \alias{calc_makkink} 5 | \title{Add Makkink correction factors and crop cover to crop rotation table} 6 | \usage{ 7 | calc_makkink(B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | } 12 | \value{ 13 | A datatable with the crop dependent Makkink correction factor per month. 14 | Output is a single data.table with for each B_LU_BRP code the monthly correction factor. 15 | Columns of the data.table are: crop_makkink, month, year, mcf and crop_cover. 16 | } 17 | \description{ 18 | This function adds Makkink correction factors for ET and crop cover to the crop rotation table 19 | } 20 | \examples{ 21 | calc_makkink(B_LU_BRP = 265) 22 | calc_makkink(B_LU_BRP = c(265,1019)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/calc_n_efficiency.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nitrogen_efficiency.R 3 | \name{calc_n_efficiency} 4 | \alias{calc_n_efficiency} 5 | \title{Calculate nitrogen use efficiency and leaching based on N surplus} 6 | \usage{ 7 | calc_n_efficiency( 8 | B_LU_BRP, 9 | B_SOILTYPE_AGR, 10 | B_GWL_CLASS, 11 | B_AER_CBS, 12 | A_SOM_LOI, 13 | A_CLAY_MI, 14 | D_PBI, 15 | D_K, 16 | D_PH_DELTA, 17 | leaching_to, 18 | M_GREEN = FALSE, 19 | B_FERT_NORM_FR = 1 20 | ) 21 | } 22 | \arguments{ 23 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 24 | 25 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soilBRP} 26 | 27 | \item{B_GWL_CLASS}{(character) The groundwater table class} 28 | 29 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 30 | 31 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil (\%)} 32 | 33 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 34 | 35 | \item{D_PBI}{(numeric) The value of phosphate availability calculated by \code{\link{calc_phosphate_availability}}} 36 | 37 | \item{D_K}{(numeric) The value of K-index calculated by \code{\link{calc_potassium_availability}}} 38 | 39 | \item{D_PH_DELTA}{(numeric) The pH difference with the optimal pH.} 40 | 41 | \item{leaching_to}{(character) whether it computes N leaching to groundwater ("gw") or to surface water ("ow")} 42 | 43 | \item{M_GREEN}{(boolean) A soil measure. Are catch crops sown after main crop (optional, option: yes or no)} 44 | 45 | \item{B_FERT_NORM_FR}{(numeric) The fraction of the application norm utilized} 46 | } 47 | \value{ 48 | The estimated index for the nitrogen use efficiency, as being affected by soil properties. A numeric value. 49 | } 50 | \description{ 51 | This function gives an indication of the nitrogen use efficiency, the function calculates the N surplus and the resulting N leaching 52 | } 53 | \examples{ 54 | calc_n_efficiency(1019,'dekzand','GtIV','Zuidwest-Brabant',4.5,3.5,0.8,0.6,0.2,78,FALSE,1) 55 | calc_n_efficiency(256,'veen','GtII','Centraal Veehouderijgebied',4.5,3.5,0.8,0.6,0.2,250,FALSE,1) 56 | 57 | } 58 | -------------------------------------------------------------------------------- /man/calc_nleach.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nretention.r 3 | \name{calc_nleach} 4 | \alias{calc_nleach} 5 | \title{Calculate the N leaching} 6 | \usage{ 7 | calc_nleach( 8 | B_SOILTYPE_AGR, 9 | B_LU_BRP, 10 | B_GWL_CLASS, 11 | D_NLV, 12 | B_AER_CBS, 13 | leaching_to 14 | ) 15 | } 16 | \arguments{ 17 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 18 | 19 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 20 | 21 | \item{B_GWL_CLASS}{(character) The groundwater table class} 22 | 23 | \item{D_NLV}{(numeric) The N supplying capacity of a soil (kg N ha-1 jr-1) calculated by \code{\link{calc_nlv}}} 24 | 25 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 26 | 27 | \item{leaching_to}{(character) whether it computes N leaching to groundwater ("gw") or to surface water ("ow")} 28 | } 29 | \value{ 30 | The potential nitrogen leaching from the soil originating from soil nitrogen mineralization processes. A numeric value. 31 | } 32 | \description{ 33 | This function calculates the potential N leaching of a soil. 34 | } 35 | \examples{ 36 | calc_nleach('dekzand',265,'GtIII',145,'Zuidwest-Brabant','gw') 37 | calc_nleach('rivierklei',1019,'GtIV',145,'Rivierengebied','ow') 38 | 39 | } 40 | -------------------------------------------------------------------------------- /man/calc_nlv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nitrogen.R 3 | \name{calc_nlv} 4 | \alias{calc_nlv} 5 | \title{Calculate the NLV} 6 | \usage{ 7 | calc_nlv(B_LU_BRP, B_SOILTYPE_AGR, A_N_RT, A_CN_FR, D_OC, D_BDS, D_GA) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 13 | 14 | \item{A_N_RT}{(numeric) The organic nitrogen content of the soil in mg N / kg} 15 | 16 | \item{A_CN_FR}{(numeric) The carbon to nitrogen ratio} 17 | 18 | \item{D_OC}{(numeric) The organic carbon content of the soil in kg C / ha} 19 | 20 | \item{D_BDS}{(numeric) The bulk density of the soil in kg / m3} 21 | 22 | \item{D_GA}{(numeric) The age of the grass if present} 23 | } 24 | \value{ 25 | The capacity of the soil to supply nitrogen (kg N / ha / yr). A numeric value. 26 | } 27 | \description{ 28 | This function calculates the NLV (nitrogen producing capacity) for the soil 29 | } 30 | \examples{ 31 | calc_nlv(B_LU_BRP = 256, B_SOILTYPE_AGR = 'dekzand',A_N_RT = 2500, 32 | A_CN_FR = 11, D_OC = 86000,D_BDS = 1300, D_GA = 4) 33 | calc_nlv(1019,'dekzand',2315,13,86000,1345,0) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/calc_organic_carbon.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/organic_carbon.R 3 | \name{calc_organic_carbon} 4 | \alias{calc_organic_carbon} 5 | \title{Calculate amount of organic carbon} 6 | \usage{ 7 | calc_organic_carbon(A_SOM_LOI, D_BDS, D_RD) 8 | } 9 | \arguments{ 10 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil} 11 | 12 | \item{D_BDS}{(numeric) The bulk density of the soil} 13 | 14 | \item{D_RD}{(numeric) The root depth of the crop} 15 | } 16 | \value{ 17 | The total amount of Carbon in the soil (kg C / ha). A numeric value. 18 | } 19 | \description{ 20 | This function calculates the amount of organic carbon in the soil 21 | } 22 | \examples{ 23 | calc_organic_carbon(A_SOM_LOI = 4.3, D_BDS = 1100, D_RD = 0.2) 24 | calc_organic_carbon(A_SOM_LOI = c(1,4.3), D_BDS = c(1100,1300), D_RD = c(0.2,0.6)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/calc_permeability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/groundwater_recharge.R 3 | \name{calc_permeability} 4 | \alias{calc_permeability} 5 | \title{Calculate the permeability of the top soil} 6 | \usage{ 7 | calc_permeability(A_CLAY_MI, A_SAND_MI, A_SILT_MI, A_SOM_LOI) 8 | } 9 | \arguments{ 10 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 11 | 12 | \item{A_SAND_MI}{(numeric) The sand content of the soil (\%)} 13 | 14 | \item{A_SILT_MI}{(numeric) The silt content of the soil (\%)} 15 | 16 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (\%)} 17 | } 18 | \description{ 19 | This function calculates the permeability of the top soil 20 | } 21 | -------------------------------------------------------------------------------- /man/calc_pesticide_leaching.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pesticides.R 3 | \name{calc_pesticide_leaching} 4 | \alias{calc_pesticide_leaching} 5 | \title{Calculate risk of pesticide leaching} 6 | \usage{ 7 | calc_pesticide_leaching( 8 | B_SOILTYPE_AGR, 9 | A_SOM_LOI, 10 | A_CLAY_MI, 11 | A_SAND_MI, 12 | A_SILT_MI, 13 | D_PSP, 14 | M_PESTICIDES_DST, 15 | M_MECHWEEDS 16 | ) 17 | } 18 | \arguments{ 19 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 20 | 21 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil (\%)} 22 | 23 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 24 | 25 | \item{A_SAND_MI}{(numeric) The sand content of the soil (\%)} 26 | 27 | \item{A_SILT_MI}{(numeric) The silt content of the soil (\%)} 28 | 29 | \item{D_PSP}{(numeric) The precipitation surplus per crop calculated by \code{\link{calc_psp}}} 30 | 31 | \item{M_PESTICIDES_DST}{(boolean) measure. Use of DST for pesticides (option: TRUE or FALSE)} 32 | 33 | \item{M_MECHWEEDS}{(boolean) measure. Use of mechanical weed protection (option: TRUE or FALSE)} 34 | } 35 | \value{ 36 | The risk of pesticide leaching from soils. A numeric value. 37 | } 38 | \description{ 39 | This function calculates the risk of pesticide leaching from a soil. The risk is calculated by comparing the current leached fraction with a worst case scenario 40 | } 41 | \examples{ 42 | calc_pesticide_leaching(B_SOILTYPE_AGR = 'rivierklei', A_SOM_LOI = 4, 43 | A_CLAY_MI = 20, A_SAND_MI = 45, A_SILT_MI = 35, 44 | D_PSP = 225, M_PESTICIDES_DST = TRUE,M_MECHWEEDS = TRUE) 45 | calc_pesticide_leaching('rivierklei', 4, 20, 45, 35, 225, TRUE,TRUE) 46 | calc_pesticide_leaching('dekzand', 4.8, 4.2, 85, 10.8, 225, TRUE,TRUE) 47 | 48 | } 49 | -------------------------------------------------------------------------------- /man/calc_ph_delta.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ph.R 3 | \name{calc_ph_delta} 4 | \alias{calc_ph_delta} 5 | \title{Calculate the difference between pH and optimum} 6 | \usage{ 7 | calc_ph_delta( 8 | B_LU_BRP, 9 | B_SOILTYPE_AGR, 10 | A_SOM_LOI, 11 | A_CLAY_MI, 12 | A_PH_CC, 13 | D_CP_STARCH, 14 | D_CP_POTATO, 15 | D_CP_SUGARBEET, 16 | D_CP_GRASS, 17 | D_CP_MAIS, 18 | D_CP_OTHER 19 | ) 20 | } 21 | \arguments{ 22 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 23 | 24 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 25 | 26 | \item{A_SOM_LOI}{(numeric) The organic matter content of soil in percentage} 27 | 28 | \item{A_CLAY_MI}{(numeric) The percentage A_CLAY_MI present in the soil} 29 | 30 | \item{A_PH_CC}{(numeric) The pH-CaCl2 of the soil} 31 | 32 | \item{D_CP_STARCH}{(numeric) The fraction of starch potatoes in the crop plan} 33 | 34 | \item{D_CP_POTATO}{(numeric) The fraction of potatoes (excluding starch potatoes) in the crop plan} 35 | 36 | \item{D_CP_SUGARBEET}{(numeric) The fraction of sugar beets in the crop plan} 37 | 38 | \item{D_CP_GRASS}{(numeric) The fraction of grass in the crop plan} 39 | 40 | \item{D_CP_MAIS}{(numeric) The fraction of mais in the crop plan} 41 | 42 | \item{D_CP_OTHER}{(numeric) The fraction of other crops in the crop plan} 43 | } 44 | \value{ 45 | The difference between the actual and desired optimum soil pH. A numeric value. 46 | } 47 | \description{ 48 | This functions calculates the difference between the measured pH and the optimal pH according to the Bemestingsadvies 49 | } 50 | \examples{ 51 | calc_ph_delta(B_LU_BRP = 265, B_SOILTYPE_AGR = "rivierklei", A_SOM_LOI = 5, 52 | A_CLAY_MI = 20,A_PH_CC = 6, D_CP_STARCH = 0,D_CP_POTATO = 0.3,D_CP_SUGARBEET = 0.2, 53 | D_CP_GRASS = 0,D_CP_MAIS = 0.2,D_CP_OTHER = 0.3) 54 | calc_ph_delta(265, "rivierklei", 5,20,6, 0,0.3,0.2,0,0.2,0.3) 55 | 56 | } 57 | \references{ 58 | Handboek Bodem en Bemesting tabel 5.1, 5.2 en 5.3 59 | } 60 | -------------------------------------------------------------------------------- /man/calc_phosphate_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phosphate_availability.R 3 | \name{calc_phosphate_availability} 4 | \alias{calc_phosphate_availability} 5 | \title{Calculate the phosphate availability (PBI)} 6 | \usage{ 7 | calc_phosphate_availability( 8 | B_LU_BRP, 9 | A_P_AL = NULL, 10 | A_P_CC = NULL, 11 | A_P_WA = NULL 12 | ) 13 | } 14 | \arguments{ 15 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 16 | 17 | \item{A_P_AL}{(numeric) The P-AL content of the soil} 18 | 19 | \item{A_P_CC}{(numeric) The P-CaCl2 content of the soil} 20 | 21 | \item{A_P_WA}{(numeric) The P-content of the soil extracted with water} 22 | } 23 | \value{ 24 | The phosphate availability index estimated from extractable soil P fractions. A numeric value. 25 | } 26 | \description{ 27 | This function calculates the phosphate availability. This value can be evaluated by \code{\link{ind_phosphate_availability}} 28 | } 29 | \examples{ 30 | calc_phosphate_availability(B_LU_BRP = 265, A_P_AL = 45, A_P_CC = 2.5) 31 | calc_phosphate_availability(c(265,1019),A_P_AL = c(35,54),A_P_CC = c(2.5,4.5), A_P_WA = c(35,65)) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/calc_pmn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pmn.R 3 | \name{calc_pmn} 4 | \alias{calc_pmn} 5 | \title{Calculate the index for the microbial biological activity} 6 | \usage{ 7 | calc_pmn(B_LU_BRP, B_SOILTYPE_AGR, A_N_PMN) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 13 | 14 | \item{A_N_PMN}{(numeric) The potentially mineralizable N pool (mg N / kg soil)} 15 | } 16 | \value{ 17 | the normalized potentially mineralizable Nitrogen pool (mg N / kg), a numeric value. 18 | } 19 | \description{ 20 | This function assesses the microbial biological activity (of microbes and fungi) via the Potentially Mineralizable N pool, also called PMN (or SoilLife by Eurofins in the past). 21 | } 22 | \examples{ 23 | calc_pmn(B_LU_BRP = 256, B_SOILTYPE_AGR = 'dekzand', A_N_PMN = 125) 24 | calc_pmn(B_LU_BRP = c(256,1027), B_SOILTYPE_AGR = c('dekzand','rivierklei'), A_N_PMN = c(125,45)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/calc_potassium_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/potassium.R 3 | \name{calc_potassium_availability} 4 | \alias{calc_potassium_availability} 5 | \title{Calculate the K availability} 6 | \usage{ 7 | calc_potassium_availability( 8 | B_LU_BRP, 9 | B_SOILTYPE_AGR, 10 | A_SOM_LOI, 11 | A_CLAY_MI, 12 | A_PH_CC, 13 | A_CEC_CO, 14 | A_K_CO_PO, 15 | A_K_CC 16 | ) 17 | } 18 | \arguments{ 19 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 20 | 21 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 22 | 23 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (\%)} 24 | 25 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 26 | 27 | \item{A_PH_CC}{(numeric) The acidity of the soil, measured in 0.01M CaCl2 (-)} 28 | 29 | \item{A_CEC_CO}{(numeric) The cation exchange capacity of the soil (mmol+ / kg), analyzed via Cobalt-hexamine extraction} 30 | 31 | \item{A_K_CO_PO}{(numeric) The occupation of the CEC with potassium (\%)} 32 | 33 | \item{A_K_CC}{(numeric) The plant available potassium, extracted with 0.01M CaCl2 (mg / kg),} 34 | } 35 | \value{ 36 | The capacity of the soil to supply and buffer potassium. A numeric value. 37 | } 38 | \description{ 39 | This function calculates the K availability of a soil. 40 | } 41 | \examples{ 42 | calc_potassium_availability(B_LU_BRP = 265, B_SOILTYPE_AGR = 'dekzand', 43 | A_SOM_LOI = 4, A_CLAY_MI = 11,A_PH_CC = 5.4, A_CEC_CO = 125, 44 | A_K_CO_PO = 8.5, A_K_CC = 145) 45 | calc_potassium_availability(265, 'dekzand',4, 11,5.4, 125,8.5, 145) 46 | calc_potassium_availability(c(265,1019), rep('dekzand',2),c(4,6), c(11,14), 47 | c(5.4,5.6), c(125,145),c(8.5,3.5), c(145,180)) 48 | 49 | } 50 | -------------------------------------------------------------------------------- /man/calc_psp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/precipitation_surplus.R 3 | \name{calc_psp} 4 | \alias{calc_psp} 5 | \title{Calculate the precipitation surplus} 6 | \usage{ 7 | calc_psp(B_LU_BRP, M_GREEN) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{M_GREEN}{(boolean) A soil measure. Are catch crops sown after main crop (optional, options: TRUE, FALSE)} 13 | } 14 | \value{ 15 | The estimated precipitation surplus (in mm / ha) depending on averaged precipitation and evaporation. A numeric value. 16 | } 17 | \description{ 18 | This function calculates the precipitation surplus (in mm / ha) given the crop rotation plan. 19 | } 20 | \examples{ 21 | calc_psp(B_LU_BRP = 265, M_GREEN = TRUE) 22 | calc_psp(B_LU_BRP = c(265,1019,265,1019), M_GREEN = rep(TRUE,4)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/calc_root_depth.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/root_depth.R 3 | \name{calc_root_depth} 4 | \alias{calc_root_depth} 5 | \title{Determine the root depth of the soil for this crop} 6 | \usage{ 7 | calc_root_depth(B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 11 | } 12 | \value{ 13 | The root depth of a crop corresponding to the sampling depth analyzed by agricultural labs. A numeric value. 14 | } 15 | \description{ 16 | This function determines the depth of the soil 17 | } 18 | \details{ 19 | This is a helper function to estimate the rooting depth of crops, as being used for calculations for soil nutrient supplies. 20 | Be aware, this is not the real rooting depth; it rather represents the sampling depth of the soils collected for routine soil analsyis. 21 | } 22 | \examples{ 23 | calc_root_depth(B_LU_BRP = 256) 24 | calc_root_depth(B_LU_BRP = c(256,265,1019,992)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/calc_rotation_fraction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crop_rotation.R 3 | \name{calc_rotation_fraction} 4 | \alias{calc_rotation_fraction} 5 | \title{Calculates the fraction in the crop rotation} 6 | \usage{ 7 | calc_rotation_fraction(ID, B_LU_BRP, crop) 8 | } 9 | \arguments{ 10 | \item{ID}{(numeric) The ID of the field} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{crop}{(character) The crop to check for. For relevant crop categories, see details.} 15 | } 16 | \value{ 17 | The fraction of specific crop types within the crop rotation sequence. A numeric value. 18 | } 19 | \description{ 20 | This function calculates the fraction present in the crop rotation 21 | } 22 | \details{ 23 | This function calculates the fraction present in the crop rotation for specific crop categories. 24 | These categories include "starch", "potato", "sugarbeet", "grass", "mais", "alfalfa","catchcrop","cereal","clover",'nature', rapeseed',"other","rustgewas",and "rustgewasdiep". 25 | } 26 | \examples{ 27 | calc_rotation_fraction(ID = rep(1,4), B_LU_BRP = c(265,1910,1935,1033),crop = 'potato') 28 | calc_rotation_fraction(ID = rep(1,4), B_LU_BRP = c(265,1910,1935,1033),crop = 'grass') 29 | 30 | } 31 | -------------------------------------------------------------------------------- /man/calc_sbal_arable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sulfur.R 3 | \name{calc_sbal_arable} 4 | \alias{calc_sbal_arable} 5 | \title{Calculate the indicator for delta S-balance arable} 6 | \usage{ 7 | calc_sbal_arable(D_SLV, B_LU_BRP, B_SOILTYPE_AGR, B_AER_CBS) 8 | } 9 | \arguments{ 10 | \item{D_SLV}{(numeric) The value of SLV calculated by \code{\link{calc_slv}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | 16 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 17 | } 18 | \value{ 19 | Estimated contribution of the soil to the S balance of arable fields. A numeric value. 20 | } 21 | \description{ 22 | This function calculates the change in S-balance compared to averaged S-supply as given in fertilizer recommendation systems. 23 | } 24 | \examples{ 25 | \dontshow{data.table::setDTthreads(1)} 26 | calc_sbal_arable(D_SLV = 65, B_LU_BRP = 1019, B_SOILTYPE_AGR = 'dekzand', 27 | B_AER_CBS = 'Rivierengebied') 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/calc_sealing_risk.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sealing.R 3 | \name{calc_sealing_risk} 4 | \alias{calc_sealing_risk} 5 | \title{Calculate soil sealing risk} 6 | \usage{ 7 | calc_sealing_risk(A_SOM_LOI, A_CLAY_MI) 8 | } 9 | \arguments{ 10 | \item{A_SOM_LOI}{(numeric) The organic matter content of soil (\%)} 11 | 12 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 13 | } 14 | \value{ 15 | The risk of soil sealing as affected by the soil organic matter and clay content. A numeric value. 16 | } 17 | \description{ 18 | This function calculates the risks of soil sealing. This value can be evaluated by \code{\link{ind_sealing}} 19 | } 20 | \examples{ 21 | calc_sealing_risk(A_SOM_LOI = 3.5, A_CLAY_MI = 7.5) 22 | calc_sealing_risk(A_SOM_LOI = c(3.5,6.5), A_CLAY_MI = c(7.5,15)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/calc_slv.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sulfur.R 3 | \name{calc_slv} 4 | \alias{calc_slv} 5 | \title{Calculate the SLV} 6 | \usage{ 7 | calc_slv(B_LU_BRP, B_SOILTYPE_AGR, B_AER_CBS, A_SOM_LOI, A_S_RT, D_BDS) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 13 | 14 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 15 | 16 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (in percent)} 17 | 18 | \item{A_S_RT}{(numeric) The total Sulpher content of the soil (in mg S per kg)} 19 | 20 | \item{D_BDS}{(numeric) The bulk density of the soil (in kg per m3)} 21 | } 22 | \value{ 23 | The capacity of the soil to supply Sulfur (kg S / ha / yr). A numeric value. 24 | } 25 | \description{ 26 | This function calculates a S-balance given the SLV (Sulfur supplying capacity) of a soil 27 | } 28 | \examples{ 29 | calc_slv(B_LU_BRP = 1019, B_SOILTYPE_AGR = 'dekzand', 30 | B_AER_CBS = 'Rivierengebied',A_SOM_LOI = 3.5,A_S_RT = 3500, D_BDS = 1400) 31 | calc_slv(1019, 'dekzand', 'Rivierengebied',3.5,3500,1400) 32 | calc_slv(c(256,1019), rep('dekzand',2), rep('Rivierengebied',2),c(6.5,3.5), 33 | c(3500,7500),c(1400,1100)) 34 | 35 | } 36 | -------------------------------------------------------------------------------- /man/calc_sombalance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sombalance.R 3 | \name{calc_sombalance} 4 | \alias{calc_sombalance} 5 | \title{Calculate simple organic matter balance} 6 | \usage{ 7 | calc_sombalance(B_LU_BRP, A_SOM_LOI, A_P_AL, A_P_WA, M_COMPOST, M_GREEN) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{A_SOM_LOI}{(numeric) The percentage organic matter in the soil (\%)} 13 | 14 | \item{A_P_AL}{(numeric) The P-AL content of the soil (in mg P2O5 per 100g)} 15 | 16 | \item{A_P_WA}{(numeric) The P-water content of the soil (in mg P2O5 per Liter)} 17 | 18 | \item{M_COMPOST}{(numeric) The frequency that compost is applied (every x years)} 19 | 20 | \item{M_GREEN}{(boolean) measure. are catch crops sown after main crop (option: TRUE or FALSE)} 21 | } 22 | \value{ 23 | The estimated soil organic matter balance in kg EOS per ha per year. A numeric value. 24 | } 25 | \description{ 26 | This function calculates a simple organic matter balance, as currently used in agricultural practice in the Netherlands.For more details, see www.os-balans.nl 27 | } 28 | \examples{ 29 | calc_sombalance(B_LU_BRP = 1019,A_SOM_LOI = 4, A_P_AL = 35, A_P_WA = 40, 30 | M_COMPOST = 4, M_GREEN = TRUE) 31 | calc_sombalance(1019,4, 35, 40, 4, TRUE) 32 | calc_sombalance(c(256,1024,1019),c(4,5,6), c(35,35,35), c(40,42,45), c(4,4,3), c(TRUE,FALSE,TRUE)) 33 | 34 | } 35 | -------------------------------------------------------------------------------- /man/calc_waterretention.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{calc_waterretention} 4 | \alias{calc_waterretention} 5 | \title{Calculate indicators for water retention in topsoil} 6 | \usage{ 7 | calc_waterretention( 8 | A_CLAY_MI, 9 | A_SAND_MI, 10 | A_SILT_MI, 11 | A_SOM_LOI, 12 | type = "plant available water", 13 | ptf = "Wosten1999" 14 | ) 15 | } 16 | \arguments{ 17 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 18 | 19 | \item{A_SAND_MI}{(numeric) The sand content of the soil (\%)} 20 | 21 | \item{A_SILT_MI}{(numeric) The silt content of the soil (\%)} 22 | 23 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (\%)} 24 | 25 | \item{type}{(character) The type of water retention index. Options include c('wilting point','field capacity','water holding capacity','plant available water','Ksat')} 26 | 27 | \item{ptf}{(character) Pedotransfer functions to calculate van Genuchten parameters. Options include c('Wosten1999', 'Wosten2001', 'Klasse')} 28 | } 29 | \value{ 30 | The function returns by default the amount of plant available water in the ploughing layer of the soil (in mm). A numeric value. 31 | If another type of output is selected, the function gives also the amount of water at 'wilting point' or 'field capacity' or 'water holding capacity'. 32 | Also the saturated permeability 'Ksat' can be selected. Units are always in mm, except for Water Holding Capacity (%) and Ksat. 33 | } 34 | \description{ 35 | This function calculates different kind of Water Retention Indices given the continuous pedotransferfunctions of Wosten et al. (2001) 36 | These include : 'wilting point','field capacity','water holding capacity','plant available water' and 'Ksat' 37 | } 38 | \examples{ 39 | calc_waterretention(A_CLAY_MI = 20.5,A_SAND_MI = 65,A_SILT_MI = 14.5,A_SOM_LOI = 3.5) 40 | calc_waterretention(A_CLAY_MI = 5,A_SAND_MI = 15,A_SILT_MI = 80,A_SOM_LOI = 6.5) 41 | calc_waterretention(A_CLAY_MI = 5,A_SAND_MI = 15,A_SILT_MI = 80,A_SOM_LOI = 6.5, 42 | type = 'water holding capacity') 43 | 44 | } 45 | \references{ 46 | Wosten et al. (2001) Pedotransfer functions: bridging the gap between available basic soil data and missing hydraulic characteristics. Journal of Hydrology 251, p123. 47 | } 48 | -------------------------------------------------------------------------------- /man/calc_waterstressindex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/wateravailability.R 3 | \name{calc_waterstressindex} 4 | \alias{calc_waterstressindex} 5 | \title{Calculate the Water Stress Index} 6 | \usage{ 7 | calc_waterstressindex(B_HELP_WENR, B_LU_BRP, B_GWL_CLASS, WSI = "waterstress") 8 | } 9 | \arguments{ 10 | \item{B_HELP_WENR}{(character) The soil type abbreviation, derived from 1:50.000 soil map} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_GWL_CLASS}{(character) The groundwater table class} 15 | 16 | \item{WSI}{(character) The type of Water Stress Index is required. Options: droughtstress, wetnessstress and the (combined) waterstress} 17 | } 18 | \value{ 19 | The yield depression (in \%) through wetness or drought stress (depending on the WSI selected). Numeric value. 20 | } 21 | \description{ 22 | This function calculates the Water Stress Index (estimating the yield depression as a function of water deficiency or surplus) 23 | } 24 | \examples{ 25 | \dontshow{data.table::setDTthreads(1)} 26 | calc_waterstressindex(B_HELP_WENR = 'ABkt',B_LU_BRP = 1019,B_GWL_CLASS = 'GtIV' 27 | , WSI = 'droughtstress') 28 | 29 | } 30 | \references{ 31 | STOWA (2005) Uitbreiding en Actualisering van de HELP-tabellen ten behoeve van het Waternood instrumentarium 32 | } 33 | -------------------------------------------------------------------------------- /man/calc_winderodibility.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/winderodibility.R 3 | \name{calc_winderodibility} 4 | \alias{calc_winderodibility} 5 | \title{Calculate indicator for wind erodibility} 6 | \usage{ 7 | calc_winderodibility(B_LU_BRP, A_CLAY_MI, A_SILT_MI) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 13 | 14 | \item{A_SILT_MI}{(numeric) The silt content of the soil (\%)} 15 | } 16 | \value{ 17 | The vulnerability of the soil for wind erosion. A numeric value. 18 | } 19 | \description{ 20 | This function calculates the risk for wind erodibility of soils, derived from Van Kerckhoven et al. (2009) and Ros & Bussink (2013) 21 | } 22 | \examples{ 23 | calc_winderodibility(B_LU_BRP = 265, A_CLAY_MI = 4, A_SILT_MI = 15) 24 | calc_winderodibility(B_LU_BRP = c(265,1019), A_CLAY_MI = c(4,18), A_SILT_MI = c(15,65)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/calc_workability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/workability.R 3 | \name{calc_workability} 4 | \alias{calc_workability} 5 | \title{Calculate indicator for workability} 6 | \usage{ 7 | calc_workability( 8 | A_CLAY_MI, 9 | A_SILT_MI, 10 | B_LU_BRP, 11 | B_SOILTYPE_AGR, 12 | B_GWL_GLG, 13 | B_GWL_GHG, 14 | B_GWL_ZCRIT, 15 | calcyieldloss = FALSE 16 | ) 17 | } 18 | \arguments{ 19 | \item{A_CLAY_MI}{(numeric) The clay content of the soil (\%)} 20 | 21 | \item{A_SILT_MI}{(numeric) The silt content of the soil (\%)} 22 | 23 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 24 | 25 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 26 | 27 | \item{B_GWL_GLG}{(numeric) The lowest groundwater level averaged over the most dry periods in 8 years in cm below ground level} 28 | 29 | \item{B_GWL_GHG}{(numeric) The highest groundwater level averaged over the most wet periods in 8 years in cm below ground level} 30 | 31 | \item{B_GWL_ZCRIT}{(numeric) The distance between ground level and groundwater level at which the groundwater can supply the soil surface with 2mm water per day (in cm)} 32 | 33 | \item{calcyieldloss}{(boolean) whether the function includes yield loss, options: TRUE or FALSE (default).} 34 | } 35 | \value{ 36 | The workability of a soil, expressed as a numeric value representing the relative season length that the soil can be managed by agricultural activities. 37 | } 38 | \description{ 39 | This function calculates the workability of soils, given as a value of relative season length between 0 and 1. 40 | A relative season length of 1 indicates that the water table is sufficiently low for the soil to be workable for the entire growing season required by the crop. 41 | The required ground water table for workability is determined by soil type and soil properties. Hydrological variables determine the groundwater table for each day of the year. 42 | The option calcyieldloss allows for calculation of yield loss based on the relative season length, differentiating in yield loss between six groups of crops 43 | Based on Huinink (2018) 44 | } 45 | \examples{ 46 | calc_workability(A_CLAY_MI = 18,A_SILT_MI = 25,B_LU_BRP = 265, 47 | B_SOILTYPE_AGR = 'dekzand',B_GWL_GLG = 145,B_GWL_GHG = 85,B_GWL_ZCRIT = 400, 48 | calcyieldloss = FALSE) 49 | calc_workability(18,25,265,'dekzand',145,85,400,FALSE) 50 | 51 | } 52 | \references{ 53 | Huinink (2018) Bodem/perceel geschiktheidsbeoordeling voor Landbouw, Bosbouw en Recreatie. BodemConsult-Arnhem 54 | } 55 | -------------------------------------------------------------------------------- /man/calc_zinc_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metals.R 3 | \name{calc_zinc_availability} 4 | \alias{calc_zinc_availability} 5 | \title{Calculate the availability of the metal Zinc} 6 | \usage{ 7 | calc_zinc_availability(B_LU_BRP, B_SOILTYPE_AGR, A_PH_CC, A_ZN_CC) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 13 | 14 | \item{A_PH_CC}{(numeric) The acidity of the soil, determined in 0.01M CaCl2 (-)} 15 | 16 | \item{A_ZN_CC}{The plant available Zn content, extracted with 0.01M CaCl2 (mg / kg)} 17 | } 18 | \value{ 19 | The function of the soil to supply zinc A numeric value. 20 | } 21 | \description{ 22 | This function calculates the availability of Zn for plant uptake 23 | } 24 | \examples{ 25 | calc_zinc_availability(B_LU_BRP = 265, B_SOILTYPE_AGR = 'dekzand',A_PH_CC = 4.5, A_ZN_CC = 3000) 26 | calc_zinc_availability(B_LU_BRP = 265, 'dekzand',4,3500) 27 | calc_zinc_availability(B_LU_BRP = c(1019,265), c('dekzand','rivierklei'),c(4.5,4.8),c(2500,4500)) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /man/cf_ind_importance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/evaluate.R 3 | \name{cf_ind_importance} 4 | \alias{cf_ind_importance} 5 | \title{Helper function to weight and correct the risk and scores} 6 | \usage{ 7 | cf_ind_importance(x) 8 | } 9 | \arguments{ 10 | \item{x}{The risk or score value to be weighted} 11 | } 12 | \value{ 13 | A transformed variable after applying a inverse weighing function so that lower values will gain more impact when applied in a weighed.mean function. A numeric value. 14 | } 15 | \description{ 16 | Helper function to weight and correct the risk and scores 17 | } 18 | \examples{ 19 | cf_ind_importance(x = 0.5) 20 | cf_ind_importance(x = c(0.1,0.5,1.5)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/column_description.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{column_description.obic} 5 | \alias{column_description.obic} 6 | \title{Column description for the OBIC} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 216 rows and 6 columns. 9 | } 10 | \usage{ 11 | column_description.obic 12 | } 13 | \description{ 14 | This table defines the columns used in the OBIC and which unit is used 15 | } 16 | \details{ 17 | \describe{ 18 | \item{column}{The column name used in OBIC} 19 | \item{type}{The type of column} 20 | \item{description_nl}{A description of the column in Dutch} 21 | \item{description_en}{A description of the column in English} 22 | \item{unit}{The unit used for this column} 23 | \item{method}{The method to measure/obtain the values for this column} 24 | } 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/crops.makkink.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{crops.makkink} 5 | \alias{crops.makkink} 6 | \title{Makkink correction factor table} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 24 rows and 13 columns. 9 | } 10 | \usage{ 11 | crops.makkink 12 | } 13 | \description{ 14 | This table contains the makkink correction factors for evapo-transpiration per month 15 | } 16 | \details{ 17 | \describe{ 18 | \item{crop_makkink}{Makkink crop category} 19 | \item{1}{Evapotranspiration correction factors for January} 20 | \item{2}{Evapotranspiration correction factors for February} 21 | \item{3}{Evapotranspiration correction factors for March} 22 | \item{4}{Evapotranspiration correction factors for April} 23 | \item{5}{Evapotranspiration correction factors for May} 24 | \item{6}{Evapotranspiration correction factors for June} 25 | \item{7}{Evapotranspiration correction factors for July} 26 | \item{8}{Evapotranspiration correction factors for August} 27 | \item{9}{Evapotranspiration correction factors for September} 28 | \item{10}{Evapotranspiration correction factors for October} 29 | \item{11}{Evapotranspiration correction factors for November} 30 | \item{12}{Evapotranspiration correction factors for December} 31 | } 32 | } 33 | \keyword{datasets} 34 | -------------------------------------------------------------------------------- /man/crops.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{crops.obic} 5 | \alias{crops.obic} 6 | \title{Linking table between crops and different functions in OBIC} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 521 rows and 22 columns. 9 | } 10 | \usage{ 11 | crops.obic 12 | } 13 | \description{ 14 | This table helps to link the different crops in the OBIC functions with the crops selected by the user 15 | } 16 | \details{ 17 | \describe{ 18 | \item{crop_code}{The BRP gewascode of the crop} 19 | \item{crop_name}{The name of the crop, in lower case} 20 | \item{crop_waterstress}{Classification linking for linking crops to waterstress.obic} 21 | \item{crop_intensity}{Whether crop is root/tuber crop, rest crop, or other.} 22 | \item{crop_eos}{Effective soil organic matter produced by the crop in kg/ha} 23 | \item{crop_eos_residue}{Effective soil organic matter from plant residues in kg/ha} 24 | \item{crop_category}{Classification of crop per land use type (arable, maize, grass, nature)} 25 | \item{crop_rotation}{Classification of crop to determine function within crop rotations} 26 | \item{crop_crumbleability}{The category for this crop at crumbleability} 27 | \item{crop_phosphate}{The category for this crop for evaluation phosphate availability} 28 | \item{crop_sealing}{The category for this crop at soil sealing} 29 | \item{crop_n}{The category for this crop for evaluation nitrogen} 30 | \item{crop_k}{The category for this crop for evaluation potassium} 31 | \item{crop_measure}{The category for this crop for evaluating measures} 32 | \item{nf_clay}{Allowed effective N dose on clay soils} 33 | \item{nf_sand.other}{Allowed effective N dose on sandy soils} 34 | \item{nf_sand.south}{Allowed effective N dose on sandy soils sensitive to leaching} 35 | \item{nf_loess}{Allowed effective N dose on loess soils} 36 | \item{nf_peat}{Allowed effective N dose on peat soils} 37 | \item{crop_name_scientific}{All-lower-case scientific name of the crop species. When crop is not species specific the genus of the crop is given} 38 | \item{crop_season}{Crop category for length growing season} 39 | \item{crop_makkink}{Crop category for makkink correction factors} 40 | } 41 | } 42 | \keyword{datasets} 43 | -------------------------------------------------------------------------------- /man/eval.crumbleability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crumbleability.R 3 | \docType{data} 4 | \name{eval.crumbleability} 5 | \alias{eval.crumbleability} 6 | \title{Coefficient table for evaluating crumbleability} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 16 rows and 4 columns. 9 | } 10 | \usage{ 11 | eval.crumbleability 12 | } 13 | \description{ 14 | This table contains the coefficients for evaluating the crumbleability. This table is used internally in \code{\link{ind_crumbleability}} 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/evaluate_logistic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/evaluate.R 3 | \name{evaluate_logistic} 4 | \alias{evaluate_logistic} 5 | \title{Evaluate using the general logistic function} 6 | \usage{ 7 | evaluate_logistic(x, b, x0, v, increasing = TRUE) 8 | } 9 | \arguments{ 10 | \item{x}{(numeric) The values of a calc function to be converted to an evaluation} 11 | 12 | \item{b}{(numeric) The growth rate} 13 | 14 | \item{x0}{(numeric) The offset of the x-axis} 15 | 16 | \item{v}{(numeric) Affects the growth rate near the maximum} 17 | 18 | \item{increasing}{(boolean) Should the evaluation increase (\code{TRUE}) with x or decrease (\code{FALSE})?} 19 | } 20 | \value{ 21 | A transformed variable after applying a logistic evaluation function. A numeric value. 22 | } 23 | \description{ 24 | This function evaluates the calculated values from an indicator using a general logistic function 25 | } 26 | \examples{ 27 | evaluate_logistic(x = 5, b = 2, x0 = 3, v = 2.6) 28 | evaluate_logistic(x = c(0.1,0.5,1.5,3.5), b = 2, x0 = 3, v = 2.6) 29 | 30 | } 31 | \references{ 32 | \url{https://en.wikipedia.org/wiki/Generalised_logistic_function} 33 | } 34 | -------------------------------------------------------------------------------- /man/evaluate_parabolic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/evaluate.R 3 | \name{evaluate_parabolic} 4 | \alias{evaluate_parabolic} 5 | \title{Evaluate using parabolic function with} 6 | \usage{ 7 | evaluate_parabolic(x, x.top) 8 | } 9 | \arguments{ 10 | \item{x}{(numeric) The values of a calc function to be converted to an evaluation} 11 | 12 | \item{x.top}{(numeric) The value at which x reaches the plateau} 13 | } 14 | \value{ 15 | A transformed variable after applying a parabolic evaluation function. A numeric value. 16 | } 17 | \description{ 18 | This function evaluates the calculated values from an indicator using a parabolic function. After the optimum is reached the it stays at its plateau. 19 | } 20 | \examples{ 21 | evaluate_parabolic(x = 5, x.top = 8) 22 | evaluate_parabolic(x = c(0.1,0.5,1.5,3.5), x.top = 6.5) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/format_aer.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_format_inputs.R 3 | \name{format_aer} 4 | \alias{format_aer} 5 | \title{Convert possible B_AER_CBS values to standardized values} 6 | \usage{ 7 | format_aer(B_AER_CBS) 8 | } 9 | \arguments{ 10 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 11 | } 12 | \value{ 13 | A standardized B_AER_CBS value as required for the OBIC functions. A character string. 14 | } 15 | \description{ 16 | This function formats information of Agricultural Economic Region so it can be understood by other OBIC functions 17 | } 18 | \examples{ 19 | format_aer(c("LG13","LG12")) 20 | format_aer(c("LG13","LG12",'Rivierengebied')) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/format_gwt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_format_inputs.R 3 | \name{format_gwt} 4 | \alias{format_gwt} 5 | \title{Convert possible B_GWL_CLASS values to standardized values} 6 | \usage{ 7 | format_gwt(B_GWL_CLASS) 8 | } 9 | \arguments{ 10 | \item{B_GWL_CLASS}{(character) Ground water table classes} 11 | } 12 | \value{ 13 | A standardized B_GWL_CLASS value as required for the OBIC functions. A character string. 14 | } 15 | \description{ 16 | This function formats ground water table information so it can be understood by other OBIC functions 17 | } 18 | \examples{ 19 | format_gwt(c('sVII', 'sVI')) 20 | format_gwt(c('sVII', 'sVI','GtII', 'GtI')) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/format_soilcompaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_format_inputs.R 3 | \name{format_soilcompaction} 4 | \alias{format_soilcompaction} 5 | \title{Convert possible B_SC_WENR values to standardized values} 6 | \usage{ 7 | format_soilcompaction(B_SC_WENR) 8 | } 9 | \arguments{ 10 | \item{B_SC_WENR}{(numeric and/or character) Data on soil compaction risk that may have to be converted to string} 11 | } 12 | \value{ 13 | A standardized B_GWL_CLASS value as required for the OBIC functions. A character string. 14 | } 15 | \description{ 16 | This function converts numeric values for B_SC_WENR to values used by other OBIC functions if numeric values are entered. 17 | } 18 | \examples{ 19 | format_soilcompaction(c('10', '11')) 20 | format_soilcompaction(c('2', '3',"Matig", "Groot")) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_aggregatestability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cec.R 3 | \name{ind_aggregatestability} 4 | \alias{ind_aggregatestability} 5 | \title{Calculate the indicator aggregate stability} 6 | \usage{ 7 | ind_aggregatestability(D_AS) 8 | } 9 | \arguments{ 10 | \item{D_AS}{(numeric) The value of aggregate stability calculated by \code{\link{calc_aggregatestability}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function aggregate stability. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the the aggregate stability of the soil by using the index calculated by \code{\link{calc_aggregatestability}} 17 | } 18 | \examples{ 19 | ind_aggregatestability(D_AS = 0.3) 20 | ind_aggregatestability(D_AS = c(0.3,0.6,0.9)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_bcs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/bodemconditiescore.R 3 | \name{ind_bcs} 4 | \alias{ind_bcs} 5 | \title{Calculate the indicator for BodemConditieScore} 6 | \usage{ 7 | ind_bcs(D_BCS) 8 | } 9 | \arguments{ 10 | \item{D_BCS}{(numeric) The value of BCS calculated by \code{\link{calc_bcs}}} 11 | } 12 | \value{ 13 | The evaluated score for the Visual Soil Assessment. A numeric value between 0 and 50. 14 | } 15 | \description{ 16 | This function calculates the final score for the BodemConditieScore by using the scores calculated by \code{\link{calc_bcs}} 17 | } 18 | \examples{ 19 | ind_bcs(D_BCS = 12) 20 | ind_bcs(D_BCS = c(12,18,26,30)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_cec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cec.R 3 | \name{ind_cec} 4 | \alias{ind_cec} 5 | \title{Calculate the indicator for soil fertility given the CEC} 6 | \usage{ 7 | ind_cec(D_CEC) 8 | } 9 | \arguments{ 10 | \item{D_CEC}{(numeric) The value of CEC calculated by \code{\link{calc_cec}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to buffer cations. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function estimate how much cations can be buffer by soil, being calculated by \code{\link{calc_cec}} 17 | } 18 | \examples{ 19 | ind_cec(D_CEC = 85) 20 | ind_cec(D_CEC = c(85,135,385)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_compaction.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/compaction.R 3 | \name{ind_compaction} 4 | \alias{ind_compaction} 5 | \title{Calculate indicator for subsoil compaction} 6 | \usage{ 7 | ind_compaction(B_SC_WENR) 8 | } 9 | \arguments{ 10 | \item{B_SC_WENR}{(character) The risk for subsoil compaction as derived from risk assessment study of Van den Akker (2006)} 11 | } 12 | \value{ 13 | The evaluated score for the soil function for subsoil compaction. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the risk for soil compaction of the subsoil. 17 | derived from van den Akker et al. (2013) Risico op ondergrondverdichting in het landelijk gebied in kaart, 18 | Alterra-rapport 2409, Alterra, Wageningen University and Research Centre, 19 | } 20 | \examples{ 21 | ind_compaction(B_SC_WENR = 'Zeer groot') 22 | ind_compaction(B_SC_WENR = c('Zeer groot','Van nature dicht')) 23 | 24 | } 25 | \references{ 26 | Akker et al. (2013) Risico op ondergrondverdichting in het landelijk gebied in kaart, 27 | Alterra-rapport 2409, Alterra, Wageningen University and Research Centre. 28 | } 29 | -------------------------------------------------------------------------------- /man/ind_copper.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metals.R 3 | \name{ind_copper} 4 | \alias{ind_copper} 5 | \title{Calculate the indicator for Cu-availability} 6 | \usage{ 7 | ind_copper(D_CU, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_CU}{(numeric) The value of Cu-index calculated by \code{\link{calc_copper_availability}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to supply copper for crop uptake. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for the the Cu availability in soil by using the Cu-index as calculated by \code{\link{calc_copper_availability}} 19 | } 20 | \examples{ 21 | ind_copper(D_CU = 125, B_LU_BRP = 265) 22 | ind_copper(D_CU = c(125,335), B_LU_BRP = c(1019,256)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_crumbleability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/crumbleability.R 3 | \name{ind_crumbleability} 4 | \alias{ind_crumbleability} 5 | \title{Calculate the indicator for crumbleability} 6 | \usage{ 7 | ind_crumbleability(D_CR, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_CR}{(numeric) The value of crumbleability calculated by \code{\link{calc_crumbleability}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | } 14 | \value{ 15 | The evaluated score for the soil function crumbleability. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for crumbleability. The crumbleability is calculated by \code{\link{calc_crumbleability}} 19 | } 20 | \examples{ 21 | ind_crumbleability(D_CR = 3, B_LU_BRP = 1910) 22 | ind_crumbleability(D_CR = c(2,6), B_LU_BRP = c(1910,1910)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_gw_recharge.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/groundwater_recharge.R 3 | \name{ind_gw_recharge} 4 | \alias{ind_gw_recharge} 5 | \title{Calculate groundwater recharge of a soil} 6 | \usage{ 7 | ind_gw_recharge(B_LU_BRP, D_PSP, D_WRI_K, I_P_SE, I_P_CO, B_DRAIN, B_GWL_CLASS) 8 | } 9 | \arguments{ 10 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 11 | 12 | \item{D_PSP}{(numeric) The precipitation surplus per crop calculated by \code{\link{calc_psp}}} 13 | 14 | \item{D_WRI_K}{(numeric) The value for top soil permeability (cm/d) as calculated by \code{\link{calc_permeability}}} 15 | 16 | \item{I_P_SE}{(numeric) The indicator value for soil sealing} 17 | 18 | \item{I_P_CO}{(numeric) The indicator value for occurrence of subsoil compaction} 19 | 20 | \item{B_DRAIN}{(boolean) Are drains installed to drain the field (options: yes or no)} 21 | 22 | \item{B_GWL_CLASS}{(character) The groundwater table class} 23 | } 24 | \value{ 25 | The evaluated score for the soil function to improve groundwater recharge. A numeric value between 0 and 1. 26 | } 27 | \description{ 28 | This function calculates an index score for groundwater storage based on precipitation surplus, infiltration at saturation, sealing risk, drainage and subsoil compaction 29 | } 30 | \examples{ 31 | ind_gw_recharge(B_LU_BRP = 265,D_PSP = 200, D_WRI_K = 10, I_P_SE = 0.6, I_P_CO = 0.9, 32 | B_DRAIN = FALSE, B_GWL_CLASS = 'GtV') 33 | ind_gw_recharge(B_LU_BRP = 233, D_PSP = 400, D_WRI_K = 10, I_P_SE = 0.4, I_P_CO = 0.2, 34 | B_DRAIN = TRUE, B_GWL_CLASS = 'GtII') 35 | 36 | } 37 | -------------------------------------------------------------------------------- /man/ind_magnesium.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/magnesium.R 3 | \name{ind_magnesium} 4 | \alias{ind_magnesium} 5 | \title{Calculate the indicator for Magnesium} 6 | \usage{ 7 | ind_magnesium(D_MG, B_LU_BRP, B_SOILTYPE_AGR) 8 | } 9 | \arguments{ 10 | \item{D_MG}{(numeric) The value of Mg calculated by \code{\link{calc_magnesium_availability}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | } 16 | \value{ 17 | The evaluated score for the soil function to supply magnesium for crop uptake. A numeric value. 18 | } 19 | \description{ 20 | This function calculates the indicator for the the Magnesium content of the soil by using the Mg-availability calculated by \code{\link{calc_magnesium_availability}} 21 | } 22 | \examples{ 23 | ind_magnesium(D_MG = 125, B_LU_BRP = 265, B_SOILTYPE_AGR = 'dekzand') 24 | ind_magnesium(D_MG = c(125,35), B_LU_BRP = c(265,256), B_SOILTYPE_AGR = rep('dekzand',2)) 25 | 26 | } 27 | -------------------------------------------------------------------------------- /man/ind_man_ess.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/management.R 3 | \name{ind_man_ess} 4 | \alias{ind_man_ess} 5 | \title{Calculate the indicator for sustainable management given a required ecoystem service} 6 | \usage{ 7 | ind_man_ess(D_MAN, B_LU_BRP, B_SOILTYPE_AGR, type) 8 | } 9 | \arguments{ 10 | \item{D_MAN}{(numeric) The value of Sustainable Management calculated by \code{\link{calc_man_ess}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | 16 | \item{type}{(character) type of ecosystem service to evaluate the impact of soil management. Options: I_M_SOILFERTILITY, I_M_CLIMATE, I_M_WATERQUALITY, and I_M_BIODIVERSITY} 17 | } 18 | \value{ 19 | The evaluated score for the evaluated soil management for a specific ecosystem service. A numeric value between 0 and 1. 20 | This is done for the following ESS: I_M_SOILFERTILITY, I_M_CLIMATE, I_M_WATERQUALITY and I_M_BIODIVERSITY. 21 | } 22 | \description{ 23 | This function calculates the the sustainability of strategic management options for a given ecoystem service as calculated by \code{\link{calc_man_ess}} 24 | The main source of this indicator is developed for Label Duurzaam Bodembeheer (Van der Wal, 2016) 25 | } 26 | \examples{ 27 | ind_man_ess(D_MAN = 3.5,B_LU_BRP = 1019, B_SOILTYPE_AGR = 'dekzand',type = 'I_M_SOILFERTILITY') 28 | ind_man_ess(D_MAN = c(2,6,15), B_LU_BRP = c(1019,256,1019),B_SOILTYPE_AGR = rep('dekzand',3), 29 | type = 'I_M_SOILFERTILITY') 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/ind_management.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/management.R 3 | \name{ind_management} 4 | \alias{ind_management} 5 | \title{Calculate the indicator for sustainable management} 6 | \usage{ 7 | ind_management(D_MAN, B_LU_BRP, B_SOILTYPE_AGR) 8 | } 9 | \arguments{ 10 | \item{D_MAN}{(numeric) The value of Sustainable Management calculated by \code{\link{calc_management}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | } 16 | \value{ 17 | The evaluated score for the evaluated soil management given the Label Sustainable Soil Management. A numeric value between 0 and 1. 18 | } 19 | \description{ 20 | This function calculates the the sustainability of strategic management options as calculated by \code{\link{calc_management}} 21 | The main source of this indicator is developed for Label Duurzaam Bodembeheer (Van der Wal, 2016) 22 | } 23 | \details{ 24 | The current function allows a maximum score of 18 points for arable systems, 12 for maize 25 | and 10 for grass (non-peat), 17 for grass on peat, and 4 for nature. 26 | } 27 | \examples{ 28 | ind_management(D_MAN = 15,B_LU_BRP = 1019, B_SOILTYPE_AGR = 'dekzand') 29 | ind_management(D_MAN = c(2,6,15), B_LU_BRP = c(1019,256,1019),B_SOILTYPE_AGR = rep('dekzand',3)) 30 | 31 | } 32 | -------------------------------------------------------------------------------- /man/ind_n_efficiency.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nitrogen_efficiency.R 3 | \name{ind_n_efficiency} 4 | \alias{ind_n_efficiency} 5 | \title{Calculate an indicator value for nitrogen use efficiency and leaching based on N surplus} 6 | \usage{ 7 | ind_n_efficiency(D_NLEACH, leaching_to = "gw") 8 | } 9 | \arguments{ 10 | \item{D_NLEACH}{(numeric) The value of N leaching calculated by \code{\link{calc_n_efficiency}}} 11 | 12 | \item{leaching_to}{(character) whether it evaluates N leaching to groundwater ("gw") or to surface water ("sw")} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to enhance the nitrogen use efficiency. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function gives an indicator value for nitrogen use efficiency calculated by \code{\link{calc_n_efficiency}}, this function makes use of \code{\link{ind_nretention}} 19 | } 20 | \examples{ 21 | ind_n_efficiency(D_NLEACH = 50, leaching_to = 'gw') 22 | ind_n_efficiency(D_NLEACH = c(5,15,25,75), leaching_to = 'sw') 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_nematodes_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nematode.R 3 | \name{ind_nematodes_list} 4 | \alias{ind_nematodes_list} 5 | \title{Calculate indicator for plant parasitic nematodes} 6 | \usage{ 7 | ind_nematodes_list(A_NEMA) 8 | } 9 | \arguments{ 10 | \item{A_NEMA}{(data.table) Long data table with the counted nematodes of a parcel.} 11 | } 12 | \value{ 13 | The evaluated score for the soil function for nematode community. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the presence of plant parasitic nematodes. All nematodes present in a sample are used. 17 | A subset of nematodes is weighted in the set regardless of their presence. 18 | } 19 | \examples{ 20 | 21 | \dontrun{ 22 | ind_nematodes_list(data.table(species = 'Cysteaaltjes',count = 200)) 23 | ind_nematodes_list(data.table(species = c('Cysteaaltjes','Ditylenchus dipsaci'), 24 | count = c(200,7))) 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/ind_nitrogen.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nitrogen.R 3 | \name{ind_nitrogen} 4 | \alias{ind_nitrogen} 5 | \title{Calculate the indicator for NLV} 6 | \usage{ 7 | ind_nitrogen(D_NLV, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_NLV}{(numeric) The value of NLV calculated by \code{\link{calc_nlv}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to supply nitrogen for crop uptake. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for the the nitrogen content of the soil by using the NLV calculated by \code{\link{calc_nlv}} 19 | } 20 | \examples{ 21 | ind_nitrogen(D_NLV = 85,B_LU_BRP = 256) 22 | ind_nitrogen(D_NLV = c(150,65,35),B_LU_BRP = c(256,1019,1019)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_nretention.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/nretention.r 3 | \name{ind_nretention} 4 | \alias{ind_nretention} 5 | \title{Calculate the indicator for N retention for groundwater or surface water} 6 | \usage{ 7 | ind_nretention(D_NW, leaching_to) 8 | } 9 | \arguments{ 10 | \item{D_NW}{(numeric) The value of N leaching calculated by \code{\link{calc_nleach}}} 11 | 12 | \item{leaching_to}{(character) whether it evaluates N leaching to groundwater ("gw") or to surface water ("ow")} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to supply nitrogen for crop uptake. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for the N retention of the soil by using the N leaching to groundwater or surface water calculated by \code{\link{calc_nleach}} 19 | } 20 | \examples{ 21 | ind_nretention(D_NW = 15,leaching_to = 'gw') 22 | ind_nretention(D_NW = c(.2,5.6,15.6),leaching_to = 'ow') 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_permeability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/groundwater_recharge.R 3 | \name{ind_permeability} 4 | \alias{ind_permeability} 5 | \title{Calculate the indicator score for the permeability of the top soil} 6 | \usage{ 7 | ind_permeability(D_WRI_K) 8 | } 9 | \arguments{ 10 | \item{D_WRI_K}{(numeric) The value for top soil permeability (cm/d) as calculated by \code{\link{calc_permeability}}} 11 | } 12 | \description{ 13 | This function calculates the indicator score for the permeability of the top soil 14 | } 15 | -------------------------------------------------------------------------------- /man/ind_pesticide_leaching.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pesticides.R 3 | \name{ind_pesticide_leaching} 4 | \alias{ind_pesticide_leaching} 5 | \title{Calculate an indicator score for pesticide leaching} 6 | \usage{ 7 | ind_pesticide_leaching(D_PESTICIDE) 8 | } 9 | \arguments{ 10 | \item{D_PESTICIDE}{The fraction of pesticide leached compared to the worst case scenario} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to minimize pesticide leaching. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator value for pesticide leaching from a soil 17 | } 18 | \examples{ 19 | ind_pesticide_leaching(D_PESTICIDE = 0.7) 20 | ind_pesticide_leaching(D_PESTICIDE = c(0.4,0.6,0.8,1)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_ph.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ph.R 3 | \name{ind_ph} 4 | \alias{ind_ph} 5 | \title{Calculate the indicator for pH} 6 | \usage{ 7 | ind_ph(D_PH_DELTA) 8 | } 9 | \arguments{ 10 | \item{D_PH_DELTA}{(numeric) The pH difference with the optimal pH.} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to buffer pH within optimum range for crop growth. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the pH of the soil by the difference with the optimum pH. This is calculated in \code{\link{calc_ph_delta}}. 17 | } 18 | \examples{ 19 | ind_ph(D_PH_DELTA = 0.8) 20 | ind_ph(D_PH_DELTA = c(0.2,0.6,0.8,1.5)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_phosphate_availability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/phosphate_availability.R 3 | \name{ind_phosphate_availability} 4 | \alias{ind_phosphate_availability} 5 | \title{Calculate the indicator for the the phosphate availability} 6 | \usage{ 7 | ind_phosphate_availability(D_PBI) 8 | } 9 | \arguments{ 10 | \item{D_PBI}{(numeric) The value of phosphate availability calculated by \code{\link{calc_phosphate_availability}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to supply and buffer phosphorus for crop uptake. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the phosphate availability calculated by \code{\link{calc_phosphate_availability}} 17 | } 18 | \examples{ 19 | ind_phosphate_availability(D_PBI = 3.5) 20 | ind_phosphate_availability(D_PBI = c(0.5,0.8,2.5,5,15,35,75)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_pmn.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pmn.R 3 | \name{ind_pmn} 4 | \alias{ind_pmn} 5 | \title{Calculate the indicator for microbial biological activity} 6 | \usage{ 7 | ind_pmn(D_PMN) 8 | } 9 | \arguments{ 10 | \item{D_PMN}{(numeric) The value of PMN calculated by \code{\link{calc_pmn}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function reflecting the microbial activity of a soil (specifically the potentially mineralizable N rate). A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator that assess the microbial biological activity of the soil by using the PMN calculated by \code{\link{calc_pmn}} 17 | } 18 | \examples{ 19 | ind_pmn(D_PMN = 24) 20 | ind_pmn(D_PMN = c(54,265)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_potassium.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/potassium.R 3 | \name{ind_potassium} 4 | \alias{ind_potassium} 5 | \title{Calculate the indicator for Potassium Availability} 6 | \usage{ 7 | ind_potassium(D_K, B_LU_BRP, B_SOILTYPE_AGR, A_SOM_LOI) 8 | } 9 | \arguments{ 10 | \item{D_K}{(numeric) The value of K-index calculated by \code{\link{calc_potassium_availability}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The agricultural type of soil} 15 | 16 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil (\%)} 17 | } 18 | \value{ 19 | The evaluated score for the soil function to supply potassium for crop uptake. A numeric value between 0 and 1. 20 | } 21 | \description{ 22 | This function calculates the indicator for the the Potassium Availability of the soil by using the K-availability calculated by \code{\link{calc_potassium_availability}} 23 | } 24 | \examples{ 25 | ind_potassium(D_K = 4.5,B_LU_BRP = 256,B_SOILTYPE_AGR='dekzand',A_SOM_LOI=4) 26 | ind_potassium(c(2.5,3.5,6.5),c(256,1019,1019),rep('dekzand',3),c(3.5,4.5,7.5)) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/ind_psp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/precipitation_surplus.R 3 | \name{ind_psp} 4 | \alias{ind_psp} 5 | \title{Calculate indicator for precipitation surplus} 6 | \usage{ 7 | ind_psp(D_PSP, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_PSP}{(numeric) The precipitation surplus per crop calculated by \code{\link{calc_psp}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 13 | } 14 | \description{ 15 | This function calculates the indicator value for precipitation surplus 16 | } 17 | -------------------------------------------------------------------------------- /man/ind_resistance.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/resistance.R 3 | \name{ind_resistance} 4 | \alias{ind_resistance} 5 | \title{Calculate indicator for soil resistance} 6 | \usage{ 7 | ind_resistance(A_SOM_LOI) 8 | } 9 | \arguments{ 10 | \item{A_SOM_LOI}{(numeric) The organic matter content of the soil in percentage} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to resist diseases. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the resistance of the soil against diseases and is indicated by the amount of soil life. 17 | } 18 | \examples{ 19 | ind_resistance(A_SOM_LOI = 3.5) 20 | ind_resistance(A_SOM_LOI = c(3.5,5.5,15,25)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_sealing.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sealing.R 3 | \name{ind_sealing} 4 | \alias{ind_sealing} 5 | \title{Calculate the soil sealing indicator} 6 | \usage{ 7 | ind_sealing(D_SE, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_SE}{(numeric) The value of soil sealing calculated by \code{\link{calc_sealing_risk}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to avoid crop damage due to sealing of surface. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for the soil sealing calculated by \code{\link{calc_sealing_risk}} 19 | } 20 | \examples{ 21 | ind_sealing(D_SE = 15,B_LU_BRP = 256) 22 | ind_sealing(D_SE = c(5,15,35),B_LU_BRP = c(1019,1019,1019)) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/ind_sulfur.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sulfur.R 3 | \name{ind_sulfur} 4 | \alias{ind_sulfur} 5 | \title{Calculate the indicator for SLV} 6 | \usage{ 7 | ind_sulfur(D_SLV, B_LU_BRP, B_SOILTYPE_AGR, B_AER_CBS) 8 | } 9 | \arguments{ 10 | \item{D_SLV}{(numeric) The value of SLV calculated by \code{\link{calc_slv}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | 16 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 17 | } 18 | \value{ 19 | The evaluated score for the soil function to supply sulfur for crop uptake. A numeric value between 0 and 1. 20 | } 21 | \description{ 22 | This function calculates the indicator for the the S-index by using the SLV calculated by \code{\link{calc_slv}} 23 | } 24 | \examples{ 25 | ind_sulfur(D_SLV = 15,B_LU_BRP = 256,B_SOILTYPE_AGR = 'dekzand',B_AER_CBS = 'Rivierengebied') 26 | ind_sulfur(c(10,15,35),c(256,1019,1019),rep('rivierklei',3),rep('Rivierengebied',3)) 27 | 28 | } 29 | -------------------------------------------------------------------------------- /man/ind_sulpher.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sulfur.R 3 | \name{ind_sulpher} 4 | \alias{ind_sulpher} 5 | \title{Calculate the indicator for SLV (deprecated)} 6 | \usage{ 7 | ind_sulpher(D_SLV, B_LU_BRP, B_SOILTYPE_AGR, B_AER_CBS) 8 | } 9 | \arguments{ 10 | \item{D_SLV}{(numeric) The value of SLV calculated by \code{\link{calc_slv}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code (gewascode) from the BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) The type of soil} 15 | 16 | \item{B_AER_CBS}{(character) The agricultural economic region in the Netherlands (CBS, 2016)} 17 | } 18 | \value{ 19 | The evaluated score for the soil function to supply sulfur for crop uptake. A numeric value between 0 and 1. 20 | } 21 | \description{ 22 | This function calculates the indicator for the the S-index by using the SLV calculated by \code{\link{calc_slv}} 23 | } 24 | \details{ 25 | Pl 26 | } 27 | \examples{ 28 | ind_sulpher(D_SLV = 15,B_LU_BRP = 256,B_SOILTYPE_AGR = 'dekzand', 29 | B_AER_CBS = 'Rivierengebied') 30 | ind_sulpher(c(10,15,35),c(256,1019,1019),rep('rivierklei',3),rep('Rivierengebied',3)) 31 | 32 | } 33 | -------------------------------------------------------------------------------- /man/ind_waterretention.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{ind_waterretention} 4 | \alias{ind_waterretention} 5 | \title{Calculate indicator for Water Retention index} 6 | \usage{ 7 | ind_waterretention(D_P_WRI, type = "plant available water") 8 | } 9 | \arguments{ 10 | \item{D_P_WRI}{(numeric) The value for Water Retention index (WRI) as calculated by \code{\link{calc_waterretention}}} 11 | 12 | \item{type}{(character) The type of water retention index. Options include c('wilting point','field capacity','water holding capacity','plant available water','Ksat')} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to retain and buffer water. Depending on the "type" chosen, the soil is evaluated for 'wilting point','field capacity','water holding capacity','plant available water' or 'Ksat'. 16 | Output is a numeric value varying between 0 and 1. 17 | } 18 | \description{ 19 | This function evaluates different Water Retention Indices. 20 | These include : 'wilting point','field capacity','water holding capacity','plant available water' and 'Ksat' 21 | } 22 | \examples{ 23 | ind_waterretention(D_P_WRI = 75) 24 | ind_waterretention(D_P_WRI = c(15,50,75,150)) 25 | ind_waterretention(D_P_WRI = c(0.1,0.2,0.5,0.8), type = 'water holding capacity') 26 | 27 | } 28 | -------------------------------------------------------------------------------- /man/ind_waterstressindex.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/wateravailability.R 3 | \name{ind_waterstressindex} 4 | \alias{ind_waterstressindex} 5 | \title{Calculate the Water Stress Index} 6 | \usage{ 7 | ind_waterstressindex(D_WSI) 8 | } 9 | \arguments{ 10 | \item{D_WSI}{(numeric) The value of WSI calculated by \code{\link{calc_waterstressindex}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to resist drought or wetness stress by crops. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the risk for yield depression due to drought, an excess of water or a combination of both. The WSI is calculated by \code{\link{calc_waterstressindex}} 17 | } 18 | \examples{ 19 | ind_waterstressindex(D_WSI = 45) 20 | ind_waterstressindex(D_WSI = c(5,15,25,35)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_winderodibility.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/winderodibility.R 3 | \name{ind_winderodibility} 4 | \alias{ind_winderodibility} 5 | \title{Calculate indicator for wind erodibility} 6 | \usage{ 7 | ind_winderodibility(D_P_DU) 8 | } 9 | \arguments{ 10 | \item{D_P_DU}{(numeric) The value for wind erodibility factor (WEF) as calculated by \code{\link{calc_winderodibility}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to avoid soil damage due to wind erosion. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the resistance of the soil against wind erosion. 17 | } 18 | \examples{ 19 | ind_winderodibility(D_P_DU = 0.85) 20 | ind_winderodibility(D_P_DU = c(0.15,0.6,0.9)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/ind_workability.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/workability.R 3 | \name{ind_workability} 4 | \alias{ind_workability} 5 | \title{Calculate indicator for workability} 6 | \usage{ 7 | ind_workability(D_WO, B_LU_BRP) 8 | } 9 | \arguments{ 10 | \item{D_WO}{(numeric) The value of the relative (workable) season length calculated by \code{\link{calc_workability}}} 11 | 12 | \item{B_LU_BRP}{(numeric) The crop code from the BRP} 13 | } 14 | \value{ 15 | The evaluated score for the soil function to allow the soil to be managed by agricultural activities. A numeric value between 0 and 1. 16 | } 17 | \description{ 18 | This function calculates the indicator for the workability of the soil expressed as the period in which the soil can be worked without 19 | inflicting structural damage that cannot be restored by the regular management on the farm. 20 | } 21 | \examples{ 22 | ind_workability(D_WO = 0.85,B_LU_BRP = 256) 23 | ind_workability(D_WO = c(0.15,0.6,0.9),B_LU_BRP = c(256,1019,1019)) 24 | 25 | } 26 | -------------------------------------------------------------------------------- /man/ind_zinc.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/metals.R 3 | \name{ind_zinc} 4 | \alias{ind_zinc} 5 | \title{Calculate the indicator for Zn-availability} 6 | \usage{ 7 | ind_zinc(D_ZN) 8 | } 9 | \arguments{ 10 | \item{D_ZN}{(numeric) The value of Zn-index calculated by \code{\link{calc_zinc_availability}}} 11 | } 12 | \value{ 13 | The evaluated score for the soil function to supply zinc for crop uptake. A numeric value between 0 and 1. 14 | } 15 | \description{ 16 | This function calculates the indicator for the the Zn availability in soil by using the Zn-index as calculated by \code{\link{calc_zinc_availability}} 17 | } 18 | \examples{ 19 | ind_zinc(D_ZN = 45) 20 | ind_zinc(D_ZN = c(12.5,35,65)) 21 | 22 | } 23 | -------------------------------------------------------------------------------- /man/management.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{management.obic} 5 | \alias{management.obic} 6 | \title{Relational table linking soil management measures to ecosystem services} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 15 rows and 6 columns. 9 | } 10 | \usage{ 11 | management.obic 12 | } 13 | \description{ 14 | This table assigns which measures positively contribute to the ecosystem services included 15 | } 16 | \details{ 17 | \describe{ 18 | \item{measure}{The name of measure} 19 | \item{I_M_SOILFERTILITY}{integrated soil management indicator for soil fertility} 20 | \item{I_M_CLIMATE}{integrated soil management indicator for soil carbon sequestration} 21 | \item{I_M_WATERQUALITY}{integrated soil management indicator for water quality} 22 | \item{I_M_BIODIVERSITY}{Integrated soil management indicator for soil biodiversity} 23 | } 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/nema.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{nema.obic} 5 | \alias{nema.obic} 6 | \title{Nematode table} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 78 rows and 7 columns. 9 | } 10 | \usage{ 11 | nema.obic 12 | } 13 | \description{ 14 | This table contains information uses for calculations on nematode species counts 15 | } 16 | \details{ 17 | \describe{ 18 | \item{geel}{The intermediate infestation severity count} 19 | \item{rood}{The count at which a severe infestation is present} 20 | \item{species}{The species or sometimes genera of the plant parasitic nematode} 21 | \item{standard}{A boolean indicating whether the species should always be used in calculating the indicator score, regardless of the number of nematodes} 22 | \item{b}{Growth rate (b) for the evaluate_logistics function} 23 | \item{v}{v for the evaluate_logistics function, affects the growth rate near the maximum} 24 | } 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/nleach_table.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{nleach_table} 5 | \alias{nleach_table} 6 | \title{Table with fractions of excess N which runs off to groundwater and surface water} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 198 rows and 7 columns. 9 | } 10 | \usage{ 11 | nleach_table 12 | } 13 | \description{ 14 | This table contains the fractions of N overshot which runs off to groundwater / surface water, per soil type, crop type, and groundwater table 15 | } 16 | \details{ 17 | \describe{ 18 | \item{gewas}{crop type} 19 | \item{bodem}{soil type} 20 | \item{ghg}{Lower value for groundwater table (cm-mv)} 21 | \item{glg}{Upper value for groundwater table (cm-mv)} 22 | \item{B_GT}{grondwatertrap} 23 | \item{nf}{Original values of N run-off fraction to surface water (kg N drain/ha/year per kg N overschot/ha/year) or groundwater (mg NO3/L per kg N overschot/ha/year)} 24 | \item{leaching_to-set}{Tells if leaching to ground water or surface water)} 25 | } 26 | } 27 | \keyword{datasets} 28 | -------------------------------------------------------------------------------- /man/obic_evalmeasure.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_recommendations.R 3 | \name{obic_evalmeasure} 4 | \alias{obic_evalmeasure} 5 | \title{Evaluate effects of measures} 6 | \usage{ 7 | obic_evalmeasure(dt.score, extensive = FALSE) 8 | } 9 | \arguments{ 10 | \item{dt.score}{(data.table) containing all indicators and scores of a single field} 11 | 12 | \item{extensive}{(boolean) whether the output table includes evaluation scores of each measures (TRUE)} 13 | } 14 | \description{ 15 | This function quantifies the effects of 11 soil measures on the OBI score 16 | } 17 | -------------------------------------------------------------------------------- /man/obic_farm.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic.R 3 | \name{obic_farm} 4 | \alias{obic_farm} 5 | \title{Calculate the Open Bodem Index score for a series of fields belonging to a farm} 6 | \usage{ 7 | obic_farm(dt) 8 | } 9 | \arguments{ 10 | \item{dt}{(data.table) A data.table containing the data of the fields to calculate the OBI} 11 | } 12 | \value{ 13 | The output of the Open Bodem Index Calculator for a series of agricultural fields belonging to a single farm. 14 | Depending on the output type, different output objects can be returned. 15 | These include the estimated OBI scores (both total and aggregated subscores), the value of the underling indicators as well the possible recommendations to improve the soil quality. 16 | The output is a list with field properties as well as aggregated farm properties 17 | } 18 | \description{ 19 | This functions wraps the functions of the OBIC into one main function to calculate the score for Open Bodem Index (OBI). 20 | In contrast to obic_field, this wrapper uses a data.table as input. 21 | } 22 | \details{ 23 | The data.table should contain all required inputs for soil properties needed to calculate OBI score. Management information is optional as well as the observations from the visual soil assessment. 24 | The threshold values per category of soil functions need to have an equal length, with fractions defining the class boundaries in increasing order. 25 | The lowest boundary value (zero) is not needed. 26 | } 27 | \examples{ 28 | 29 | \dontrun{ 30 | obic_farm(dt = data.table(B_SOILTYPE_AGR = 'rivierklei',B_GWL_CLASS = "II", 31 | B_GWL_GLG = 75,B_GWL_GHG = 10, 32 | B_GWL_ZCRIT = 50,B_SC_WENR = '2',B_HELP_WENR = "MOb72",B_AER_CBS = 'LG01', 33 | B_LU_BRP = c( 1010, 1010,263,263, 263,265,265,265),A_SOM_LOI = 3.91,A_SAND_MI = 66.3, 34 | A_SILT_MI = 22.8,A_CLAY_MI = 7.8,A_PH_CC = 5.4,A_N_RT = 1528.33,A_CN_FR = 13.02, 35 | A_S_RT = 321.26,A_N_PMN = 63.3,A_P_AL = 50.2,A_P_CC = 2.9,A_P_WA = 50.5, 36 | A_CEC_CO = 56.9,A_CA_CO_PO = 66.87,A_MG_CO_PO = 13.97,A_K_CO_PO = 3.06, 37 | A_K_CC = 58.6,A_MG_CC = 77.53,A_MN_CC = 7586.61,A_ZN_CC = 726.2,A_CU_CC = 68.8, 38 | A_C_BCS = 1,A_CC_BCS = 1,A_GS_BCS = 1,A_P_BCS = 1,A_RD_BCS = 1,A_EW_BCS = 1, 39 | A_SS_BCS = 1,A_RT_BCS = 1,A_SC_BCS = 1,M_COMPOST = 0,M_GREEN = FALSE,M_NONBARE =FALSE, 40 | M_EARLYCROP = FALSE,M_SLEEPHOSE = FALSE,M_DRAIN = FALSE,M_DITCH = FALSE, 41 | M_UNDERSEED = FALSE,M_LIME = FALSE,M_MECHWEEDS = FALSE,M_NONINVTILL = FALSE, 42 | M_PESTICIDES_DST = FALSE,M_SOLIDMANURE = FALSE,M_SSPM = FALSE,M_STRAWRESIDUE = FALSE)) 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /man/obic_field_dt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic.R 3 | \name{obic_field_dt} 4 | \alias{obic_field_dt} 5 | \title{Calculate the Open Bodem Index score for a data table} 6 | \usage{ 7 | obic_field_dt(dt, output = "all") 8 | } 9 | \arguments{ 10 | \item{dt}{(data.table) A data.table containing the data of the fields to calculate the OBI} 11 | 12 | \item{output}{(character) An optional argument to select output: obic_score, scores, indicators, recommendations, or all. (default = all)} 13 | } 14 | \value{ 15 | The output of the Open Bodem Index Calculator for a specific agricultural field. 16 | Depending on the output type, different output objects can be returned. 17 | These include the estimated OBI scores (both total and aggregated subscores), the value of the underling indicators as well the possible recommendations to improve the soil quality. 18 | The output is always a data.table. 19 | } 20 | \description{ 21 | This functions wraps the functions of the OBIC into one main function to calculate the score for Open Bodem Index (OBI). 22 | In contrast to obic_field, this wrapper can handle a data.table as input. 23 | Multiple sites (distinguished in the column 'ID') can be simulated simultaneously. 24 | } 25 | \examples{ 26 | 27 | \dontrun{ 28 | obic_field_dt(data.table(B_SOILTYPE_AGR = 'rivierklei',B_GWL_CLASS = "II", 29 | B_GWL_GLG = 75,B_GWL_GHG = 10, 30 | B_GWL_ZCRIT = 50,B_SC_WENR = '2',B_HELP_WENR = "MOb72",B_AER_CBS = 'LG01', 31 | B_LU_BRP = c( 1010, 1010,263,263, 263,265,265,265),A_SOM_LOI = 3.91,A_SAND_MI = 66.3, 32 | A_SILT_MI = 22.8,A_CLAY_MI = 7.8,A_PH_CC = 5.4,A_N_RT = 1528.33,A_CN_FR = 13.02, 33 | A_S_RT = 321.26,A_N_PMN = 63.3,A_P_AL = 50.2,A_P_CC = 2.9,A_P_WA = 50.5, 34 | A_CEC_CO = 56.9,A_CA_CO_PO = 66.87,A_MG_CO_PO = 13.97,A_K_CO_PO = 3.06, 35 | A_K_CC = 58.6,A_MG_CC = 77.53,A_MN_CC = 7586.61,A_ZN_CC = 726.2,A_CU_CC = 68.8, 36 | A_C_BCS = 1,A_CC_BCS = 1,A_GS_BCS = 1,A_P_BCS = 1,A_RD_BCS = 1,A_EW_BCS = 1, 37 | A_SS_BCS = 1,A_RT_BCS = 1,A_SC_BCS = 1,M_COMPOST = 0,M_GREEN = FALSE,M_NONBARE =FALSE, 38 | M_EARLYCROP = FALSE,M_SLEEPHOSE = FALSE,M_DRAIN = FALSE,M_DITCH = FALSE, 39 | M_UNDERSEED = FALSE,M_LIME = FALSE,M_MECHWEEDS = FALSE,M_NONINVTILL = FALSE, 40 | M_PESTICIDES_DST = FALSE,M_SOLIDMANURE = FALSE,M_SSPM = FALSE,M_STRAWRESIDUE = FALSE)) 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /man/obic_recommendations.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_recommendations.R 3 | \name{obic_recommendations} 4 | \alias{obic_recommendations} 5 | \title{Recommend measurements for better soil management} 6 | \usage{ 7 | obic_recommendations(dt.recom) 8 | } 9 | \arguments{ 10 | \item{dt.recom}{(data.table) The results from \code{\link{obic_evalmeasure}}} 11 | } 12 | \description{ 13 | This function gives recommendations better soil management based on the OBI score 14 | } 15 | -------------------------------------------------------------------------------- /man/obic_recommendations_bkp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_recommendations.R 3 | \name{obic_recommendations_bkp} 4 | \alias{obic_recommendations_bkp} 5 | \title{Recommend measurements for better soil management} 6 | \usage{ 7 | obic_recommendations_bkp(dt.score, B_LU_BRP, B_SOILTYPE_AGR) 8 | } 9 | \arguments{ 10 | \item{dt.score}{(data.table) containing all OBI indicators and scores of a single field} 11 | 12 | \item{B_LU_BRP}{(numeric) Cultivation code according to BRP} 13 | 14 | \item{B_SOILTYPE_AGR}{(character) Agricultural soil type} 15 | } 16 | \description{ 17 | This function returns a list of management recommendations based on OBI scores as part of BodemKwaliteitsPlan. 18 | } 19 | -------------------------------------------------------------------------------- /man/pF_curve.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{pF_curve} 4 | \alias{pF_curve} 5 | \title{Water retention curve} 6 | \usage{ 7 | pF_curve(head, thetaR, thetaS, alfa, n) 8 | } 9 | \arguments{ 10 | \item{head}{(numeric) suction pressure ([L] or cm of water)} 11 | 12 | \item{thetaR}{(numeric) residual water content (cm3/cm3)} 13 | 14 | \item{thetaS}{(numeric) saturated water content (cm3/cm3)} 15 | 16 | \item{alfa}{(numeric) related to the inverse of the air entry suction, alfa > 0 (1/cm)} 17 | 18 | \item{n}{(numeric) a measure of the pore-size distribution, n>1, dimensionless} 19 | } 20 | \value{ 21 | theta (numeric) water content (cm3/cm3) 22 | 23 | The moisture content of a soil given a certain pressure head. A numeric value. 24 | } 25 | \description{ 26 | This function compute water content at given pressure head, using Van Genuchten water retention curve 27 | } 28 | \examples{ 29 | pF_curve(head = 2.2, thetaR = 0.01, thetaS = 0.35, alfa = 0.3,n = 1.6) 30 | pF_curve(head = 4.2, thetaR = 0.01, thetaS = 0.35, alfa = 0.3,n = 1.6) 31 | 32 | } 33 | -------------------------------------------------------------------------------- /man/pFpara_class.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{pFpara_class} 4 | \alias{pFpara_class} 5 | \title{Parameter estimation based on class of Staringreeks (Tabel 3, Wosten 2001)} 6 | \usage{ 7 | pFpara_class(Pklei, Pleem, Psom, M50) 8 | } 9 | \arguments{ 10 | \item{Pklei}{(numeric) The clay (<2um) content of the soil (\%)} 11 | 12 | \item{Pleem}{(numeric) The loam (<50um) content of the soil (\%) Pleem > 0} 13 | 14 | \item{Psom}{(numeric) The organic matter content of the soil (\%) Psom > 0} 15 | 16 | \item{M50}{(numeric)size of sand fraction (um)} 17 | } 18 | \value{ 19 | a table with the following columns: 20 | ThetaR (numeric) residual water content (cm3/cm3) 21 | ThetaS (numeric) saturated water content (cm3/cm3) 22 | alfa (numeric) related to the inverse of the air entry suction, alfa > 0 (1/cm) 23 | n (numeric) a measure of the pore-size distribution, n>1, dimensionless 24 | ksat (numeric) saturated hydraulic conductivity (cm/d) 25 | } 26 | \description{ 27 | Parameter estimation based on class of Staringreeks (Tabel 3, Wosten 2001) 28 | } 29 | \examples{ 30 | pFpara_class(Pklei = 25, Pleem = 15, Psom = 4.5,M50 = 150) 31 | pFpara_class(Pklei = 45, Pleem = 3, Psom = 4.5,M50 = 150) 32 | 33 | } 34 | -------------------------------------------------------------------------------- /man/pFpara_ptf_Wosten1999.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{pFpara_ptf_Wosten1999} 4 | \alias{pFpara_ptf_Wosten1999} 5 | \title{Estimate water retention curve parameters based on Wosten 1999} 6 | \usage{ 7 | pFpara_ptf_Wosten1999(Pklei, Psilt, Psom, Bovengrond) 8 | } 9 | \arguments{ 10 | \item{Pklei}{(numeric) The clay content of the soil (\%) within soil mineral part. Pklei > 0} 11 | 12 | \item{Psilt}{(numeric) The silt content of the soil (\%) within soil mineral part. Psilt > 0} 13 | 14 | \item{Psom}{(numeric) The organic matter content of the soil (\%). Psom > 0} 15 | 16 | \item{Bovengrond}{(boolean) whether topsoil (1) or not (0)} 17 | } 18 | \value{ 19 | a table with the following columns: 20 | 21 | Dichtheid (numeric) soil bulk density (g/cm3) 22 | ThetaR (numeric) residual water content (cm3/cm3) 23 | ThetaS (numeric) saturated water content (cm3/cm3) 24 | alfa (numeric) related to the inverse of the air entry suction, alfa > 0 (1/cm) 25 | n (numeric) a measure of the pore-size distribution, n>1, dimensionless 26 | ksat (numeric) saturated hydraulic conductivity (cm/d) 27 | } 28 | \description{ 29 | This function estimates water retention curve parameters using Pedo transfer function of Wosten (1999) based on HYPRES 30 | } 31 | \examples{ 32 | pFpara_ptf_Wosten1999(Pklei = 25, Psilt = 15, Psom = 4.5, Bovengrond = 1) 33 | pFpara_ptf_Wosten1999(Pklei = 45, Psilt = 3, Psom = 4.5, Bovengrond = 1) 34 | 35 | } 36 | \references{ 37 | Wösten, J.H.M , Lilly, A., Nemes, A., Le Bas, C. (1999) Development and use of a database of hydraulic properties of European soils. Geoderma 90 (3-4): 169-185. 38 | } 39 | -------------------------------------------------------------------------------- /man/pFpara_ptf_Wosten2001.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/waterretention.R 3 | \name{pFpara_ptf_Wosten2001} 4 | \alias{pFpara_ptf_Wosten2001} 5 | \title{Estimate water retention curve parameters based on Wosten 2001} 6 | \usage{ 7 | pFpara_ptf_Wosten2001(Pklei, Pleem, Psom, M50, Bovengrond) 8 | } 9 | \arguments{ 10 | \item{Pklei}{(numeric) The clay (<2um) content of the soil (\%)} 11 | 12 | \item{Pleem}{(numeric) The loam (<50um) content of the soil (\%) Pleem > 0} 13 | 14 | \item{Psom}{(numeric) The organic matter content of the soil (\%) Psom > 0} 15 | 16 | \item{M50}{(numeric)size of sand fraction (um)} 17 | 18 | \item{Bovengrond}{(boolean) whether topsoil (1) or not (0)} 19 | } 20 | \value{ 21 | a table with the following columns: 22 | Dichtheid (numeric) soil bulk density (g/cm3) 23 | ThetaR (numeric) residual water content (cm3/cm3) 24 | ThetaS (numeric) saturated water content (cm3/cm3) 25 | alfa (numeric) related to the inverse of the air entry suction, alfa > 0 (1/cm) 26 | n (numeric) a measure of the pore-size distribution, n>1, dimensionless 27 | ksat (numeric) saturated hydraulic conductivity (cm/d) 28 | l (numeric) dimension parameter 29 | } 30 | \description{ 31 | This function estimates water retention curve parameters using Pedo transfer function of Wosten (2001) 32 | } 33 | \examples{ 34 | pFpara_ptf_Wosten2001(Pklei = 25, Pleem = 15, Psom = 4.5,M50 = 150, Bovengrond = 1) 35 | pFpara_ptf_Wosten2001(Pklei = 45, Pleem = 3, Psom = 4.5,M50 = 150,Bovengrond = 1) 36 | 37 | } 38 | \references{ 39 | Wösten, J. H. M., Veerman, G. ., de Groot, W. J., & Stolte, J. (2001). Waterretentie en doorlatendheidskarakteristieken van boven- en ondergronden in Nederland: de Staringreeks. Alterra Rapport, 153, 86. https://doi.org/153 40 | } 41 | -------------------------------------------------------------------------------- /man/recom.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/obic_recommendations.R, R/tables.R 3 | \docType{data} 4 | \name{recom.obic} 5 | \alias{recom.obic} 6 | \title{Applicability range of measures, including literature based estimates, of effects on soil indicators} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 4048 rows and 11 columns. 9 | 10 | An object of class \code{data.table} (inherits from \code{data.frame}) with 4048 rows and 11 columns. 11 | } 12 | \usage{ 13 | recom.obic 14 | 15 | recom.obic 16 | } 17 | \description{ 18 | This table defines the effects of 11 measures on soil indicators. 19 | This table is used internally in \code{\link{obic_evalmeasure}} 20 | 21 | This table defines the effects of 11 measures on soil indicators 22 | } 23 | \details{ 24 | \describe{ 25 | \item{m_nr}{The ID number of measure} 26 | \item{m_description}{The description of measure} 27 | \item{m_prio}{weighing factor for measure. This is not used in the script.} 28 | \item{m_treshold}{Threshold value of the indicator value. This is not used in the script.} 29 | \item{m_order}{Order of measures. When scores are tie, the measure with a smaller number is chosen.} 30 | \item{m_soilfunction}{description of the OBIC indicator variable} 31 | \item{indicator}{Name of OBIC soil indicator variable} 32 | \item{m_effect}{Effect of measure on soil indicator. 3/2/1/0/-1} 33 | \item{m_sector}{type of agricultural sector: dairy/arable/vegetable/tree cultivation (in dutch)} 34 | \item{m_soiltype}{type of soil: sand/clay/peat/loess (in dutch)} 35 | \item{m_applicability}{is the measure applicable for combination of sector and soil (1/0)} 36 | } 37 | } 38 | \keyword{datasets} 39 | -------------------------------------------------------------------------------- /man/recom.obic_bkp.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{recom.obic_bkp} 5 | \alias{recom.obic_bkp} 6 | \title{Effects of measures on soil indicators} 7 | \format{ 8 | A data.frame with 9152 rows and 11 columns: 9 | \describe{ 10 | \item{m_nr}{The ID number of measure} 11 | \item{m_description}{The description of measure} 12 | \item{m_prio}{weighing factor for measure. This is not used in the script.} 13 | \item{m_treshold}{Threshold value of the indicator value. This is not used in the script.} 14 | \item{m_order}{Order of measures. When scores are tie, the measure with a smaller number is chosen.} 15 | \item{m_soilfunction}{description of the OBIC indicator variable} 16 | \item{indicator}{Name of OBIC soil indicator variable} 17 | \item{m_effect}{Effect of measure on soil indicator. 3/2/1/0/-1} 18 | \item{m_sector}{type of agricultural sector: dairy/arable/vegetable/tree cultivation (in dutch)} 19 | \item{m_soiltype}{type of soil: sand/clay/peat/loess (in dutch)} 20 | \item{m_applicability}{is the measure applicable for combination of sector and soil (1/0)} 21 | } 22 | } 23 | \usage{ 24 | recom.obic_bkp 25 | } 26 | \description{ 27 | This table defines the effects of 22 measures on soil indicators 28 | } 29 | \keyword{datasets} 30 | -------------------------------------------------------------------------------- /man/season.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{season.obic} 5 | \alias{season.obic} 6 | \title{Desired growing season period for maximum yield} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 116 rows and 6 columns. 9 | } 10 | \usage{ 11 | season.obic 12 | } 13 | \description{ 14 | This table gives the required number of days before and after August 15 required for optimal yield or usability and has categories to determine yield loss having a shorter workable growing season based on Tabel 2 and several formulas from Huinink (2018) 15 | } 16 | \details{ 17 | \describe{ 18 | \item{landuse}{The name of the crop or landuse category, used to link to crops.obic$crop_season} 19 | \item{req_days_pre_glg}{Required number of workable days before August 15 assuming this coincides with GLG, lowest groundwater} 20 | \item{req_days_post_glg}{Required number of workable days after August 15 assuming this coincides with GLG, lowest groundwater} 21 | \item{total_days}{Total number of days required for optimal growth or use} 22 | \item{derving}{Category to determine yield loss due to having a sub-optimal relative growing season length or RLG} 23 | } 24 | } 25 | \keyword{datasets} 26 | -------------------------------------------------------------------------------- /man/soils.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{soils.obic} 5 | \alias{soils.obic} 6 | \title{Linking table between soils and different functions in OBIC} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 9 rows and 4 columns. 9 | } 10 | \usage{ 11 | soils.obic 12 | } 13 | \description{ 14 | This table helps to link the different crops in the OBIC functions with the crops selected by the user 15 | } 16 | \details{ 17 | \describe{ 18 | \item{soiltype}{The name of the soil type} 19 | \item{soiltype.ph}{The category for this soil at pH} 20 | \item{soiltype.n}{The category for this soil at nitrogen} 21 | } 22 | } 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/tbl.ph.delta.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{tbl.ph.delta} 5 | \alias{tbl.ph.delta} 6 | \title{Table with optimal pH for different crop plans} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 136 rows and 10 columns. 9 | } 10 | \usage{ 11 | tbl.ph.delta 12 | } 13 | \description{ 14 | This table contains the optimal pH for different crop plans and soil types 15 | } 16 | \details{ 17 | \describe{ 18 | \item{table}{The original table from Handboek Bodem en Bemesting} 19 | \item{lutum.low}{Lower value for A_CLAY_MI} 20 | \item{lutum.high}{Upper value for A_CLAY_MI} 21 | \item{om.low}{Lower value for organic matter} 22 | \item{om.high}{Upper value for organic matter} 23 | \item{potato.low}{Lower value for fraction potatoes in crop plan} 24 | \item{potato.high}{Upper value for fraction potatoes in crop plan} 25 | \item{sugarbeet.low}{Lower value for fraction potatoes in crop plan} 26 | \item{sugarbeet.high}{Upper value for fraction potatoes in crop plan} 27 | \item{ph.optimum}{The optimal pH (pH_CaCl2) for this range} 28 | } 29 | 30 | #' @references Handboek Bodem en Bemesting tabel 5.1, 5.2 en 5.3 31 | } 32 | \keyword{datasets} 33 | -------------------------------------------------------------------------------- /man/waterstress.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{waterstress.obic} 5 | \alias{waterstress.obic} 6 | \title{Linking table between crops, soils, groundwater tables and water induced stresses in OBIC} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 393680 rows and 6 columns. 9 | } 10 | \usage{ 11 | waterstress.obic 12 | } 13 | \description{ 14 | This table helps to link the different crops in the OBIC functions with the crops selected by the user 15 | } 16 | \details{ 17 | \describe{ 18 | \item{cropname}{The name of the crop} 19 | \item{soilunit}{The category for this soil, derived from 1:50.000 soil map} 20 | \item{gt}{The class describing mean highest and lowest groundwater table, derived from 1:50.000 soil map} 21 | \item{droughtstress}{The mean yield reduction due to drought (in percentage)} 22 | \item{wetnessstress}{The mean yield reduction due to water surplus (in percentage)} 23 | \item{waterstress}{The mean combined effect water stress (due to deficiency or excess of water)} 24 | } 25 | } 26 | \keyword{datasets} 27 | -------------------------------------------------------------------------------- /man/weather.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{weather.obic} 5 | \alias{weather.obic} 6 | \title{Weather table} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 12 rows and 4 columns. 9 | } 10 | \usage{ 11 | weather.obic 12 | } 13 | \description{ 14 | This table contains the climatic weather data of the Netherlands for the period 1990-2020 15 | } 16 | \details{ 17 | \describe{ 18 | \item{month}{Month of the year} 19 | \item{A_TEMP_MEAN}{Mean monthly temperature} 20 | \item{A_PREC_MEAN}{Mean monthly precipitation} 21 | \item{A_ET_MEAN}{Mean monthly evapo-transpiration} 22 | } 23 | } 24 | \keyword{datasets} 25 | -------------------------------------------------------------------------------- /man/weight.obic.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tables.R 3 | \docType{data} 4 | \name{weight.obic} 5 | \alias{weight.obic} 6 | \title{Weight of indicators to calculate integrated scores} 7 | \format{ 8 | An object of class \code{data.table} (inherits from \code{data.frame}) with 196 rows and 5 columns. 9 | } 10 | \usage{ 11 | weight.obic 12 | } 13 | \description{ 14 | This table defines the weighting factors (ranging between 0 and 1) of indicator values to calculate integrated scores. 15 | } 16 | \details{ 17 | \describe{ 18 | \item{var}{The name of the weight} 19 | \item{weight}{weighing factor} 20 | } 21 | } 22 | \keyword{datasets} 23 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(data.table) 2 | library(testthat) 3 | library(OBIC) 4 | 5 | setDTthreads(1) 6 | test_check("OBIC") 7 | -------------------------------------------------------------------------------- /tests/testthat/test-bodemconditiescore.R: -------------------------------------------------------------------------------- 1 | test_that("calc_bodemconditiescore works", { 2 | expect_equal( 3 | calc_bcs( 4 | A_EW_BCS = c(0,1,2), 5 | A_SC_BCS = c(0,1,2), 6 | A_GS_BCS = c(0,1,2), 7 | A_P_BCS = c(0,1,2), 8 | A_C_BCS = c(0,1,2), 9 | A_RT_BCS = c(0,1,2), 10 | A_RD_BCS = c(0,1,2), 11 | A_SS_BCS = c(0,1,2), 12 | A_CC_BCS = c(0,1,2), 13 | A_SOM_LOI = c(4,5,5), 14 | D_PH_DELTA = c(0.5,0.5,0.5), 15 | B_LU_BRP = rep(3732,3), 16 | B_SOILTYPE_AGR = rep('dekzand',3) 17 | ), 18 | expected = c(6,20,31), 19 | tolerance = 0.01 20 | ) 21 | 22 | expect_equal( 23 | calc_bcs( 24 | A_EW_BCS = c(0,1,2), 25 | A_SC_BCS = c(0,1,2), 26 | A_GS_BCS = c(0,1,2), 27 | A_P_BCS = c(0,1,2), 28 | A_C_BCS = c(0,1,2), 29 | A_RT_BCS = c(0,1,2), 30 | A_RD_BCS = c(0,1,2), 31 | A_SS_BCS = c(0,1,2), 32 | A_CC_BCS = c(0,1,2), 33 | A_SOM_LOI = c(7.5,7.5,7.5), 34 | D_PH_DELTA = c(0,0,0), 35 | B_LU_BRP = rep(265,3), 36 | B_SOILTYPE_AGR = rep('dekzand',3) 37 | ), 38 | expected = c(12, 23, 34), 39 | tolerance = 0.01 40 | ) 41 | 42 | }) 43 | 44 | test_that("ind_bodemconditiescore works", { 45 | expect_equal( 46 | ind_bcs( 47 | D_BCS = c(6,17,36) 48 | ), 49 | expected = c(0.15,0.425,0.9), 50 | tolerance = 0.01 51 | ) 52 | 53 | }) 54 | 55 | 56 | -------------------------------------------------------------------------------- /tests/testthat/test-bulk_density.R: -------------------------------------------------------------------------------- 1 | test_that("calc_bulk_density works", { 2 | expect_equal( 3 | calc_bulk_density( 4 | A_SOM_LOI = 2, 5 | B_SOILTYPE_AGR = "zeeklei" 6 | ), 7 | expected = 1230, 8 | tolerance = 1 9 | ) 10 | expect_equal( 11 | calc_bulk_density( 12 | A_SOM_LOI = c(0.5, 3, 6, 8, 7, 5, 15, 25, 6), 13 | B_SOILTYPE_AGR = c("duinzand", "dekzand", "zeeklei", "rivierklei", "maasklei", "dalgrond", "moerige_klei", "veen", "loess") 14 | ), 15 | expected = c(1500, 1370, 1074, 1020, 1045, 1281, 912, 840, 124), 16 | tolerance = 1 17 | ) 18 | }) -------------------------------------------------------------------------------- /tests/testthat/test-cec.R: -------------------------------------------------------------------------------- 1 | test_that("calc_cec works", { 2 | expect_equal( 3 | calc_cec( 4 | A_CEC_CO = seq(10,500,length.out = 5) 5 | ), 6 | expected = c(10,132.5,255,377.5,500), 7 | tolerance = 0 8 | ) 9 | expect_equal( 10 | calc_aggregatestability( 11 | A_K_CO_PO = rep(5,5), 12 | A_MG_CO_PO = rep(2.8,5), 13 | A_CA_CO_PO = seq(35,92,length.out = 5), 14 | A_SOM_LOI = rep(5, 5), 15 | B_SOILTYPE_AGR = rep('dekzand', 5) 16 | ), 17 | expected = c(0.3625942, 0.2497810, 0.1389193, 0.0468888, 0.1053117), 18 | tolerance = 0.01 19 | ) 20 | }) 21 | 22 | test_that("eval_cec works", { 23 | expect_equal( 24 | ind_aggregatestability( 25 | D_AS = c(0.37,0.26,0.16,0.09,0.13) 26 | ), 27 | expected = c(0.63,0.74,0.84,0.91,0.87), 28 | tolerance = 0.01 29 | ) 30 | expect_equal( 31 | ind_cec( 32 | D_CEC = seq(10,500,50) 33 | ), 34 | expected = c(0.1,0.6,1,1,1,1,1,1,1,1), 35 | tolerance = 0.01 36 | ) 37 | }) 38 | -------------------------------------------------------------------------------- /tests/testthat/test-compaction.R: -------------------------------------------------------------------------------- 1 | test_that("ind_compaction works", { 2 | expect_equal( 3 | ind_compaction( 4 | B_SC_WENR = c('Zeer beperkt') 5 | ), 6 | expected = 1, 7 | tolerance = 0.001 8 | ) 9 | expect_equal( 10 | ind_compaction( 11 | B_SC_WENR = c("Bebouwing en infrastructuur","Groot","Zeer groot","Matig","Water", 12 | "Glastuinbouw, niet beoordeeld","Beperkt door veenlagen","Van nature dicht" , 13 | "Beperkt", "Zeer beperkt") 14 | ), 15 | expected = c(1, 0.4, 0.2, 0.6, 1, 1, 0.8, 0.2, 0.8, 1), 16 | tolerance = 0.001 17 | ) 18 | }) 19 | -------------------------------------------------------------------------------- /tests/testthat/test-crop_classification.R: -------------------------------------------------------------------------------- 1 | test_that("crop classification works", { 2 | expect_equal( 3 | calc_cropclass( 4 | B_LU_BRP = 235, 5 | B_SOILTYPE_AGR = 'dekzand', 6 | nutrient = 'P' 7 | ), 8 | expected = 'class3' 9 | ) 10 | # chinese kool (class 0), aardappel (class 1), suikerbiet (class 2), gerst (class 3), boerenkool (class 4) 11 | # faunarand gras (3720) en engels raai (3506) 12 | expect_equal( 13 | calc_cropclass( 14 | B_LU_BRP = c(2721,2951,256,236,2715,3720,3506,3506,3506), 15 | B_SOILTYPE_AGR = c('dekzand','duinzand','zeeklei','rivierklei','maasklei','dalgrond','moerige_klei','veen','loess'), 16 | nutrient = c('P') 17 | ), 18 | expected = c('class0','class1','class2','class3','class4','natuur','gras','gras','gras') 19 | ) 20 | #witte kool (class 1), aardappel (class 1), suikerbiet (class 1), gerst (class 4), boerenkool (class 1) 21 | # fabrieksaardappel, bloemkool (Class 2), voederbieten (Class 3) en graszaad en mais (class 4) 22 | expect_equal( 23 | calc_cropclass( 24 | B_LU_BRP = c(2789,2951,256,236,2715,3732,2713,257,383,814), 25 | B_SOILTYPE_AGR = rep('dekzand',10), 26 | nutrient = c('K') 27 | ), 28 | expected = c('class1','class1','class1','class4','class1','class2','class2','class3','class4','class4') 29 | ) 30 | 31 | # chinese kool (class 2), aardappel (class 3), suikerbiet (class 4), gerst (class 3), boerenkool (class 3) 32 | # fabrieksaardappel (class3), bloemkool (Class 2), voederbieten (Class 3) en spruitkool (class1) en mais (class 3) 33 | expect_equal( 34 | calc_cropclass( 35 | B_LU_BRP = c(2721,2951,256,236,2715,3732,2713,257,2777,814), 36 | B_SOILTYPE_AGR = rep('dekzand',10), 37 | nutrient = c('S') 38 | ), 39 | expected = c('class2','class3','class4','class3','class3','class3','class2','class4','class1','class3') 40 | ) 41 | 42 | }) 43 | -------------------------------------------------------------------------------- /tests/testthat/test-crop_rotation.R: -------------------------------------------------------------------------------- 1 | test_that("calc_grass_age works", { 2 | expect_equal( 3 | calc_rotation_fraction( 4 | ID = c(1, 1, 1, 1, "A"), 5 | B_LU_BRP = c(265, 265, 1079, 1079, 1079), 6 | crop = "grass" 7 | ), 8 | expected = c(0.5, 0.5, 0.5, 0.5, 0), 9 | tolerance = 0.1 10 | ) 11 | expect_equal( 12 | calc_rotation_fraction( 13 | ID = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, "A"), 14 | B_LU_BRP = c(265, 265, 1079, 1079, 1079, 237,237, 265, 265, 265, 308, 308, 265), 15 | crop = "grass" 16 | ), 17 | expected = c(0.4, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1), 18 | tolerance = 0.1 19 | ) 20 | }) -------------------------------------------------------------------------------- /tests/testthat/test-crumbleability.R: -------------------------------------------------------------------------------- 1 | test_that("calc_crumbleability works", { 2 | expect_equal( 3 | calc_crumbleability( 4 | A_CLAY_MI = 10, 5 | A_SOM_LOI = 5, 6 | A_PH_CC = 6 7 | ), 8 | expected = 9.3, 9 | tolerance = 0.001 10 | ) 11 | expect_equal( 12 | calc_crumbleability( 13 | A_CLAY_MI = c(2, 4, 45), 14 | A_SOM_LOI = c(5, 5, 5), 15 | A_PH_CC= c(6, 6, 6) 16 | ), 17 | expected = c(10, 10, 4.045833), 18 | tolerance = 0.001 19 | ) 20 | }) 21 | 22 | test_that("eval_crumbleability works", { 23 | expect_equal( 24 | ind_crumbleability( 25 | D_CR = 10, 26 | B_LU_BRP = 2014 27 | ), 28 | expected = 1, 29 | tolerance = 0.001 30 | ) 31 | expect_equal( 32 | ind_crumbleability( 33 | D_CR = seq(5,15,1), 34 | B_LU_BRP = rep(1042,11) 35 | ), 36 | expected = c(0.3125, 0.3750, 0.4375, 0.5, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0), 37 | tolerance = 0.1 38 | ) 39 | expect_equal( 40 | ind_crumbleability( 41 | D_CR = seq(1,11,1), 42 | B_LU_BRP = rep(233,11) 43 | ), 44 | expected = c(0.5625, 0.6250, 0.6875, 0.7500, 0.8125, 0.8750, 0.9375, 1.0000, 1.0000, 1.0000, 1.0000), 45 | tolerance = 0.1 46 | ) 47 | 48 | }) 49 | -------------------------------------------------------------------------------- /tests/testthat/test-format_gwt.R: -------------------------------------------------------------------------------- 1 | test_that("format_gwt works", { 2 | expect_equal( 3 | format_gwt( 4 | B_GWL_CLASS = c('sVb', 'sVa', 'sVII', 'sVI', 'sV', 'bVII', 'bVI', 'Vb', 'Va', 'VIII', 'VII', 'VI', 5 | 'V', 'IVu', 'IV', 'IIb', 'IIIb', 'IIIa', 'III', 'II', 'I', '-') 6 | ), 7 | expected = c("GtV", "GtV", "GtVII", 'GtVI', 'GtV', 'GtVII', 'GtVI', 'GtV', 'GtV', 'GtVIII', 'GtVII', 'GtVI', 8 | 'GtV', 'GtIV', 'GtIV', 'GtII', 'GtIII', 'GtIII', 'GtIII', 'GtII', 'GtI', 'GtIII') 9 | ) 10 | expect_equal( 11 | format_gwt( 12 | B_GWL_CLASS = c("GtIII", "GtVI", "GtIIb") 13 | ), 14 | expected = c("GtIII", "GtVI", "GtII") 15 | ) 16 | expect_equal( 17 | format_gwt( 18 | B_GWL_CLASS = c("II", "VI", "IIb", "GtIII", "GtIIIb") 19 | ), 20 | expected = c("GtII", "GtVI", "GtII", "GtIII", "GtIII") 21 | ) 22 | }) -------------------------------------------------------------------------------- /tests/testthat/test-format_soilcompaction.R: -------------------------------------------------------------------------------- 1 | test_that("format_soilcompaction works", { 2 | expect_equal( 3 | format_soilcompaction( 4 | B_SC_WENR = c(1, 2, 3, 4, 5, 10, 11, 401, 901, 902) 5 | ), 6 | expected = c("Zeer beperkt", "Beperkt", "Matig", "Groot", "Zeer groot", 7 | "Beperkt door veenlagen", "Van nature dicht", "Glastuinbouw, niet beoordeeld", 8 | "Bebouwing en infrastructuur", "Water") 9 | ) 10 | expect_equal( 11 | format_soilcompaction( 12 | B_SC_WENR = c("Bebouwing en infrastructuur","Groot","Zeer groot","Matig","Water", 13 | "Glastuinbouw, niet beoordeeld","Beperkt door veenlagen","Van nature dicht" , 14 | "Beperkt", "Zeer beperkt") 15 | ), 16 | expected = c("Bebouwing en infrastructuur","Groot","Zeer groot","Matig","Water", 17 | "Glastuinbouw, niet beoordeeld","Beperkt door veenlagen","Van nature dicht" , 18 | "Beperkt", "Zeer beperkt") 19 | ) 20 | }) -------------------------------------------------------------------------------- /tests/testthat/test-grass_age.R: -------------------------------------------------------------------------------- 1 | test_that("calc_grass_age works", { 2 | expect_equal( 3 | calc_grass_age( 4 | ID = c(1, 1, 1, 1, "A"), 5 | B_LU_BRP = c(265, 265, 1079, 1079, 1079) 6 | ), 7 | expected = c(2, 1,0,0,0), 8 | tolerance = 0.1 9 | ) 10 | expect_equal( 11 | calc_grass_age( 12 | ID = c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, "A"), 13 | B_LU_BRP = c(265, 265, 1079, 1079, 1079, 237,237, 265, 265, 265, 308, 308, 265) 14 | ), 15 | expected = c(2, 1,0,0,0,0,0,3,2,1,0,0,1), 16 | tolerance = 0.1 17 | ) 18 | }) 19 | -------------------------------------------------------------------------------- /tests/testthat/test-groundwater_recharge.R: -------------------------------------------------------------------------------- 1 | test_that("whether ind_gw_recharge works", { 2 | expect_equal( 3 | ind_gw_recharge( 4 | B_LU_BRP = c(265,265,265,233,233,233), 5 | D_PSP = c(100,200,300,400,500,600), 6 | D_WRI_K = c(50,90,50,100,50,90), 7 | I_P_SE = rep(0.8,6), 8 | I_P_CO = c(0.1,1,0.1,1,0.1,1), 9 | B_DRAIN = c(TRUE,FALSE,TRUE,FALSE,TRUE,FALSE), 10 | B_GWL_CLASS = c('GtIII','GtIII','GtIII','GtIV','GtIII','GtIV') 11 | ), 12 | expected = c(0.1274698, 0.3502220, 0.5416138, 0.9614681, 0.6772030, 0.9557414), 13 | tolerance = 0.01 14 | ) 15 | 16 | }) 17 | -------------------------------------------------------------------------------- /tests/testthat/test-magnesium.R: -------------------------------------------------------------------------------- 1 | test_that("calc_magnesium_availability works", { 2 | expect_equal( 3 | # aardappel op dekzand 4 | calc_magnesium_availability( 5 | A_MG_CC = 122, 6 | A_PH_CC = 5.6, 7 | A_SOM_LOI = 7.9, 8 | A_CEC_CO = 122, 9 | A_K_CC = 95, 10 | A_K_CO_PO = 1.56, 11 | A_CLAY_MI = 1.73, 12 | B_SOILTYPE_AGR = 'dekzand', 13 | B_LU_BRP = 3732 14 | ), 15 | expected = 122, 16 | tolerance = 1 17 | ) 18 | expect_equal( 19 | # aardappel op dekzand, zeeklei, rivierklei en loss 20 | calc_magnesium_availability( 21 | A_MG_CC = c(122,146,291,160), 22 | A_PH_CC = c(5.6,7.04,5.65,6.22), 23 | A_SOM_LOI = c(7.9,4.2,6.12,3.57), 24 | A_CEC_CO = c(122,191,157,142), 25 | A_K_CC = c(95,107,73,89), 26 | A_K_CO_PO = c(1.6,2.9,3.1,2.4), 27 | A_CLAY_MI = c(1.7,26,31,14), 28 | B_SOILTYPE_AGR = c('dekzand','zeeklei','rivierklei','loess'), 29 | B_LU_BRP = rep(3732,4) 30 | ), 31 | expected = c(122,146,291,160), 32 | tolerance = 1 33 | ) 34 | expect_equal( 35 | # grassland op dekzand, zeeklei, rivierklei en loss 36 | calc_magnesium_availability( 37 | A_MG_CC = c(122,146,291,160), 38 | A_PH_CC = c(5.6,7.04,5.65,6.22), 39 | A_SOM_LOI = c(7.9,4.2,6.12,3.57), 40 | A_CEC_CO = c(122,191,157,142), 41 | A_K_CC = c(95,107,73,89), 42 | A_K_CO_PO = c(1.6,2.9,3.1,2.4), 43 | A_CLAY_MI = c(1.7,26,31,14), 44 | B_SOILTYPE_AGR = c('dekzand','zeeklei','rivierklei','loess'), 45 | B_LU_BRP = rep(265,4) 46 | ), 47 | expected = c(122,77.49,100,160), 48 | tolerance = 0.01 49 | ) 50 | }) 51 | 52 | 53 | 54 | test_that("ind_magnesium works", { 55 | # aardappel op dekzand 56 | expect_equal( 57 | ind_magnesium( 58 | D_MG = 122, 59 | B_LU_BRP=3732, 60 | B_SOILTYPE_AGR = 'dekzand' 61 | ), 62 | expected = 1, 63 | tolerance = 0.01 64 | ) 65 | # aardappel op dekzand, zeeklei, rivierklei en loss 66 | expect_equal( 67 | ind_magnesium( 68 | D_MG = seq(1,400,length.out = 10), 69 | B_LU_BRP=rep(3732,10), 70 | B_SOILTYPE_AGR = rep('dekzand',10) 71 | ), 72 | expected = c(0.0225388, 0.7588881, 0.9999578, 1.0000000,rep(1,6)), 73 | tolerance = 0.01 74 | ) 75 | # grasland op klei 76 | expect_equal( 77 | ind_magnesium( 78 | D_MG = seq(0, 100,length.out = 6), 79 | B_LU_BRP=rep(265,6), 80 | B_SOILTYPE_AGR = rep('zeeklei',6) 81 | ), 82 | expected = c(0,0,0.005,0.095,0.679,0.977), 83 | tolerance = 0.01 84 | ) 85 | }) -------------------------------------------------------------------------------- /tests/testthat/test-metals.R: -------------------------------------------------------------------------------- 1 | test_that("calc_cu works", { 2 | expect_equal( 3 | calc_copper_availability( 4 | A_CU_CC = seq(1,200,length.out = 7), 5 | A_SOM_LOI = rep(4,7), 6 | A_MN_CC = rep(1300,7), 7 | A_CLAY_MI = rep(15,7), 8 | A_K_CC = rep(85, 7), 9 | B_LU_BRP = rep(3732,7) 10 | ), 11 | expected = c(1.97,6.34,7.93,9.06,9.96,10.71,11.38), 12 | tolerance = 0.01 13 | ) 14 | expect_equal( 15 | calc_copper_availability( 16 | A_CU_CC = seq(1,50,length.out = 7), 17 | A_SOM_LOI = rep(4,7), 18 | A_MN_CC = rep(1300,7), 19 | A_CLAY_MI = rep(15,7), 20 | A_K_CC = rep(85, 7), 21 | B_LU_BRP = rep(265,7) 22 | ), 23 | expected = c(1.97,4.1,5.06,5.75,6.31,6.78,7.19), 24 | tolerance = 0.01 25 | ) 26 | 27 | }) 28 | 29 | test_that("ind_copper works", { 30 | expect_equal( 31 | ind_copper( 32 | D_CU = c(1.57,3.05,3.47,3.74,3.94,4.11,4.25), 33 | B_LU_BRP = rep(3732,7) 34 | ), 35 | expected = c(0,0.34,0.54,0.65,0.72,0.77,0.81), 36 | tolerance = 0.99 37 | ) 38 | expect_equal( 39 | ind_copper( 40 | D_CU = c(1.97,4.10,5.06,5.75,6.31,6.78,7.2), 41 | B_LU_BRP = rep(265,7) 42 | ), 43 | expected = c(0.17,0.79,0.92,0.96,0.98,0.99,0.99), 44 | tolerance = 0.99 45 | ) 46 | }) 47 | 48 | test_that("calc_zn works", { 49 | expect_equal( 50 | calc_zinc_availability( 51 | A_ZN_CC = seq(100,5000,length.out = 7), 52 | A_PH_CC = rep(4.5,7), 53 | B_LU_BRP = rep(3732,7), 54 | B_SOILTYPE_AGR = rep('zeeklei',7) 55 | ), 56 | expected = c(8.04,27.79,39.70,49.28,57.57,62.02,71.85), 57 | tolerance = 0.01 58 | ) 59 | expect_equal( 60 | calc_zinc_availability( 61 | A_ZN_CC = c(seq(100,1000,length.out = 6),2500), 62 | A_PH_CC = rep(4.5,7), 63 | B_LU_BRP = rep(265,7), 64 | B_SOILTYPE_AGR = rep('dekzand',7) 65 | ), 66 | expected = c(3.47,6.91,9.64,12.03,14.199,16.22,29.97), 67 | tolerance = 1 68 | ) 69 | }) 70 | 71 | test_that("ind_zinc works", { 72 | expect_equal( 73 | ind_zinc( 74 | D_ZN = c(8.04,27.79,39.70,49.28,57.57,62.02,71.85) 75 | ), 76 | expected = c(0.4,0.479,0.636,0.743,0.820,0.856,0.921), 77 | tolerance = 0.01 78 | ) 79 | expect_equal( 80 | ind_zinc( 81 | D_ZN = c(3.47,6.91,9.64,12.03,14.199,16.22,29.97) 82 | ), 83 | expected = c(0.4,0.4,0.4,0.4,0.4,0.4,0.5096), 84 | tolerance = 0.01 85 | ) 86 | }) 87 | 88 | -------------------------------------------------------------------------------- /tests/testthat/test-nitrogen.R: -------------------------------------------------------------------------------- 1 | test_that("calc_nlv works", { 2 | expect_equal( 3 | calc_nlv( 4 | A_N_RT = 5000, 5 | D_OC = 86000, 6 | B_LU_BRP = 265, 7 | B_SOILTYPE_AGR = "rivierklei", 8 | D_BDS = 1300, 9 | A_CN_FR = 4, 10 | D_GA = 2 11 | ), 12 | expected = 204.22254, 13 | tolerance = 1 14 | ) 15 | expect_equal( 16 | calc_nlv( 17 | A_N_RT = c(5000, 10000, 25000, 8000), 18 | D_OC = c(86000, 86000, 86000,86000), 19 | B_LU_BRP = c(265, 265, 235, 235), 20 | B_SOILTYPE_AGR = c("rivierklei", "veen", "veen", "dekzand"), 21 | D_BDS = c(1300, 800, 850, 1100), 22 | A_CN_FR = c(12, 12, 12, 12), 23 | D_GA = c(2, 8, 0, 0) 24 | ), 25 | expected = c(204.22254, 250, 90, 90), 26 | tolerance = 1 27 | ) 28 | }) 29 | 30 | test_that("eval_nitrogen works", { 31 | expect_equal( 32 | ind_nitrogen( 33 | D_NLV = c(140, 100), 34 | B_LU_BRP = c(265, 2014) 35 | ), 36 | expected = c(1, 1), 37 | tolerance = 0.001 38 | ) 39 | expect_equal( 40 | ind_nitrogen( 41 | D_NLV = seq(from = -30, to = 250, by = 50), 42 | B_LU_BRP = rep(265, 6) 43 | ), 44 | expected = c(0, 0.2653061, 0.7500000, 0.9795918, 1, 1), 45 | tolerance = 0.001 46 | ) 47 | expect_equal( 48 | ind_nitrogen( 49 | D_NLV = seq(from = -30, to = 250, by = 50), 50 | B_LU_BRP = rep(2014, 6) 51 | ), 52 | expected = c(0, 0.36, 0.91, 1, 1, 1), 53 | tolerance = 0.001 54 | ) 55 | }) -------------------------------------------------------------------------------- /tests/testthat/test-nitrogen_efficiency.R: -------------------------------------------------------------------------------- 1 | test_that("test whether calc_nitrogen_efficiency works", { 2 | expect_equal( 3 | calc_n_efficiency(B_LU_BRP = c(233,259,2014,308), 4 | B_SOILTYPE_AGR = rep('rivierklei',4), 5 | B_GWL_CLASS = rep('GtIII',4), 6 | B_AER_CBS = rep('IJsselmeerpolders',4), 7 | A_SOM_LOI = rep(3,4), 8 | A_CLAY_MI = rep(20,4), 9 | D_PBI = rep(2,4), 10 | D_K = rep(12,4), 11 | D_PH_DELTA = rep(0.2,4), 12 | M_GREEN = rep(FALSE,4), 13 | B_FERT_NORM_FR = c(1,1,1,0.8), 14 | leaching_to = 'gw' 15 | ), 16 | expected = c(3.92, 8.32, 10.00, 0.96), 17 | tolerance = 0.01 18 | ) 19 | 20 | expect_equal( 21 | calc_n_efficiency(B_LU_BRP = c(233,259,2014,308), 22 | B_SOILTYPE_AGR = rep('dekzand',4), 23 | B_GWL_CLASS = rep('GtII',4), 24 | B_AER_CBS = rep('Zuidwest-Brabant',4), 25 | A_SOM_LOI = rep(3,4), 26 | A_CLAY_MI = rep(15,4), 27 | D_PBI = rep(2,4), 28 | D_K = rep(12,4), 29 | D_PH_DELTA = rep(0.2,4), 30 | M_GREEN = rep(TRUE,4), 31 | B_FERT_NORM_FR = c(1,0.8,1,1), 32 | leaching_to = 'gw' 33 | ), 34 | expected = c(0.0, 0.0, 1.9, 0.0), 35 | tolerance = 0.01 36 | ) 37 | 38 | }) 39 | 40 | 41 | test_that("test whether ind_nitrogen_efficiency works", { 42 | expect_equal( 43 | ind_n_efficiency(D_NLEACH = c(1,10,30,40,50), 44 | leaching_to = 'gw' 45 | ), 46 | expected = c(0.992600350,0.955434864,0.273600241,0.048369957,0.006828972), 47 | tolerance = 0.01 48 | ) 49 | 50 | 51 | 52 | }) 53 | -------------------------------------------------------------------------------- /tests/testthat/test-nretention.R: -------------------------------------------------------------------------------- 1 | test_that("calc_nleach works", { 2 | # groundwater leaching 3 | expect_equal( 4 | calc_nleach( 5 | B_SOILTYPE_AGR = c('dekzand','zeeklei','rivierklei','loess'), 6 | B_LU_BRP = c(265, 2014, 259, 259), # grasland, bouwland, mais, mais 7 | B_GWL_CLASS = c('GtIV','GtV','GtIII','GtII'), 8 | D_NLV = c(5, 30, 100, 150), 9 | B_AER_CBS = c('Rivierengebied', 'Rivierengebied', 'Centraal Veehouderijgebied', 'Centraal Veehouderijgebied'), 10 | leaching_to = "gw" 11 | ), 12 | expected = c(0.41, 0.39, 5.77, 15.64), 13 | tolerance = 0.001 14 | ) 15 | 16 | # add check for groundwater leaching 17 | expect_equal( 18 | calc_nleach( 19 | B_SOILTYPE_AGR = 'dekzand', 20 | B_LU_BRP = 265, 21 | B_GWL_CLASS = 'VII', 22 | D_NLV = 135, 23 | B_AER_CBS = 'Centraal Veehouderijgebied', 24 | leaching_to = "gw" 25 | ), 26 | expected = 11.88, 27 | tolerance = 0.001 28 | ) 29 | 30 | # surfacewater run-off 31 | expect_equal( 32 | calc_nleach( 33 | B_SOILTYPE_AGR = c('dekzand','zeeklei','rivierklei','loess'), 34 | B_LU_BRP = c(265, 2014, 259, 259), # grasland, bouwland, mais, mais 35 | B_GWL_CLASS = c('GtIV','GtV','GtIII','GtII'), 36 | D_NLV = c(5, 30, 100, 150), 37 | B_AER_CBS = c('Rivierengebied', 'Rivierengebied', 'Centraal Veehouderijgebied', 'Centraal Veehouderijgebied'), 38 | leaching_to = "ow" 39 | ), 40 | expected = c(0.095, 0.270, 4.49, 19.90), 41 | tolerance = 0.001 42 | ) 43 | }) 44 | 45 | 46 | test_that("ind_nretention gw works", { 47 | expect_equal( 48 | ind_nretention( 49 | D_NW = seq(from = 0, to = 70, length.out = 8), 50 | leaching_to ="gw" 51 | ), 52 | expected = c(9.890428e-01, 6.874900e-01, 5.530339e-02, 1.595222e-03, 4.365378e-05, 1.192833e-06, 3.259268e-08, 8.905534e-10), 53 | tolerance = 0.001 54 | ) 55 | }) 56 | 57 | test_that("ind_nretention ow works", { 58 | expect_equal( 59 | ind_nretention( 60 | D_NW = seq(from = 0, to = 40, length.out = 8), 61 | leaching_to = "ow" 62 | ), 63 | expected = c( 9.749461e-01, 4.992744e-01, 3.997841e-02, 1.890118e-03, 8.650998e-05, 0, 0, 0), 64 | tolerance = 0.001 65 | ) 66 | }) -------------------------------------------------------------------------------- /tests/testthat/test-obic_farm.R: -------------------------------------------------------------------------------- 1 | # make an example set for five fields 2 | dt <- OBIC::binnenveld[ID <=5] 3 | 4 | out <- obic_farm(dt) 5 | 6 | test_that("obic_farm works", { 7 | expect_equal( 8 | names(out), 9 | expected = c('fields','farm'), 10 | tolerance = 0.01 11 | ) 12 | expect_equal( 13 | length(out$field), 14 | expected = 35, 15 | tolerance = 0.01 16 | ) 17 | expect_equal( 18 | length(out$farm), 19 | expected = 2, 20 | tolerance = 0.01 21 | ) 22 | expect_equal( 23 | nrow(out$farm$indicators), 24 | expected = 28, 25 | tolerance = 0.01 26 | ) 27 | expect_equal( 28 | nrow(out$farm$scores), 29 | expected = 6, 30 | tolerance = 0.01 31 | ) 32 | expect_equal( 33 | ncol(out$farm$indicators), 34 | expected = 5, 35 | tolerance = 0.01 36 | ) 37 | expect_equal( 38 | ncol(out$farm$scores), 39 | expected = 5, 40 | tolerance = 0.01 41 | ) 42 | expect_equal( 43 | unique(out$farm$indicators[,S_OBI_NFIELDS_LOW + S_OBI_NFIELDS_MEDIUM + S_OBI_NFIELDS_HIGH]), 44 | expected = 5, 45 | tolerance = 0.01 46 | ) 47 | expect_equal( 48 | unique(out$farm$scores[,S_OBI_NFIELDS_LOW + S_OBI_NFIELDS_MEDIUM + S_OBI_NFIELDS_HIGH]), 49 | expected = 5, 50 | tolerance = 0.01 51 | ) 52 | expect_equal( 53 | out$field$S_C_OBI_A, 54 | expected = c(0.86,0.833,0.825,0.897,0.764), 55 | tolerance = 0.01 56 | ) 57 | expect_equal( 58 | c(sum(out$farm$indicators$S_OBI_NFIELDS_LOW),sum(out$farm$indicators$S_OBI_NFIELDS_HIGH)), 59 | expected = c(34,76), 60 | tolerance = 0.01 61 | ) 62 | expect_equal( 63 | c(sum(out$farm$scores$S_OBI_NFIELDS_LOW),sum(out$farm$scores$S_OBI_NFIELDS_HIGH)), 64 | expected = c(8,14), 65 | tolerance = 0.01 66 | ) 67 | }) 68 | -------------------------------------------------------------------------------- /tests/testthat/test-organic_carbon.R: -------------------------------------------------------------------------------- 1 | test_that("calc_organic_carbon works", { 2 | expect_equal( 3 | calc_organic_carbon( 4 | A_SOM_LOI = 5, 5 | D_BDS = 1000, 6 | D_RD = 0.3 7 | ), 8 | expected = 87000, 9 | tolerance = 10 10 | ) 11 | expect_equal( 12 | calc_organic_carbon( 13 | A_SOM_LOI = c(5, 10, 15, 20, 25), 14 | D_BDS = c(1300, 1100, 1000, 900, 800) , 15 | D_RD = c(0.3, 0.3, 0.1, 0.1, 0.1) 16 | ), 17 | expected = c(113100, 191400, 87000, 104400, 116000), 18 | tolerance = 10 19 | ) 20 | }) -------------------------------------------------------------------------------- /tests/testthat/test-permeability.R: -------------------------------------------------------------------------------- 1 | test_that("whether calc_permeability works", { 2 | expect_equal( 3 | calc_permeability(A_CLAY_MI = c(5,5,20,20,40,40), 4 | A_SAND_MI = c(20,40,20,40,10,30), 5 | A_SILT_MI = c(50,20,30,10,30,10), 6 | A_SOM_LOI = c(3,10,3,10,3,10) 7 | ), 8 | expected = c(8023.31,37.56,69.90,156.66,55.69,58.41), 9 | tolerance = 0.01 10 | ) 11 | 12 | }) 13 | 14 | 15 | test_that("whether ind_permeability works", { 16 | expect_equal( 17 | ind_permeability(D_WRI_K = c(40,60,80,100) 18 | ), 19 | expected = c(0.054,0.395, 0.805, 0.9556), 20 | tolerance = 0.001 21 | ) 22 | 23 | }) 24 | 25 | -------------------------------------------------------------------------------- /tests/testthat/test-pesticide_leaching.R: -------------------------------------------------------------------------------- 1 | test_that("test whether calc_pesticide_leaching works", { 2 | expect_equal( 3 | calc_pesticide_leaching(B_SOILTYPE_AGR = rep('dekzand',4), 4 | A_SOM_LOI = c(2,3,5,8), 5 | A_CLAY_MI = rep(20,4), 6 | A_SAND_MI = rep(15,4), 7 | A_SILT_MI = rep(10,4), 8 | D_PSP = rep(300,4), 9 | M_PESTICIDES_DST = rep(FALSE,4), 10 | M_MECHWEEDS = rep(FALSE,4) 11 | ), 12 | expected = c(0.9598414, 0.9137699, 0.8337817, 0.7379058), 13 | tolerance = 0.01 14 | ) 15 | 16 | expect_equal( 17 | calc_pesticide_leaching(B_SOILTYPE_AGR = rep('dekzand',4), 18 | A_SOM_LOI = rep(3,4), 19 | A_CLAY_MI = rep(20,4), 20 | A_SAND_MI = rep(15,4), 21 | A_SILT_MI = rep(10,4), 22 | D_PSP = c(50,100,400,800), 23 | M_PESTICIDES_DST = rep(FALSE,4), 24 | M_MECHWEEDS = rep(FALSE,4) 25 | ), 26 | expected = c(0.5821316, 0.7629755, 0.9346040, 0.9667492), 27 | tolerance = 0.01 28 | ) 29 | 30 | expect_equal( 31 | calc_pesticide_leaching(B_SOILTYPE_AGR = rep('dekzand',4), 32 | A_SOM_LOI = c(2,3,5,8), 33 | A_CLAY_MI = rep(20,4), 34 | A_SAND_MI = rep(15,4), 35 | A_SILT_MI = rep(10,4), 36 | D_PSP = rep(300,4), 37 | M_PESTICIDES_DST = rep(TRUE,4), 38 | M_MECHWEEDS = rep(FALSE,4) 39 | ), 40 | expected = c(0.7198810, 0.6853274, 0.6253363, 0.5534294), 41 | tolerance = 0.01 42 | ) 43 | 44 | }) 45 | 46 | 47 | test_that("test whether ind_petsicide_leaching works", { 48 | expect_equal( 49 | ind_pesticide_leaching(D_PESTICIDE = c(0.3,0.5,0.7,0.9)), 50 | expected = c(.999,0.996,0.851,0.0386), 51 | tolerance = 0.01 52 | ) 53 | 54 | }) 55 | 56 | -------------------------------------------------------------------------------- /tests/testthat/test-ph.R: -------------------------------------------------------------------------------- 1 | test_that("calc_ph_delta works", { 2 | expect_equal( 3 | calc_ph_delta( 4 | A_PH_CC = 6, 5 | B_SOILTYPE_AGR = "rivierklei", 6 | A_CLAY_MI = 20, 7 | A_SOM_LOI = 5, 8 | D_CP_STARCH = 0, 9 | D_CP_POTATO = 0.3, 10 | D_CP_GRASS = 0, 11 | D_CP_MAIS = 0.2, 12 | D_CP_SUGARBEET = 0.2, 13 | D_CP_OTHER = 0.3, 14 | B_LU_BRP = 265 15 | ), 16 | expected = 0.3, 17 | tolerance = 0.001 18 | ) 19 | expect_equal( 20 | calc_ph_delta( 21 | A_PH_CC = c(6, 4.0, 6.2, 4.5, 5.0), 22 | B_SOILTYPE_AGR = c("rivierklei", "veen", "veen", "loess", "dekzand"), 23 | A_CLAY_MI = c(20, 5, 8, 12, 5), 24 | A_SOM_LOI = c(5, 20, 23, 8, 10), 25 | D_CP_STARCH = c(0, 0.2, 0, 0.4, 0), 26 | D_CP_POTATO = c(0.3, 0.15, 0, 0, 0), 27 | D_CP_GRASS = c(0, 0.45, 0.7, 0, 0.5), 28 | D_CP_MAIS = c(0.1, 0.2, 0.15, 0.1, 0.1), 29 | D_CP_SUGARBEET = c(0.2, 0, 0.15, 0, 0), 30 | D_CP_OTHER = c(0.4, 0, 0, 0.5, 0), 31 | B_LU_BRP = c(265, 265, 265, 265, 800) 32 | ), 33 | expected = c(0.3, 01.31, 0, 0.6, 0.81), 34 | tolerance = 0.001 35 | ) 36 | }) 37 | 38 | test_that("eval_ works", { 39 | expect_equal( 40 | ind_ph( 41 | D_PH_DELTA = seq(from = 0, to = 1.5, by = 0.2) 42 | ), 43 | expected = c(0.9990048419, 0.9550805632, 0.5738162496, 0.1500764753, 0.0272414349, 0.0045760499, 0.0007584449, 0.0001254257), 44 | tolerance = 0.001 45 | ) 46 | }) 47 | -------------------------------------------------------------------------------- /tests/testthat/test-phosphate-availability.R: -------------------------------------------------------------------------------- 1 | test_that("calc_phosphate_availability works", { 2 | expect_equal( 3 | calc_phosphate_availability( 4 | A_P_AL = 25, 5 | A_P_CC = 1.5, 6 | A_P_WA = 24, 7 | B_LU_BRP = 2014 8 | ), 9 | expected = 2.4, 10 | tolerance = 0.001 11 | ) 12 | expect_equal( 13 | calc_phosphate_availability( 14 | A_P_AL = c(25, 20), 15 | A_P_CC = c(1.5, 3), 16 | A_P_WA = c(24,20), 17 | B_LU_BRP = c(2014, 265) 18 | ), 19 | expected = c(2.4, 4.5713), 20 | tolerance = 0.001 21 | ) 22 | }) 23 | 24 | test_that("eval_phosphate_availability works", { 25 | expect_equal( 26 | ind_phosphate_availability( 27 | D_PBI = 2 28 | ), 29 | expected = 0.3804136, 30 | tolerance = 0.001 31 | ) 32 | expect_equal( 33 | ind_phosphate_availability( 34 | D_PBI = 0:7 35 | ), 36 | expected = c(0.004930119, 0.074904299, 0.380413642, 0.742746233, 0.919277030, 0.977081441, 0.993682642, 0.998272957), 37 | tolerance = 0.001 38 | ) 39 | }) 40 | -------------------------------------------------------------------------------- /tests/testthat/test-pmn.R: -------------------------------------------------------------------------------- 1 | test_that("calc_pmn works", { 2 | expect_equal( 3 | calc_pmn( 4 | A_N_PMN = 65, 5 | B_LU_BRP = 265, 6 | B_SOILTYPE_AGR = "rivierklei" 7 | ), 8 | expected = 74.21, 9 | tolerance = 0.01 10 | ) 11 | expect_equal( 12 | calc_pmn( 13 | A_N_PMN = seq(15,75,length.out = 8), 14 | B_LU_BRP = c(rep(265,4), rep(235,4)), 15 | B_SOILTYPE_AGR = rep(c("rivierklei", "veen", "veen", "dekzand"),2) 16 | ), 17 | expected = c(17.13,23.57,32.14,38.43,25.82,57.86,66.43,64.67), 18 | tolerance = 0.1 19 | ) 20 | }) 21 | 22 | test_that("eval_pmn works", { 23 | expect_equal( 24 | ind_pmn( 25 | D_PMN = 65 26 | ), 27 | expected = 0.9999, 28 | tolerance = 0.001 29 | ) 30 | expect_equal( 31 | ind_pmn( 32 | D_PMN = c(seq(from = 0, to = 60, by = 10),500) 33 | ), 34 | expected = c(0.035,0.1699,0.561,.8996,.985,.998,.9997,1), 35 | tolerance = 0.001 36 | ) 37 | }) -------------------------------------------------------------------------------- /tests/testthat/test-precipitation_surplus.R: -------------------------------------------------------------------------------- 1 | test_that("whether calc_psp works", { 2 | expect_equal( 3 | calc_psp( 4 | B_LU_BRP = c(265, 265, 266, 266, 235, 235), 5 | M_GREEN = c(TRUE, FALSE, TRUE, FALSE, TRUE, FALSE) 6 | ), 7 | expected = c(220.993, 228.180, 220.993, 246.870, 403.549, 417.695), 8 | tolerance = 0.01 9 | ) 10 | }) -------------------------------------------------------------------------------- /tests/testthat/test-precipitation_surpluss.R: -------------------------------------------------------------------------------- 1 | test_that("calc_psp works", { 2 | expect_equal( 3 | calc_psp(c(233,256,266,259,2014),rep(FALSE,5) 4 | ), 5 | expected = c(417.695, 413.397, 209.475, 354.146, 387.193), 6 | tolerance = 0.01 7 | ) 8 | 9 | expect_equal( 10 | calc_psp(c(233,256,266,259,2014),rep(TRUE,5) 11 | ), 12 | expected = c(396.377, 370.138, 239.698, 332.205, 387.193), 13 | tolerance = 0.01 14 | ) 15 | }) 16 | 17 | 18 | test_that("ind_psp works", { 19 | expect_equal( 20 | ind_psp(c(100,200,300,350,400),rep(233,5) 21 | ), 22 | expected = c(0.01831531, 0.13497224, 0.75785828, 0.96893680, 0.99731747), 23 | tolerance = 0.001 24 | ) 25 | 26 | 27 | expect_equal( 28 | ind_psp(c(50,100,200,250,300),rep(265,5) 29 | ), 30 | expected = c(0.006737937, 0.018315306, 0.134972242, 0.356451928, 0.757858283), 31 | tolerance = 0.001 32 | ) 33 | 34 | }) 35 | -------------------------------------------------------------------------------- /tests/testthat/test-recommendations.R: -------------------------------------------------------------------------------- 1 | # Load data 2 | dt <- OBIC::binnenveld[ID <=5] 3 | B_LU_BRP <- c(233,266,2014,256,308) 4 | B_SOILTYPE_AGR <- c("dekzand","rivierklei","dekzand","rivierklei","dekzand") 5 | 6 | dt.obi <- obic_farm(dt) 7 | dt.score <- dt.obi$fields 8 | 9 | # Check wrapper function 10 | test_that("obic_recommendations_bkp works", { 11 | 12 | dt.score <- dt.score[,mget(colnames(dt.score)[!grepl('^RM',colnames(dt.score))])] 13 | 14 | 15 | # Example 1 16 | out1 <- obic_recommendations_bkp(dt.score = dt.score, B_LU_BRP, B_SOILTYPE_AGR) 17 | 18 | # test sample 1 19 | expect_equal( 20 | object = out1[c(1,4,12,18,20,24),recommendation], 21 | expect = c("Herstel de verdichte ondergrond", 22 | "Bekalk de bodem tot de geadviseerde pH is bereikt", 23 | "Verbouw (meer) groenbemesters", 24 | "Pas niet-kerende grondbewerking toe", 25 | "Voer (extra) compost aan", 26 | "Voer (extra) compost aan") 27 | ) 28 | 29 | # Example 2 30 | dt.score[,c(colnames(dt.score)) := 0] 31 | out2 <- obic_recommendations_bkp(dt.score = dt.score[1,], B_LU_BRP = 263, B_SOILTYPE_AGR = B_SOILTYPE_AGR[1]) 32 | 33 | # test sample 2 34 | expect_equal( 35 | object = out2$recommendation, 36 | expect = c("Bemest confrom het bemestingsadvies", 37 | "Pas niet-kerende grondbewerking toe", 38 | "Bekalk de bodem tot de geadviseerde pH is bereikt", 39 | "Voer (extra) compost aan", 40 | "Verbouw (meer) groenbemesters") 41 | ) 42 | 43 | # Example 3 44 | dt.score[,c(colnames(dt.score)) := 1] 45 | out3 <- obic_recommendations_bkp(dt.score = dt.score[1,], B_LU_BRP = 263, B_SOILTYPE_AGR = B_SOILTYPE_AGR[1]) 46 | 47 | # test sample 3 48 | expect_equal( 49 | object = out3$recommendation, 50 | expect = c("Herstel de verdichte ondergrond", 51 | "Voer (extra) compost aan", 52 | "Bemest confrom het bemestingsadvies", 53 | "Verbouw (meer) diepwortelende gewassen", 54 | "Verbouw (meer) groenbemesters") 55 | ) 56 | 57 | 58 | }) 59 | -------------------------------------------------------------------------------- /tests/testthat/test-resistance.R: -------------------------------------------------------------------------------- 1 | test_that("eval_resistance works", { 2 | expect_equal( 3 | ind_resistance( 4 | A_SOM_LOI = 2 5 | ), 6 | expected = 0.2662949, 7 | tolerance = 0.001 8 | ) 9 | expect_equal( 10 | ind_resistance( 11 | A_SOM_LOI = 0:8 12 | ), 13 | expected = c(0.004491325, 0.049927928, 0.266294851, 0.620746792, 0.857766085, 0.953887800, 0.985788749, 0.995689634, 0.998698998), 14 | tolerance = 0.001 15 | ) 16 | }) -------------------------------------------------------------------------------- /tests/testthat/test-root_depth.R: -------------------------------------------------------------------------------- 1 | test_that("calc_depth works", { 2 | expect_equal( 3 | calc_root_depth( 4 | B_LU_BRP = 265 5 | ), 6 | expected = 0.1, 7 | tolerance = 0.001 8 | ) 9 | expect_equal( 10 | calc_root_depth( 11 | B_LU_BRP = c(265, 2719, 266, 1079) 12 | ), 13 | expected = c(0.1, 0.25, 0.1, 0.25), 14 | tolerance = 0.001 15 | ) 16 | }) -------------------------------------------------------------------------------- /tests/testthat/test-sealing.R: -------------------------------------------------------------------------------- 1 | test_that("calc_sealing works", { 2 | expect_equal( 3 | calc_sealing_risk( 4 | A_CLAY_MI = 20, 5 | A_SOM_LOI = 5 6 | ), 7 | expected = 8.4375, 8 | tolerance = 0.001 9 | ) 10 | expect_equal( 11 | calc_sealing_risk( 12 | A_CLAY_MI = c(25, 20), 13 | A_SOM_LOI = c(1.5, 8) 14 | ), 15 | expected = c(8.6, 10), 16 | tolerance = 0.001 17 | ) 18 | }) 19 | 20 | test_that("ind_sealing works", { 21 | expect_equal( 22 | ind_sealing( 23 | D_SE = 8.6, 24 | B_LU_BRP = 2014 25 | ), 26 | expected = 0.9609441, 27 | tolerance = 0.001 28 | ) 29 | expect_equal( 30 | ind_sealing( 31 | D_SE = c(8.6, 2), 32 | B_LU_BRP = c(2014, 265) 33 | ), 34 | expected = c(0.9609441, 1), 35 | tolerance = 0.001 36 | ) 37 | }) -------------------------------------------------------------------------------- /tests/testthat/test-sombalance.R: -------------------------------------------------------------------------------- 1 | test_that("calc_sombalance works", { 2 | expect_equal( 3 | # aardappel 4 | calc_sombalance( 5 | A_SOM_LOI = 7.92, 6 | A_P_AL = 63, 7 | A_P_WA = 65, 8 | B_LU_BRP = 3732, 9 | M_COMPOST = 3, 10 | M_GREEN = TRUE 11 | ), 12 | expected = c(1117), 13 | tolerance = 0.1 14 | ) 15 | set.seed(123) 16 | a= sample(24:100,10) 17 | expect_equal( 18 | calc_sombalance( 19 | A_SOM_LOI = seq(1,20,length.out = 10), 20 | A_P_AL = a, 21 | A_P_WA = a*1.05, 22 | B_LU_BRP = rep(3732,10), 23 | M_COMPOST = rep(3,10), 24 | M_GREEN = rep(TRUE,10) 25 | ), 26 | expected = c(2360,1692,1366,1161,1022,924,855,807,991,1294), 27 | tolerance = 1 28 | ) 29 | expect_equal( 30 | calc_sombalance( 31 | A_SOM_LOI = seq(1,20,length.out = 10), 32 | A_P_AL = a, 33 | A_P_WA = a*1.05, 34 | B_LU_BRP = rep(265,10), 35 | M_COMPOST = rep(3,10), 36 | M_GREEN = rep(TRUE,10) 37 | ), 38 | expected = c(3718,2717,2391,2186,2047,2615,1880,1832,1800,1780), 39 | tolerance = 1 40 | ) 41 | }) 42 | -------------------------------------------------------------------------------- /tests/testthat/test-waterstress.R: -------------------------------------------------------------------------------- 1 | test_that("calc_waterstressindex works", { 2 | expect_equal( 3 | calc_waterstressindex( 4 | B_HELP_WENR= c('gMn25C','bMn15A','gMn25C','bMn15A','gMn25C','bMn15A'), 5 | B_LU_BRP = c(3732,265,258,172,343,2709), 6 | B_GWL_CLASS = c('GtIV','GtV','GtIII','GtII','GtVI','GtIV') 7 | ), 8 | expected = c(5,7,0,0,0,5), 9 | tolerance = .1 10 | ) 11 | }) 12 | 13 | test_that("ind_waterstressindex works", { 14 | expect_equal( 15 | ind_waterstressindex( 16 | D_WSI = c(5,9,0,0,0,5) 17 | ), 18 | expected = (100-c(5,9,0,0,0,5))/100, 19 | tolerance = .1 20 | ) 21 | }) 22 | -------------------------------------------------------------------------------- /tests/testthat/test-winderodibility.R: -------------------------------------------------------------------------------- 1 | test_that("calc_winderodibility works", { 2 | expect_equal( 3 | calc_winderodibility( 4 | A_CLAY_MI=25, 5 | A_SILT_MI=15, 6 | B_LU_BRP = 3732 7 | ), 8 | expected = c(0.27), 9 | tolerance = 0.01 10 | ) 11 | a = c(14, 22, 25, 26, 5, 19, 9, 3, 8, 7) 12 | expect_equal( 13 | calc_winderodibility( 14 | A_CLAY_MI=a, 15 | A_SILT_MI=rev(a), 16 | B_LU_BRP = rep(3732,10) 17 | ), 18 | expected = c(0.4556666, 0.3536575, 0.3733895, 0.3095705, 0.4174766, 0.4174766, 0.3095705, 0.3733895, 0.3536575, 0.4556666), 19 | tolerance = 0.01 20 | ) 21 | }) 22 | 23 | test_that("ind_winderodibility works", { 24 | expect_equal( 25 | ind_winderodibility( 26 | D_P_DU = 0.01 27 | ), 28 | expected = c(0.27), 29 | tolerance = 0.99 30 | ) 31 | expect_equal( 32 | ind_winderodibility( 33 | D_P_DU = c(.48,0.21,.33,.29,.38,.38,.29,.33,.21,.48) 34 | ), 35 | expected = 1-c(.48,0.21,.33,.29,.38,.38,.29,.33,.21,.48), 36 | tolerance = 0.01 37 | ) 38 | }) 39 | 40 | 41 | -------------------------------------------------------------------------------- /tests/testthat/test-workability.R: -------------------------------------------------------------------------------- 1 | test_that("calc_workability works", { 2 | expect_equal( 3 | calc_workability( 4 | A_CLAY_MI = c(15.6,13.6, 4.3, 22.6, 1.9, 2.9, 3.1, 4.3, 15.6, 1.9), 5 | A_SILT_MI = c(16.7,30.5, 11.8, 36.6, 9.2, 8.6, 10.6, 11.8, 16.7, 9.2), 6 | B_LU_BRP = c(233, 234, 236, 256, 259, 265, 265, 317, 2014, 259), 7 | B_SOILTYPE_AGR = c('zeeklei','zeeklei', 'dekzand','zeeklei', 'dekzand', 'dekzand', 'veen', 'dekzand', 'zeeklei', 'maasklei'), 8 | B_GWL_GLG = c(173,139, 106, 144, 115, 113, 42, 106, 173, 115), 9 | B_GWL_GHG = c(21, 18, 62, 70, 49, 81, 9, 62, 21, 49), 10 | B_GWL_ZCRIT = c(400, 400, 400, 400, 400, 400, 400, 400, 400, 400) 11 | ), 12 | expected = c(0.57,0.45,0.54,0.84,0.80, 1, 0.00,0.76,0.66, 0.66), 13 | tolerance = .01 14 | ) 15 | }) 16 | 17 | test_that("ind_workability works", { 18 | expect_equal( 19 | ind_workability( 20 | D_WO = c(0, 0.75, 1, 0, 0.5, 1), 21 | B_LU_BRP = c(256, 256, 256, 265, 265, 265) 22 | ), 23 | expected = c(0, 0.5, 1, 0, 0.5, 1), 24 | tolerance = .015 25 | ) 26 | }) 27 | 28 | test_that('diffrenttiation maize on sand vs mais on clay workabilty season works',{ 29 | expect_true(calc_workability( 30 | A_CLAY_MI = c( 1.9), 31 | A_SILT_MI = c(9.2), 32 | B_LU_BRP = c(259), 33 | B_SOILTYPE_AGR = c( 'dekzand'), 34 | B_GWL_GLG = c(115), 35 | B_GWL_GHG = c(49), 36 | B_GWL_ZCRIT = c(400) 37 | )> 38 | calc_workability( 39 | A_CLAY_MI = c( 1.9), 40 | A_SILT_MI = c(9.2), 41 | B_LU_BRP = c(259), 42 | B_SOILTYPE_AGR = c( 'zeeklei'), 43 | B_GWL_GLG = c(115), 44 | B_GWL_GHG = c(49), 45 | B_GWL_ZCRIT = c(400) 46 | )) 47 | }) 48 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/Formula_K-unsaturated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/vignettes/Formula_K-unsaturated.png -------------------------------------------------------------------------------- /vignettes/OBIC_score_integratie_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/AgroCares/Open-Bodem-Index-Calculator/46df3c34c23f0300b2d692a2b43a54785eff5f74/vignettes/OBIC_score_integratie_2.png -------------------------------------------------------------------------------- /vignettes/description-of-the-columns.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Description of the columns for OBIC" 3 | date: "`r Sys.Date()`" 4 | output: rmarkdown::html_vignette 5 | vignette: > 6 | %\VignetteIndexEntry{description-of-the-columns} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | %\VignetteEncoding{UTF-8} 9 | --- 10 | 11 | ```{r, include = FALSE} 12 | knitr::opts_chunk$set( 13 | collapse = TRUE, 14 | comment = "#>" 15 | ) 16 | options(rmarkdown.html_vignette.check_title = FALSE) 17 | ``` 18 | 19 | ```{r setup} 20 | library(OBIC) 21 | ``` 22 | 23 | 24 | The main function of the package `obic_field()` requires as input a series of soil properties required to assess the soil quality. Alternatively, the function `obic_field_dt()` can be used, requiring a `data.table` with specific columns as input. 25 | These required input columns are specified in `OBIC::column_description.obic` and can also be seen in the table below 26 | 27 | 28 | ```{r table} 29 | desc <- OBIC::column_description.obic 30 | knitr::kable(desc) 31 | ``` 32 | -------------------------------------------------------------------------------- /vignettes/packages.bib: -------------------------------------------------------------------------------- 1 | @Manual{R-base, 2 | title = {R: A Language and Environment for Statistical Computing}, 3 | author = {{R Core Team}}, 4 | organization = {R Foundation for Statistical Computing}, 5 | address = {Vienna, Austria}, 6 | year = {2023}, 7 | url = {https://www.R-project.org/}, 8 | } 9 | 10 | @Manual{R-data.table, 11 | title = {data.table: Extension of `data.frame`}, 12 | author = {Matt Dowle and Arun Srinivasan}, 13 | year = {2023}, 14 | note = {R package version 1.14.8}, 15 | url = {https://CRAN.R-project.org/package=data.table}, 16 | } 17 | 18 | @Manual{R-ggplot2, 19 | title = {ggplot2: Create Elegant Data Visualisations Using the Grammar of Graphics}, 20 | author = {Hadley Wickham and Winston Chang and Lionel Henry and Thomas Lin Pedersen and Kohske Takahashi and Claus Wilke and Kara Woo and Hiroaki Yutani and Dewey Dunnington}, 21 | year = {2023}, 22 | note = {R package version 3.4.1}, 23 | url = {https://CRAN.R-project.org/package=ggplot2}, 24 | } 25 | 26 | @Manual{R-OBIC, 27 | title = {OBIC: Calculate the Open Bodem Index (OBI) Score}, 28 | author = {Sven Verweij and Gerard Ros and Yuki Fujita and Brent Riechelman and Kees {van den Dool}}, 29 | note = {R package version 2.2.0}, 30 | url = {https://github.com/AgroCares/Open-Bodem-Index-Calculator}, 31 | year = {2023}, 32 | } 33 | 34 | @Manual{R-patchwork, 35 | title = {patchwork: The Composer of Plots}, 36 | author = {Thomas Lin Pedersen}, 37 | year = {2022}, 38 | note = {R package version 1.1.2}, 39 | url = {https://CRAN.R-project.org/package=patchwork}, 40 | } 41 | 42 | @Book{ggplot22016, 43 | author = {Hadley Wickham}, 44 | title = {ggplot2: Elegant Graphics for Data Analysis}, 45 | publisher = {Springer-Verlag New York}, 46 | year = {2016}, 47 | isbn = {978-3-319-24277-4}, 48 | url = {https://ggplot2.tidyverse.org}, 49 | } 50 | 51 | -------------------------------------------------------------------------------- /vignettes/workability_references.bib: -------------------------------------------------------------------------------- 1 | @techreport{Huinink2018, 2 | author = {Huinink, J.Th.M.}, 3 | file = {:C\:/Users/Brent Riechelman/Documents/Projecten/OBIC/OBIC functies bodembewerkbaarheid/Huinink 2018 Bodemgeschiktheidsbeoordeling voor landbouw, bosbouw en recreatie (1).pdf:pdf}, 4 | institution = {BodemConsult-Arnhem}, 5 | pages = {104}, 6 | title = {{Bodem/perceel geschiktheidsbeoordeling voor Landbouw, Bosbouw en Recreatie: t.b.v. een optimalisatie van grondwater- en oppervlaktewaterpeilbeheer: state of the art 2018}}, 7 | year = {2018} 8 | } 9 | --------------------------------------------------------------------------------