From 5b609f9c0b9d41377e67800fdb77811ffa90d0d5 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:20:17 -0400 Subject: [PATCH 01/97] rewrite create_n_rate_data data raw script --- .../data.land/data-raw/create_n_rate_data.R | 168 ++++++++++++++++-- 1 file changed, 152 insertions(+), 16 deletions(-) diff --git a/modules/data.land/data-raw/create_n_rate_data.R b/modules/data.land/data-raw/create_n_rate_data.R index b5a7b57856..dbd9891bc2 100644 --- a/modules/data.land/data-raw/create_n_rate_data.R +++ b/modules/data.land/data-raw/create_n_rate_data.R @@ -1,21 +1,157 @@ #!/usr/bin/env Rscript +# +# Build the ca_n_application_rate packaged dataset from the raw +# fertilization spreadsheet. Reads the raw TSV directly, classifies each +# row by stage and unit, converts oz N per tree rows to lb N per acre via +# DEMETER orchard density, sums within year stage rows for crops that +# lack a total season row, and writes both a cached CSV in data-raw/ and +# the packaged .rda in data/ via usethis::use_data -# Build the ca_n_application_rate packaged dataset from the harmonized -# N application rate CSV produced by the fertilization harmonization -# script. The source CSV lives in the shared geo directory; a copy is -# kept here in data-raw/ for reproducibility. - -ca_n_application_rate <- readr::read_csv( - file.path("data-raw", "n_application_rates.csv"), - col_types = readr::cols( - pft_group = readr::col_character(), - crop = readr::col_character(), - min_n_lbs_acre = readr::col_double(), - max_n_lbs_acre = readr::col_double(), - source = readr::col_character(), - min_n_g_m2 = readr::col_double(), - max_n_g_m2 = readr::col_double() - ) +# pull in build time helpers we expose in R/. +source(file.path("R", "tpa_lookup.R")) +source(file.path("R", "oz_per_tree_to_lb_per_acre.R")) + +raw_path <- file.path( + "/projectnb/dietzelab/ccmmf/usr/akash/management/fertilization", + "CCMMF Fertilization - N_Fertilization.tsv" ) +out_csv <- file.path("data-raw", "n_application_rates.csv") + +# 1 lb/acre = 0.112085 g/m^2. +LBS_ACRE_TO_G_M2 <- 0.112085 + +# stages whose rows sum to an annual total for the same crop. other stage +# tags (e.g. "first season", "first-leaf trees") describe year conditional +# rates and get treated as separate years. +WITHIN_YEAR_STAGES <- c( + "preplant", "starter", "starter ", "sidedress", + "topdress", "foliar", "in-season" +) + +PEcAn.logger::logger.info("Reading raw fertilization TSV: ", raw_path) +raw <- readr::read_tsv(raw_path, show_col_types = FALSE) |> + dplyr::select( + pft_group = "PFT Group", + crop = "Crop", + stage = "PlantStage", + min_n = "MINN", + max_n = "MAXN", + unit = "Unit", + source = "Source" + ) + +# drop rows where both min and max are NA. onions and potato in the +# current raw fall into this case and end up flagged below. +usable <- raw |> + dplyr::filter(!is.na(.data$min_n) | !is.na(.data$max_n)) |> + dplyr::mutate( + min_n = dplyr::coalesce(.data$min_n, 0), + max_n = dplyr::coalesce(.data$max_n, .data$min_n) + ) + +# convert any oz N per tree rows to lb N per acre using DEMETER orchard +# density. currently only almond young tree rows hit this branch. +oz_rows <- usable |> + dplyr::filter(.data$unit == "oz N/tree") |> + dplyr::mutate( + tpa = vapply(.data$crop, tpa_lookup, integer(1)), + min_n = oz_per_tree_to_lb_per_acre(.data$min_n, .data$tpa), + max_n = oz_per_tree_to_lb_per_acre(.data$max_n, .data$tpa), + unit = "lbs N/acre" + ) |> + dplyr::select(-"tpa") + +all_lb <- dplyr::bind_rows( + usable |> dplyr::filter(.data$unit == "lbs N/acre"), + oz_rows +) |> + dplyr::mutate( + row_kind = dplyr::case_when( + is.na(.data$stage) | .data$stage == "" ~ "total", + tolower(.data$stage) %in% .env$WITHIN_YEAR_STAGES ~ "within_year", + TRUE ~ "year_conditional" + ) + ) + +## pick an aggregation strategy per crop. if a total season row exists, +## use it (envelope across total rows). otherwise sum within year stages +## to get an annual total, or envelope across year conditional rows. this +## is the fix that recovers crops the old script silently dropped. +strategy <- all_lb |> + dplyr::summarize( + strategy = dplyr::case_when( + any(.data$row_kind == "total") ~ "envelope_total", + any(.data$row_kind == "within_year") ~ "sum_stages", + any(.data$row_kind == "year_conditional") ~ "envelope_year", + TRUE ~ "drop" + ), + .by = c(pft_group, crop) + ) + +envelope_total <- all_lb |> + dplyr::semi_join( + strategy |> dplyr::filter(.data$strategy == "envelope_total"), + by = c("pft_group", "crop") + ) |> + dplyr::filter(.data$row_kind == "total") |> + dplyr::summarize( + min_n_lbs_acre = min(.data$min_n), + max_n_lbs_acre = max(.data$max_n), + source = paste(unique(.data$source), collapse = "; "), + .by = c(pft_group, crop) + ) + +sum_stages <- all_lb |> + dplyr::semi_join( + strategy |> dplyr::filter(.data$strategy == "sum_stages"), + by = c("pft_group", "crop") + ) |> + dplyr::filter(.data$row_kind == "within_year") |> + dplyr::summarize( + min_n_lbs_acre = sum(.data$min_n), + max_n_lbs_acre = sum(.data$max_n), + source = paste(unique(.data$source), collapse = "; "), + .by = c(pft_group, crop) + ) + +envelope_year <- all_lb |> + dplyr::semi_join( + strategy |> dplyr::filter(.data$strategy == "envelope_year"), + by = c("pft_group", "crop") + ) |> + dplyr::filter(.data$row_kind == "year_conditional") |> + dplyr::summarize( + min_n_lbs_acre = min(.data$min_n), + max_n_lbs_acre = max(.data$max_n), + source = paste(unique(.data$source), collapse = "; "), + .by = c(pft_group, crop) + ) + +ca_n_application_rate <- dplyr::bind_rows(envelope_total, sum_stages, envelope_year) |> + dplyr::mutate( + min_n_g_m2 = round(.data$min_n_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), + max_n_g_m2 = round(.data$max_n_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3) + ) |> + dplyr::arrange(.data$pft_group, .data$crop) + +PEcAn.logger::logger.info(sprintf( + "Harmonized %d crops into n_application_rates.csv", + nrow(ca_n_application_rate) +)) + +# flag crops whose raw rows had NA for both MINN and MAXN. +raw_crops <- unique(raw$crop) +out_crops <- unique(ca_n_application_rate$crop) +dropped <- setdiff(raw_crops, out_crops) +if (length(dropped) > 0) { + PEcAn.logger::logger.warn( + "Crops dropped (no usable rate data in raw spreadsheet): ", + paste(dropped, collapse = ", "), + ". Their raw rows have NA for both MINN and MAXN." + ) +} + +readr::write_csv(ca_n_application_rate, out_csv) +PEcAn.logger::logger.info("Wrote ", out_csv) usethis::use_data(ca_n_application_rate, overwrite = TRUE) From af7171aa829081b6abb714e5c5174c94553db474 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:20:17 -0400 Subject: [PATCH 02/97] refresh n_application_rates csv --- .../data-raw/n_application_rates.csv | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/modules/data.land/data-raw/n_application_rates.csv b/modules/data.land/data-raw/n_application_rates.csv index f733617ab9..71d1542f43 100644 --- a/modules/data.land/data-raw/n_application_rates.csv +++ b/modules/data.land/data-raw/n_application_rates.csv @@ -1,34 +1,42 @@ pft_group,crop,min_n_lbs_acre,max_n_lbs_acre,source,min_n_g_m2,max_n_g_m2 -woody,Avocado,67,100,"Rosenstock et al., 2013",7.51,11.209 +rice,Rice,110,145,"Rosenstock et al., 2013",12.329,16.252 +row,Alfalfa,0,0,Meyer et al. 2007. Pub. 8292,0,0 +row,Barley,65,250,CDFA-FREP & UC Davis,7.286,28.021 +row,"Bean, blackeye",0,8,CDFA-FREP & UC Davis,0,0.897 +row,"Bean, common",70,300,CDFA-FREP & UC Davis,7.846,33.626 row,"Bean, dry",86,116,"Rosenstock et al., 2013",9.639,13.002 +row,"Bean, lima",55,233,CDFA-FREP & UC Davis,6.165,26.116 row,Broccoli,100,240,"Rosenstock et al., 2013; CDFA-FREP & UC Davis",11.209,26.9 row,Carrot,100,250,"Rosenstock et al., 2013",11.209,28.021 +row,Cauliflower,40,60,CDFA-FREP & UC Davis,4.483,6.725 row,Celery,200,275,"Rosenstock et al., 2013",22.417,30.823 row,Corn,150,275,"Rosenstock et al., 2013",16.813,30.823 row,"Corn, sweet",100,200,"Rosenstock et al., 2013",11.209,22.417 row,Cotton,100,200,"Rosenstock et al., 2013",11.209,22.417 -woody,"Grape, raisin",20,60,"Rosenstock et al., 2013",2.242,6.725 -woody,Grapevines,20,60,Meyer et al. 2007. Pub. 8296,2.242,6.725 row,Lettuce,170,220,"Rosenstock et al., 2013",19.054,24.659 row,"Melon, cantaloupe",80,150,"Rosenstock et al., 2013",8.967,16.813 row,"Melon, watermelon",0,160,"Rosenstock et al., 2013",0,17.934 +row,Melons,80,200,CDFA-FREP & UC Davis,8.967,22.417 row,Melons (mixed),100,150,"Rosenstock et al., 2013",11.209,16.813 -woody,Nectarine,100,150,"Rosenstock et al., 2013",11.209,16.813 row,Oats,50,120,"Rosenstock et al., 2013",5.604,13.45 row,Onion,100,400,"Rosenstock et al., 2013",11.209,44.834 +row,"Pepper, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 +row,"Pepper, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 +row,Safflower,100,150,"Rosenstock et al., 2013",11.209,16.813 +row,Strawberry,150,300,"Rosenstock et al., 2013",16.813,33.626 +row,"Tomatoes, fresh market",125,350,"Rosenstock et al., 2013",14.011,39.23 +row,"Tomatoes, processing",100,150,"Rosenstock et al., 2013",11.209,16.813 +row,Wheat,100,240,"Rosenstock et al., 2013",11.209,26.9 +woody,Almonds,30,255,Brown et al. 2020 NBMP Table 2,3.363,28.582 +woody,Avocado,67,100,"Rosenstock et al., 2013",7.51,11.209 +woody,"Grape, raisin",20,60,"Rosenstock et al., 2013",2.242,6.725 +woody,Grapevines,20,60,Meyer et al. 2007. Pub. 8296,2.242,6.725 +woody,Nectarine,100,150,"Rosenstock et al., 2013",11.209,16.813 woody,"Peach, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 woody,"Peach, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 woody,"Peach, cling",50,100,"Rosenstock et al., 2013",5.604,11.209 woody,"Peach, free",50,100,"Rosenstock et al., 2013",5.604,11.209 -row,"Pepper, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 -row,"Pepper, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 woody,Pistachios,100,225,"Rosenstock et al., 2013",11.209,25.219 woody,"Plums, dried",0,100,"Rosenstock et al., 2013",0,11.209 woody,"Plums, fresh",110,150,"Rosenstock et al., 2013",12.329,16.813 -rice,Rice,110,145,"Rosenstock et al., 2013",12.329,16.252 -row,Safflower,100,150,"Rosenstock et al., 2013",11.209,16.813 -row,Strawberry,150,300,"Rosenstock et al., 2013",16.813,33.626 -row,"Tomatoes, fresh market",125,350,"Rosenstock et al., 2013",14.011,39.23 -row,"Tomatoes, processing",100,150,"Rosenstock et al., 2013",11.209,16.813 woody,Walnuts,150,200,"Rosenstock et al., 2013",16.813,22.417 -row,Wheat,100,240,"Rosenstock et al., 2013",11.209,26.9 From 9079a6518850a9b620ae39fac157fbfe215ded88 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:20:17 -0400 Subject: [PATCH 03/97] rebuild ca_n_application_rate rda --- .../data.land/data/ca_n_application_rate.rda | Bin 1308 -> 1360 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/modules/data.land/data/ca_n_application_rate.rda b/modules/data.land/data/ca_n_application_rate.rda index 9f93108526d77dc98a0232d03f2ba3bb966da1d1..6ac8e2f5bb6768f2e4e052cfd583fb2bfc387fed 100644 GIT binary patch literal 1360 zcmV-W1+V%-T4*^jL0KkKS>oiQhyVoufB*mgf8YIo{r~^3|L_0*|KVsVhR(ZSRS{G+ zaEi%=x-ZZKo5yUS**bs(1d@tPw5O({Y7IS1fC1?bQ$~#d^#PzX2c-248UO~G2GleG z>H}(M&}=^AJTKmY(9paT#GsA-_Y1|R{D z007ViB9%YVnx2!?+Kmk!lRymsG{j_SlOdt%14e)V05miJ0~0_Q27m)WrU-yE(9=dh zXwWib(WXE!Mok8pFh+(W1k*q<8Usd{hMHu;X`pDqG+`K-Fi9av>Y92rG58UgALQ$WyY8UO%j0MGyimf&>QFRL?*nk-^Xph6_bQrMdHHnE1& ziqL~63?R-_tnFO_8(vfhrETS0`0k<6s;$3N%e_Vu1eE3h6f5U~Q(z|{m<5T0g!IT^ zkQ|mM-M!$%b?-t%O28dU`&%U-Fzg`^U`o&3*m?w#g}{YQRTAB*^LB&5CGz$g?@vyg zirBl)gBuKVQ2C?1z}gTYUJsTF{c?AZKMp@g#`}ShEuaibOsz45|Q;Fn~Y| zB$4VFEnWf4%q9e^2>|0+%}F@|FAOB0$pQ{DAlwX+*WVlfBacH=&lI**Y>6NY0f}p{ag3e- zJTfdE)GMI9mua^)lu~+0n90Vu><=xPSOHgASTl!AXE<|AacFtfG^EW~BZfEt&F4M^ z$&UmRiC~xjY6Up)QXG&NvYJUm%oPljgS0-Ng-G6!kz;`3-i)s7%#^6LF{B&o_de~g zfg1Il!g7<(jx5WK)Eicw`mOsyObc+XSedmF%GP6DU<|=+mVD3 zI6)w{?4~$!fJh=5Ta=w3kVyneNfeP#;NuK7doD^!-CmG3Jf6G=J#GxNq?Qa1?wYa3 zJ`jlMOL-RB0SgR5h&oI zB3pK8NN{s85w<0@%hMSoKsc&KNi>2+{f=7_OJ9qu#1pF>_q)Al4#2cA7u4@hcsBIgF8)Hks&)lyRm!0AToa zl)2CVF*VY#5HPk9SzPZ&fC^mbEo@@`P*-RVN-LGJ@qT2EqSZQM;l{@)`9`zLKU> S$`Ho?i@744C`fT~QN#cWxn`UI literal 1308 zcmV+%1>^ccT4*^jL0KkKS&@w&#{dN>|NsC0|DAn*{r`Wb-|PSX|KUg?0M4smR1rir zaEi%*uqn_4nd0mnT(=~FFeMaGwK8d8Q0~6HECxt&z1f-Y}FsbT(rqC$R06jn&05k@G00000&;S5v0002fMKuj1#LXrE zCX9wd1i(PhF){$aN2!EhhoA_=VKf;S(rJ;A111Q`ff`~OVHk#(0E`I0L6b~|jD~>3 zz)V8{F&b%!fiMM1Bmk3Wo|8B zh{|XfDMAU3&C?~yCV(C~v)qen!C6sCUpZcT4U7hi_0u}<>|D`2&CHlWQhCUM7ywWN z9JxlIas(B&sG^jjMWu?wSfm`fI2gTa6aD{%$|<+@t;n*FFipWj*(W0tS1^gV zq(fn9OLwg#bZs@e-exWhyQtbigi%P6Ms*TKRRH}Eml7(dgcKO6*zjWqpv?m|U+g$3 zB?zN%h9n?D$S{n-z=LiP3Q=r!N>51dE@rAnfrh3^8W7ph z5@QHa5@4i}KLsS4Iu0c&l#w@!kX8;avm~htC`60Yib+XY5q^>5Qc1R>GLlG-SM}mj z$j3-v3JTJ2Dd8y*Te{XKJ{d^8WSNqZN&PD0SzWKU%Gz=A0-j%?UmtA(*w@kpX6lFN zPqfD+SM?Xa-eD0HNJ>YsVyFOm`Wmn{%M2tYPU*Br^l%_R%wQbt|L^a&&^%0ppefs$ z5HaU@;#K!(|{O40wRS6lvR}#3Nok!5Kw?Z5=tQe(N0s`>_y1e zqw9&!a>I+R>0|3cbuLE@l#&5;!uJv-a+)8vh4X&&Rebq@w|<(}l93TIWna6a%;(|9 zZ(`1}_WMHQhVDsD8N=ev5`|7OwK+z^*ep<_cT#9Yei2`VL}#Ka!~nu_>JWO!Zc*DS zvcq`|wMUp->n>ne_4Y~%lcNJ;I6V-ZJWPjLB@z%_u&$RCuo@O`a&+UJGf$7Hz)_B} zftg08u2x#*4TCJ1`z(5S70)Qjv0iI0l6_q@sqo(ormhV=w%(nCH=!@(013;)kGD9u z-x*$#V;xP7eWU=umk&XcM0$iz+9m8Xgy5rOjT#XxnQytN7@#W1))+ zFvEKJezn63MRfJ-H{j@nX`WOc%*U%0q<8vjnX*iFIf-*7X5u%tcpq6^O2L z5}57HC3kA3N;Mb4bp=eS+sjv9+H~ z&T6_AvFUYpR~p5zRM%|_H0$d;eNY19C932=Eew(NDVk?76gU7;SzsE4+>%FKSVe8q zj6!N)-jCpN2vEt_l>}H Date: Mon, 18 May 2026 14:21:08 -0400 Subject: [PATCH 04/97] add oz_per_tree_to_lb_per_acre helper --- .../data.land/R/oz_per_tree_to_lb_per_acre.R | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 modules/data.land/R/oz_per_tree_to_lb_per_acre.R diff --git a/modules/data.land/R/oz_per_tree_to_lb_per_acre.R b/modules/data.land/R/oz_per_tree_to_lb_per_acre.R new file mode 100644 index 0000000000..df2113012d --- /dev/null +++ b/modules/data.land/R/oz_per_tree_to_lb_per_acre.R @@ -0,0 +1,20 @@ +#' Convert N application rate from oz N per tree to lb N per acre +#' +#' California extension guidelines for young orchards (CDFA FREP, UC ANR, +#' Almond Board) publish N rates per tree. This helper multiplies by +#' orchard density to give lb N per acre for pipelines that need per acre +#' inputs. +#' +#' @param oz_per_tree numeric vector. N rate in ounces N per tree. +#' @param tpa numeric scalar or vector. Orchard density in trees per acre. +#' Recycled to length of oz_per_tree if scalar. +#' +#' @return numeric vector. N rate in lb N per acre. NA inputs propagate. +#' +#' @examples +#' oz_per_tree_to_lb_per_acre(c(1, 3), tpa = 145) +#' +#' @export +oz_per_tree_to_lb_per_acre <- function(oz_per_tree, tpa) { + oz_per_tree * tpa / 16 +} From 4da526e7cffb86cd26a9376f820e32e890228c60 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:09 -0400 Subject: [PATCH 05/97] add doc for oz_per_tree_to_lb_per_acre --- .../man/oz_per_tree_to_lb_per_acre.Rd | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd diff --git a/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd b/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd new file mode 100644 index 0000000000..6f2e9ae194 --- /dev/null +++ b/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/oz_per_tree_to_lb_per_acre.R +\name{oz_per_tree_to_lb_per_acre} +\alias{oz_per_tree_to_lb_per_acre} +\title{Convert N application rate from oz N per tree to lb N per acre} +\usage{ +oz_per_tree_to_lb_per_acre(oz_per_tree, tpa) +} +\arguments{ +\item{oz_per_tree}{numeric vector. N rate in ounces N per tree.} + +\item{tpa}{numeric scalar or vector. Orchard density in trees per acre. +Recycled to length of oz_per_tree if scalar.} +} +\value{ +numeric vector. N rate in lb N per acre. NA inputs propagate. +} +\description{ +California extension guidelines for young orchards (CDFA FREP, UC ANR, +Almond Board) publish N rates per tree. This helper multiplies by +orchard density to give lb N per acre for pipelines that need per acre +inputs. +} +\examples{ +oz_per_tree_to_lb_per_acre(c(1, 3), tpa = 145) + +} From 00a4ce8e5138a3e1e29ec3eb8757d3156af38a4b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:09 -0400 Subject: [PATCH 06/97] add tpa_lookup helper --- modules/data.land/R/tpa_lookup.R | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/data.land/R/tpa_lookup.R diff --git a/modules/data.land/R/tpa_lookup.R b/modules/data.land/R/tpa_lookup.R new file mode 100644 index 0000000000..673b64d41b --- /dev/null +++ b/modules/data.land/R/tpa_lookup.R @@ -0,0 +1,45 @@ +#' Look up California orchard density (trees per acre) by crop +#' +#' Returns the median trees per acre value for a California orchard crop, +#' derived from the DEMETER cropland biomass dataset. DEMETER photo dates +#' span 2010 to 2016, so modern high density plantings may be under +#' represented. +#' +#' Supported crops: Almonds, Walnuts, Oranges, Pistachios. Other crops +#' return NA with a warning. +#' +#' @param crop character. Crop name (case insensitive). One of "Almonds", +#' "Walnuts", "Oranges", "Pistachios". +#' +#' @return integer scalar. Trees per acre for the requested crop. Returns +#' NA_integer_ with a warning if the crop is not supported. +#' +#' @source Kroodsma, D. A., & Field, C. B. (2006). Carbon sequestration +#' in California agriculture, 1980-2000. Ecological Applications, +#' 16(5), 1975-1985. +#' +#' @examples +#' tpa_lookup("Almonds") +#' tpa_lookup("walnuts") +#' +#' @export +tpa_lookup <- function(crop) { + # median trees per acre by crop from DEMETER. + # TODO: promote to a bundled age keyed dataset when per parcel + # orchard age becomes available. + medians <- c( + almonds = 80L, + walnuts = 41L, + oranges = 110L, + pistachios = 119L + ) + key <- tolower(crop) + if (!key %in% names(medians)) { + PEcAn.logger::logger.warn( + "No DEMETER TPA available for crop '", crop, "'. ", + "Supported: ", paste(names(medians), collapse = ", "), "." + ) + return(NA_integer_) + } + medians[[key]] +} From b738e651b12dd1481f7f351df636389777392d85 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:09 -0400 Subject: [PATCH 07/97] add doc for tpa_lookup --- modules/data.land/man/tpa_lookup.Rd | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 modules/data.land/man/tpa_lookup.Rd diff --git a/modules/data.land/man/tpa_lookup.Rd b/modules/data.land/man/tpa_lookup.Rd new file mode 100644 index 0000000000..2d712911c8 --- /dev/null +++ b/modules/data.land/man/tpa_lookup.Rd @@ -0,0 +1,36 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/tpa_lookup.R +\name{tpa_lookup} +\alias{tpa_lookup} +\title{Look up California orchard density (trees per acre) by crop} +\source{ +Kroodsma, D. A., & Field, C. B. (2006). Carbon sequestration + in California agriculture, 1980-2000. Ecological Applications, + 16(5), 1975-1985. +} +\usage{ +tpa_lookup(crop) +} +\arguments{ +\item{crop}{character. Crop name (case insensitive). One of "Almonds", +"Walnuts", "Oranges", "Pistachios".} +} +\value{ +integer scalar. Trees per acre for the requested crop. Returns + NA_integer_ with a warning if the crop is not supported. +} +\description{ +Returns the median trees per acre value for a California orchard crop, +derived from the DEMETER cropland biomass dataset. DEMETER photo dates +span 2010 to 2016, so modern high density plantings may be under +represented. +} +\details{ +Supported crops: Almonds, Walnuts, Oranges, Pistachios. Other crops +return NA with a warning. +} +\examples{ +tpa_lookup("Almonds") +tpa_lookup("walnuts") + +} From 70f56c8f32f469bf70e05429cfe8ef5139dc7662 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:51 -0400 Subject: [PATCH 08/97] rewrite create_compost_data with material class --- .../data.land/data-raw/create_compost_data.R | 98 ++++++++++++++----- 1 file changed, 72 insertions(+), 26 deletions(-) diff --git a/modules/data.land/data-raw/create_compost_data.R b/modules/data.land/data-raw/create_compost_data.R index 24055aa5f9..dcf97bd927 100644 --- a/modules/data.land/data-raw/create_compost_data.R +++ b/modules/data.land/data-raw/create_compost_data.R @@ -1,31 +1,77 @@ #!/usr/bin/env Rscript +# +# builds the ca_compost_amendment packaged dataset from the raw +# fertilization spreadsheet. reads the raw Compost TSV, renames columns +# into the snake_case schema we expose downstream, adds the CalRecycle +# material_class taxonomy (14 CCR section 17852), and writes a cached +# CSV plus the packaged .rda. +# +# the compost sampling distributions live in +# create_ca_compost_distributions.R as separate bundled tibbles. -# Build the ca_compost_amendment packaged dataset from the harmonized -# compost CSV produced by the fertilization harmonization script. - -ca_compost_amendment <- readr::read_csv( - file.path("data-raw", "compost_amendments.csv"), - col_types = readr::cols( - material = readr::col_character(), - cn_min = readr::col_double(), - cn_max = readr::col_double(), - cn_avg = readr::col_double(), - c_pct = readr::col_double(), - n_pct = readr::col_double(), - pan_pct = readr::col_double(), - n_class = readr::col_character(), - app_rate_min = readr::col_double(), - app_rate_max = readr::col_double(), - total_c_min_lbs_acre = readr::col_double(), - total_c_max_lbs_acre = readr::col_double(), - total_n_min_lbs_acre = readr::col_double(), - total_n_max_lbs_acre = readr::col_double(), - total_c_min_g_m2 = readr::col_double(), - total_c_max_g_m2 = readr::col_double(), - total_n_min_g_m2 = readr::col_double(), - total_n_max_g_m2 = readr::col_double(), - source = readr::col_character() - ) +raw_path <- file.path( + "/projectnb/dietzelab/ccmmf/usr/akash/management/fertilization", + "CCMMF Fertilization - Compost.tsv" ) +out_csv <- file.path("data-raw", "compost_amendments.csv") + +# 1 lb/acre = 0.112085 g/m^2. +LBS_ACRE_TO_G_M2 <- 0.112085 + +# map each raw material name to one of the CalRecycle classes +# (14 CCR section 17852). biosolids is empty in the current table. +material_to_class <- function(m) { + s <- tolower(m) + dplyr::case_when( + grepl("grass", s) ~ "green", + grepl("manure|alfalfa|blood|poultry|corn cob|corn stalk", s) ~ "ag", + grepl("apple|coffee|fruit|vegetable", s) ~ "food", + grepl("bark|sawdust|woodchip|newspaper|paper", s) ~ "wood", + grepl("leaf|leaves|pine needle|straw", s) ~ "yard", + TRUE ~ NA_character_ + ) +} + +PEcAn.logger::logger.info("Reading raw compost TSV: ", raw_path) +raw <- readr::read_tsv(raw_path, show_col_types = FALSE) + +ca_compost_amendment <- raw |> + dplyr::transmute( + material = .data$Material, + material_class = material_to_class(.data$Material), + cn_min = .data$`C_MIN (C:N)`, + cn_max = .data$`C_MAX (C:N)`, + cn_avg = .data$`C_Avg (C:N)`, + n_pct = as.numeric(.data$`Total N (%)`), + pan_pct = as.numeric(.data$`4 week PAN (%)`), + n_class = .data$`LowerN/HigherN`, + app_rate_min = .data$`RowsMIN_AppRate (lbs/acre)`, + app_rate_max = .data$`RowsMAX_AppRate (lbs/acre)`, + # %C is sampled at runtime via sample_ca_compost_pct_c(). + total_n_min_lbs_acre = .data$`RowsMIN_Total_N (lbs N/acre)`, + total_n_max_lbs_acre = .data$`RowsMAX_Total_N (lbs N/acre)`, + total_n_min_g_m2 = round(.data$total_n_min_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), + total_n_max_g_m2 = round(.data$total_n_max_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), + source = trimws(.data$Source) + ) + +unclassified <- ca_compost_amendment |> + dplyr::filter(is.na(.data$material_class)) |> + dplyr::pull(.data$material) |> + unique() +if (length(unclassified) > 0) { + PEcAn.logger::logger.warn(sprintf( + "Unclassified materials: %s", + paste(unclassified, collapse = ", ") + )) +} + +PEcAn.logger::logger.info(sprintf( + "Harmonized %d compost materials into compost_amendments.csv", + nrow(ca_compost_amendment) +)) + +readr::write_csv(ca_compost_amendment, out_csv) +PEcAn.logger::logger.info("Wrote ", out_csv) usethis::use_data(ca_compost_amendment, overwrite = TRUE) From ef7d28c31468525271228e9f68adaf188be7b5c3 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:51 -0400 Subject: [PATCH 09/97] refresh compost_amendments csv --- .../data.land/data-raw/compost_amendments.csv | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/modules/data.land/data-raw/compost_amendments.csv b/modules/data.land/data-raw/compost_amendments.csv index 85db72542b..ba5169b388 100644 --- a/modules/data.land/data-raw/compost_amendments.csv +++ b/modules/data.land/data-raw/compost_amendments.csv @@ -1,33 +1,33 @@ -material,cn_min,cn_max,cn_avg,c_pct,n_pct,pan_pct,n_class,app_rate_min,app_rate_max,total_c_min_lbs_acre,total_c_max_lbs_acre,total_n_min_lbs_acre,total_n_max_lbs_acre,total_c_min_g_m2,total_c_max_g_m2,total_n_min_g_m2,total_n_max_g_m2,source -Alfalfa hay,13,13,13,40,3.08,16.15,LOWER,8000,10600,3200,4240,246.15,326.15,358.672,475.24,27.59,36.557,"Eghball, UNL Extension" -Apple pomace,21,21,21,40,1.9,-1.43,LOWER,8000,10600,3200,4240,152.38,201.9,358.672,475.24,17.08,22.63,"Eghball, UNL Extension" -Bark,100,130,115,40,0.35,-24.78,LOWER,8000,10600,3200,4240,27.83,36.87,358.672,475.24,3.119,4.133,"Eghball, UNL Extension" -Blood meal,4,4,4,40,10,60,HIGHER,4400,7200,1760,2880,440,720,197.27,322.805,49.317,80.701,"Eghball, UNL Extension" -Coffee grounds,20,20,20,40,2,0,LOWER,8000,10600,3200,4240,160,212,358.672,475.24,17.934,23.762,"Eghball, UNL Extension" -Corn cobs,50,120,85,40,0.47,-22.94,LOWER,8000,10600,3200,4240,37.65,49.88,358.672,475.24,4.22,5.591,"Eghball, UNL Extension" -Corn stalks,60,70,65,40,0.62,-20.77,LOWER,8000,10600,3200,4240,49.23,65.23,358.672,475.24,5.518,7.311,"Rynk, NC State Extension" -Corn stalks,80,80,80,40,0.5,-22.5,LOWER,8000,10600,3200,4240,40,53,358.672,475.24,4.483,5.941,"Eghball, UNL Extension" -Cow manure,20,25,22.5,40,1.78,-3.33,LOWER,8000,10600,3200,4240,142.22,188.44,358.672,475.24,15.941,21.121,"Rynk, NC State Extension" -Cow manure,20,20,20,40,2,0,LOWER,8000,10600,3200,4240,160,212,358.672,475.24,17.934,23.762,"Eghball, UNL Extension" -Dry leaves,30,80,55,40,0.73,-19.09,LOWER,8000,10600,3200,4240,58.18,77.09,358.672,475.24,6.521,8.641,"Rynk, NC State Extension" -Fruit waste,35,35,35,40,1.14,-12.86,LOWER,8000,10600,3200,4240,91.43,121.14,358.672,475.24,10.248,13.578,"Eghball, UNL Extension" -Grass,12,25,18.5,40,2.16,2.43,LOWER,8000,10600,3200,4240,172.97,229.19,358.672,475.24,19.387,25.689,"Rynk, NC State Extension" -Grass clippings,12,25,18.5,40,2.16,2.43,LOWER,8000,10600,3200,4240,172.97,229.19,358.672,475.24,19.387,25.689,"Eghball, UNL Extension" -Horse manure,20,30,25,40,1.6,-6,LOWER,8000,10600,3200,4240,128,169.6,358.672,475.24,14.347,19.01,"Rynk, NC State Extension" -Leaves,40,80,60,40,0.67,-20,LOWER,8000,10600,3200,4240,53.33,70.67,358.672,475.24,5.977,7.921,"Eghball, UNL Extension" -Manure — cow and horse,20,25,22.5,40,1.78,-3.33,LOWER,8000,10600,3200,4240,142.22,188.44,358.672,475.24,15.941,21.121,"Eghball, UNL Extension" -Manure — poultry (fresh),10,10,10,40,4,30,HIGHER,4400,7200,1760,2880,176,288,197.27,322.805,19.727,32.28,"Eghball, UNL Extension" -Manure with litter — horse,30,60,45,40,0.89,-16.67,LOWER,8000,10600,3200,4240,71.11,94.22,358.672,475.24,7.97,10.561,"Eghball, UNL Extension" -Manure with litter — poultry,13,18,15.5,40,2.58,8.71,LOWER,8000,10600,3200,4240,206.45,273.55,358.672,475.24,23.14,30.661,"Eghball, UNL Extension" -Newspaper,400,800,600,40,0.07,-29,LOWER,8000,10600,3200,4240,5.33,7.07,358.672,475.24,0.597,0.792,"Rynk, NC State Extension" -"Newspaper, shredded",400,800,600,40,0.07,-29,LOWER,8000,10600,3200,4240,5.33,7.07,358.672,475.24,0.597,0.792,"Eghball, UNL Extension" -Paper,150,200,175,40,0.23,-26.57,LOWER,8000,10600,3200,4240,18.29,24.23,358.672,475.24,2.05,2.716,"Eghball, UNL Extension" -Pine needles,80,80,80,40,0.5,-22.5,LOWER,8000,10600,3200,4240,40,53,358.672,475.24,4.483,5.941,"Eghball, UNL Extension" -Poultry litter,5,20,12.5,40,3.2,18,LOWER,8000,10600,3200,4240,256,339.2,358.672,475.24,28.694,38.019,"Rynk, NC State Extension" -Sawdust and wood chips,100,500,300,40,0.13,-28,LOWER,8000,10600,3200,4240,10.67,14.13,358.672,475.24,1.196,1.584,"Eghball, UNL Extension" -Straw,40,100,70,40,0.57,-21.43,LOWER,8000,10600,3200,4240,45.71,60.57,358.672,475.24,5.123,6.789,"Rynk, NC State Extension" -Straw — oats and wheat,70,80,75,40,0.53,-22,LOWER,8000,10600,3200,4240,42.67,56.53,358.672,475.24,4.783,6.336,"Eghball, UNL Extension" -Swine manure,8,20,14,40,2.86,12.86,LOWER,8000,10600,3200,4240,228.57,302.86,358.672,475.24,25.619,33.946,"Rynk, NC State Extension" -Vegetable waste,10,20,15,40,2.67,10,LOWER,8000,10600,3200,4240,213.33,282.67,358.672,475.24,23.911,31.683,"Rynk, NC State Extension" -Vegetable waste,12,20,16,40,2.5,7.5,LOWER,8000,10600,3200,4240,200,265,358.672,475.24,22.417,29.703,"Eghball, UNL Extension" -Woodchips,100,500,300,40,0.13,-28,LOWER,8000,10600,3200,4240,10.67,14.13,358.672,475.24,1.196,1.584,"Rynk, NC State Extension" +material,material_class,cn_min,cn_max,cn_avg,n_pct,pan_pct,n_class,app_rate_min,app_rate_max,total_n_min_lbs_acre,total_n_max_lbs_acre,total_n_min_g_m2,total_n_max_g_m2,source +Alfalfa hay,ag,13,13,13,3.08,16.15,LOWER,8000,10600,246.15,326.15,27.59,36.557,"Eghball, UNL Extension" +Apple pomace,food,21,21,21,1.9,-1.43,LOWER,8000,10600,152.38,201.9,17.08,22.63,"Eghball, UNL Extension" +Bark,wood,100,130,115,0.35,-24.78,LOWER,8000,10600,27.83,36.87,3.119,4.133,"Eghball, UNL Extension" +Blood meal,ag,4,4,4,10,60,HIGHER,4400,7200,440,720,49.317,80.701,"Eghball, UNL Extension" +Coffee grounds,food,20,20,20,2,0,LOWER,8000,10600,160,212,17.934,23.762,"Eghball, UNL Extension" +Corn cobs,ag,50,120,85,0.47,-22.94,LOWER,8000,10600,37.65,49.88,4.22,5.591,"Eghball, UNL Extension" +Corn stalks,ag,60,70,65,0.62,-20.77,LOWER,8000,10600,49.23,65.23,5.518,7.311,"Rynk, NC State Extension" +Corn stalks,ag,80,80,80,0.5,-22.5,LOWER,8000,10600,40,53,4.483,5.941,"Eghball, UNL Extension" +Cow manure,ag,20,25,22.5,1.78,-3.33,LOWER,8000,10600,142.22,188.44,15.941,21.121,"Rynk, NC State Extension" +Cow manure,ag,20,20,20,2,0,LOWER,8000,10600,160,212,17.934,23.762,"Eghball, UNL Extension" +Dry leaves,yard,30,80,55,0.73,-19.09,LOWER,8000,10600,58.18,77.09,6.521,8.641,"Rynk, NC State Extension" +Fruit waste,food,35,35,35,1.14,-12.86,LOWER,8000,10600,91.43,121.14,10.248,13.578,"Eghball, UNL Extension" +Grass,green,12,25,18.5,2.16,2.43,LOWER,8000,10600,172.97,229.19,19.387,25.689,"Rynk, NC State Extension" +Grass clippings,green,12,25,18.5,2.16,2.43,LOWER,8000,10600,172.97,229.19,19.387,25.689,"Eghball, UNL Extension" +Horse manure,ag,20,30,25,1.6,-6,LOWER,8000,10600,128,169.6,14.347,19.01,"Rynk, NC State Extension" +Leaves,yard,40,80,60,0.67,-20,LOWER,8000,10600,53.33,70.67,5.977,7.921,"Eghball, UNL Extension" +Manure — cow and horse,ag,20,25,22.5,1.78,-3.33,LOWER,8000,10600,142.22,188.44,15.941,21.121,"Eghball, UNL Extension" +Manure — poultry (fresh),ag,10,10,10,4,30,HIGHER,4400,7200,176,288,19.727,32.28,"Eghball, UNL Extension" +Manure with litter — horse,ag,30,60,45,0.89,-16.67,LOWER,8000,10600,71.11,94.22,7.97,10.561,"Eghball, UNL Extension" +Manure with litter — poultry,ag,13,18,15.5,2.58,8.71,LOWER,8000,10600,206.45,273.55,23.14,30.661,"Eghball, UNL Extension" +Newspaper,wood,400,800,600,0.07,-29,LOWER,8000,10600,5.33,7.07,0.597,0.792,"Rynk, NC State Extension" +"Newspaper, shredded",wood,400,800,600,0.07,-29,LOWER,8000,10600,5.33,7.07,0.597,0.792,"Eghball, UNL Extension" +Paper,wood,150,200,175,0.23,-26.57,LOWER,8000,10600,18.29,24.23,2.05,2.716,"Eghball, UNL Extension" +Pine needles,yard,80,80,80,0.5,-22.5,LOWER,8000,10600,40,53,4.483,5.941,"Eghball, UNL Extension" +Poultry litter,ag,5,20,12.5,3.2,18,LOWER,8000,10600,256,339.2,28.694,38.019,"Rynk, NC State Extension" +Sawdust and wood chips,wood,100,500,300,0.13,-28,LOWER,8000,10600,10.67,14.13,1.196,1.584,"Eghball, UNL Extension" +Straw,yard,40,100,70,0.57,-21.43,LOWER,8000,10600,45.71,60.57,5.123,6.789,"Rynk, NC State Extension" +Straw — oats and wheat,yard,70,80,75,0.53,-22,LOWER,8000,10600,42.67,56.53,4.783,6.336,"Eghball, UNL Extension" +Swine manure,ag,8,20,14,2.86,12.86,LOWER,8000,10600,228.57,302.86,25.619,33.946,"Rynk, NC State Extension" +Vegetable waste,food,10,20,15,2.67,10,LOWER,8000,10600,213.33,282.67,23.911,31.683,"Rynk, NC State Extension" +Vegetable waste,food,12,20,16,2.5,7.5,LOWER,8000,10600,200,265,22.417,29.703,"Eghball, UNL Extension" +Woodchips,wood,100,500,300,0.13,-28,LOWER,8000,10600,10.67,14.13,1.196,1.584,"Rynk, NC State Extension" From 1b963434b42faf9f7fe963db0f0d31a1f0c253f6 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:51 -0400 Subject: [PATCH 10/97] rebuild ca_compost_amendment rda --- .../data.land/data/ca_compost_amendment.rda | Bin 2315 -> 2053 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/modules/data.land/data/ca_compost_amendment.rda b/modules/data.land/data/ca_compost_amendment.rda index 9cf0091038ad4ec37a9ec3a1f5dbbdd6bcbc170b..3f15e8ee2170de862a70dcb360cbec578a34e570 100644 GIT binary patch literal 2053 zcmV+g2>SOzT4*^jL0KkKS?0;HegFq9fB*mg|NsC0|NsC0|M&m@|Nr~z{`al@{Z;?} zU%UG6`>o&x-(&y=#sC1Js16wDG8fehbwKOyUVm(0GhMESRqd+kL z&@>GjQMEDv003xcXagfgng*I=G}>wnO-z|h86@#CnDn5?ZK?ozjRQ>$8fX9j27mxz z01W^JfB*mh00003Kr{iPMt~3i4FG5~XaS=UplBKZ01X2O4FC-Q0009(0i!?w0MIl5 z00E!?00;mEfHWF30MUrhGz|a%27!bIfChj700E!?(VzeTXc_FDti+|^wm6?pP@}Q z(oaeHntGFE9;3=+&}pCz8&RR7O%F{Y$*Hvu)R;$-dWWcZrqpCTO*9%kOr8>LK+qni zr~rD60jKu*ed33E1QCn}`r{Vj(}DHIC9WD21hR&OHlv+Y%4+_1R#|+GQc)_Gw#v(2 zE@=#gDUA?9C5)q)c2`;AG01$Cv1Eg)^wujN!!fNq8Ebr43m~3P>Qr zn9QepMLAj80}fers@+N^?%Y)mU0%#+ZPHnERSQ*C1Wlx90|AIZoPa>m0csjKiJ-dB zy?a7~Km?8%7|IGkt~1cu zV`+?Ow7Ue2YC}Ri|4WzMO2F0(HkXHp;6NNShyv4BE~Y4y&BJqqvYAnrpAs zF55awWx!j81aCmpMIH#vvPRhm!iwzqCwUxw6hC(bz~v0I_xx?#Lx?q)pHoal&En~( z0GQF*z<}Fr@_(!pYA%Fo0u?#?38li}C6pxq{Au1%cbE_hGB_y|lC@4eN>p^!*EXRG zM8c_GyNlTA*W0S5G3^HzhtZ)hF_q6b<6Xh>GWpdU57nYQ>Ps>eMFk$x(x*JAGM|Wg zMqhjBws*7KNXDW#mdGwxnv%fe1c8c-;bsYLKZxn9RXWI1WFotyN=#+Q0W%+3IH9P~ zF(VBj*%QX958Q&FU*7eWw6n77>0x!6tj$bxb-B(tvw_~Qy_H6?P-%lrx2AP97PXOq zW!s#$4^bF9Rw;~~6|2J5f}3)iiGFpWYgq^R82}{ElV}%1^zk6G2k@=KZZqX1X?PXN z4$6Sbj(C*)z+oS`L!9ZvslK0k%wlm_=}&$q8ao!7p7(VyJ*@8HA0i+%|G`%RJtc!hJ*9tB)R zZoGqLC1bTF6th-@d`fK=vQ>cj!K{&}H|Xi~D#6&S9VNtx7EL6}k~UKhjfQWIG9rXj zv5Oc5C&N0sG+V!uaE5Adb1#(^O6`rXY{F(EXJ3~YTCoZX_p&lacFSXFq*E$Os$qda zTK2+=RMnAGPau(ApaJ0!O^`ncRXIj+Y%N+914}~1{Pg_4J;DC|r5-Qd(g|oWi|0&) zbOxJ8bi^^`hJ<8f5hX&=n4w3S$Djbk(w*G|Relp*HH(Q8I?R0$6d}Qe3cg#Bpwm&z zrb;OzS%S6&#bDFY8||cmyq%UrC^3w}2_>I(Tjb1zBV}zTK;Wvuq_p!AB!DIdo#l%O ztF^6QiFf#MvH)Z1+e{fl!YI;0`on+_laP~X&^z>o(i;$rfdU}|h!R8?o;R*?(?Cc_ zn+C^>EKgQjFBupJVR&JOmR7D&jHR}M;M96I{w=Ebj}f?PetD~%slnHBG1RejpaynP zgp1fz5ma9xV;#bxkcqQM!o{^EN*2%n!B8qTdnW2S6*;bLoelypK+#gUJI&%FLT(q7 zU8ZbA?-C5q1JjrTMbNS%N=UNKba4wl=jt5ETpY+<{J@imS{GX~lBuxn^;SNu%7|l-5RL9Vn zTo9NgtU!MPQtJ+mR$R`aAS6H!(P#DT|{bUqKqkR_4zRe17u!soMEBsx_6yZWcn;MXf|NsC0|NsC0|NsC0|M&m@|Nr~z{{OB0{Z;?} zU%UG6`>o&zUjP75NCJQW1wfc(3Sx~-Hi?-C4FJ##k5JG6X`nP{G#X@R4^U(VAT$h( zG&IvdF*L{k14GmXfuKD@OqywtV0V0GZKunVcrkNU;Ce=LD^-Zbdo|{u65Sl$h zYH6cKlntqb@=Q$`9;cC_F&b&0X!SJFiM2G-)bx!5N2#XLY3el44^tpCX{MOeoA2y< z1rFW_BNz|(#x2FCA_Ed*LW$uFOVteu0$Nd_O?(k+7Og|vbWx|5*zWqxT=Z;t&33<` z+Rj)hxn+`;y-^i4iJ@LyJgO2{4v6%QXx8W__q(cWVA-yGFIk&<5_R{zv^JV4VNi3l zbKDdqD_p-nwx4AUI@D@45$~^KTCb_U$z~?ju1O@6K@3O{%P=)j)V?q*W5$_omhQ`EB(nMMTL4cO&!JwI>DhAkukxN5J z8jC>|BvizL4JOXvFi>dlm_TSqMv$L+iwaS> zeq>*lAkC;JEmA8-c}o?%lPU_JILr;Xyn!*r9P3=bHD_#w(;G}iE5*gK;E*n2BdIx79I>gsYmbcu@meYW~BLX;3H1S7* zGoIR{ZBUFEFN2DB$IO;aG(V?y;BiJ+v-2m z7S+k4s~U$#{g0O-L*GE^K>Nr~dK|1kCD@6yVv!?R72-;BS?HNY18HY=E3C}h>|Eci z7e(4U@48(M@4SLoqEeq(wf8(dyH&nd;$R+EMjSCt)s;dwYsxUz`~0-aJU!IEVV-rL zX5F1GntSY-?sA|-hBAI^NK)a#@?$<;kBKTTvo^0fdD5AIw8hlK{h2?`oeq9-rt8_r zyQa@j7=4$rv!a^Ar$r3&i%BfKWH~pVt>w7qO#`=Kg{7Y|P-%lrx0LE?EoMdqhjM9k zuTK~|I>N! zjv?>NdkY()h7rJkQPmTn5w;|$g^vG&+j!|r7|9QxLNq;g(_*M+4BbJOgFz?F!tX$nDEswR;z0NP8P zcpZ9yy@?PG2_R${0B6_&2U;_`7{)+>0gRjo5D&r;jdP(mHYCmWkOh_S%M$=l%~BCG z_Dd%ust)KiQZ&KZt%c=W_sZr)#EAuiBJAb?F|(W%j5D}6NQx0$H{clMlHe7rkFqTR zluK=Jre${)h>+Kb{B1}hT(1CT`wG-o0~}3T0T=_llG(Y=d^95>BuP$;V-EN#GjZquCdo7tkyQOwuXwEq zSh|rpw$m8yC_@4R119pq0zeoH!Jq^~LtFG?Q$mtRs03=>2xk|UEo=#^25Asf#o1&* zO<~XtB)d!%Xv-!71pvksjI$}hRdRyM`pFVN69MkHpn~gIHLcpfUF-xS71;nXF}==^ z1W>d`w5C89zz{TcbY+@I-JCCzm&Dc*k$XtUh3uS&6?JQm)oi{=AVQgmvEKw_AYh8? zmG;HZ#WID60}TB1m8n_nPcaq1u6pO^+*MP47u<5RGkrr-J-HBd+=U>Xz zunb&D;w!*kh)yKDZT|fdp*IXg7ip|QAi018p(-rNt)dy^aK2OdgzL7nPx!4GY=dMSFe6=vAq6# zP;)&nk)~((q#|f(`C|k@1J(>gl&EY!F_dRvgByZiuz|1|+muQpRLIXigrxuwU<1(o z7pSnHNykwJ_2U6If$;A{aUsDTG3iK=0{A4LAA81&ZXcgR&RX76#} l`V5k From 36ed14738ba60be98fce1ec0a275b867eaa30fc0 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:21:51 -0400 Subject: [PATCH 11/97] update doc for ca_compost_amendment --- modules/data.land/man/ca_compost_amendment.Rd | 48 +++++++------------ 1 file changed, 18 insertions(+), 30 deletions(-) diff --git a/modules/data.land/man/ca_compost_amendment.Rd b/modules/data.land/man/ca_compost_amendment.Rd index d9e8fda9ff..5de06b63f7 100644 --- a/modules/data.land/man/ca_compost_amendment.Rd +++ b/modules/data.land/man/ca_compost_amendment.Rd @@ -7,30 +7,26 @@ \format{ A tibble with 32 rows and the following columns: \describe{ - \item{material}{\code{character}. Amendment material name.} - \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio - range and average.} - \item{c_pct}{\code{numeric}. Assumed carbon content (percent).} - \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} - \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks - (percent). Negative values indicate N immobilization.} - \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} - \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range - (lbs/acre).} - \item{total_c_min_lbs_acre, total_c_max_lbs_acre}{\code{numeric}. - Total carbon applied (lbs C/acre).} - \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. - Total nitrogen applied (lbs N/acre).} - \item{total_c_min_g_m2, total_c_max_g_m2}{\code{numeric}. - Total carbon in SI units (g C/m\eqn{^2}).} - \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. - Total nitrogen in SI units (g N/m\eqn{^2}).} - \item{source}{\code{character}. Short citation for the data source.} + \item{material}{Amendment material name.} + \item{material_class}{CalRecycle taxonomy (14 CCR section 17852): + one of green, food, wood, yard, ag, biosolids.} + \item{cn_min, cn_max, cn_avg}{Carbon to nitrogen ratio range and + average.} + \item{n_pct}{Total nitrogen content (percent).} + \item{pan_pct}{Plant available nitrogen after 4 weeks (percent). + Negative values indicate N immobilization.} + \item{n_class}{"LOWER" or "HIGHER" N content class.} + \item{app_rate_min, app_rate_max}{Application rate range (lbs/acre).} + \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total nitrogen + applied (lbs N/acre).} + \item{total_n_min_g_m2, total_n_max_g_m2}{Total nitrogen in SI + units (g N/m^2).} + \item{source}{Short citation for the data source.} } } \source{ Eghball, B. Composting Manure and Other Organic Residues. - University of Nebraska-Lincoln Extension, Publication G2222. + University of Nebraska Lincoln Extension, Publication G2222. \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} Rynk, R. (ed.) Compost Production and Use in Sustainable @@ -42,15 +38,7 @@ ca_compost_amendment } \description{ Properties of organic amendment materials used in California agriculture, -including C:N ratios, carbon and nitrogen content, plant-available nitrogen -(PAN), and application rates. Some materials appear in multiple rows when -values are reported by different sources (e.g. Corn stalks, Cow manure, -Vegetable waste). The \code{source} column disambiguates these. -} -\seealso{ -\code{\link{look_up_ca_compost_amendment}} for looking up - amendments by material name. - \code{\link{look_up_fertilizer_components}} for fertilizer nutrient - composition (N/C fractions) from the SWAT/DayCent database. +including C:N ratios, nitrogen content, plant available nitrogen (PAN), +and application rates. } \keyword{datasets} From 35987508e3d6c12286b060c3f32106c2b8cfd641 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 12/97] add create_ca_compost_distributions data raw script --- .../create_ca_compost_distributions.R | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 modules/data.land/data-raw/create_ca_compost_distributions.R diff --git a/modules/data.land/data-raw/create_ca_compost_distributions.R b/modules/data.land/data-raw/create_ca_compost_distributions.R new file mode 100644 index 0000000000..63246bf803 --- /dev/null +++ b/modules/data.land/data-raw/create_ca_compost_distributions.R @@ -0,0 +1,73 @@ +#!/usr/bin/env Rscript +# +# builds bundled CA compost sampling distributions used by the +# sample_ca_compost_* functions. five tibbles in total. each one keeps a +# source field so the provenance travels with the data when the package +# loads. + +# %C distribution. Bernard et al. 2023 (Front. Env. Sci., CA central coast +# vineyard) found 14 to 15% C; Sullivan et al. 2018 (OSU EM9217 proficiency +# program) median 15% TOC; CalRecycle generic roughly 20 to 23%. truncnorm +# with mean 20, sd 5, truncated 15 to 30 covers the literature range. +ca_compost_pct_c_distribution <- tibble::tibble( + a = 15, + b = 30, + mean = 20, + sd = 5, + source = paste("Bernard et al. 2023 Front. Env. Sci.;", + "Sullivan, Bary, Miller & Brewer 2018 OSU EM9217;", + "CalRecycle finished compost characterization") +) + +# C:N distribution. CDFA HSP white paper (Geisseler et al.) found CA +# finished compost bimodal at C:N <= 11 (manure dominant) vs > 11 (plant +# dominant); HSP 2026 requires applied C:N <= 25. truncnorm with mean 12, +# sd 4, truncated 8 to 25 covers both modes. +ca_compost_cn_distribution <- tibble::tibble( + a = 8, + b = 25, + mean = 12, + sd = 4, + source = paste("CDFA Healthy Soils Program white paper (Geisseler et al.);", + "HSP 2026 Practice Guidelines") +) + +# application rate envelope by PFT family, dry weight tons per acre. source: +# CDFA HSP white paper Table 2 + HSP 2026 Practice Guidelines, USDA NRCS +# Conservation Practice Standard 336 Soil Carbon Amendment (2022). +ca_compost_app_rate_envelope <- tibble::tibble( + pft_family = c("annual", "perennial"), + min_t_ac = c(3, 2), + max_t_ac = c(8, 6), + source = "CDFA HSP white paper Table 2; HSP 2026; NRCS CPS 336" +) + +# calendar window by PFT family, expressed as days before the cycle anchor +# (mslsp_OGI). annual: 7 to 28 days before the anchor (CDFA HSP Box 1, +# applied before planting). perennial: 60 to 180 days before the anchor +# (dormant season application; UC ANR orchard cost studies + Bernard et +# al. 2023 vineyard timing of Nov 9 and Jan 10). +ca_compost_calendar_window <- tibble::tibble( + pft_family = c("annual", "perennial"), + offset_days_min = c(7L, 60L), + offset_days_max = c(28L, 180L), + source = "CDFA HSP white paper Box 1; UC ANR cost studies; Bernard et al. 2023" +) + +# material whitelist by PFT family. long format, one row per allowed pair. +# CalRecycle taxonomy from 14 CCR section 17852 + SB 1383 dominant +# feedstocks. biosolids excluded from food crops (regulatory). wood waste +# deferred since it has high C:N and immobilizes N +ca_compost_material_whitelist <- tibble::tibble( + pft_family = c("annual", "annual", "annual", + "perennial", "perennial", "perennial"), + material_class = c("green", "food", "ag", + "green", "food", "yard"), + source = "14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks" +) + +usethis::use_data(ca_compost_pct_c_distribution, overwrite = TRUE) +usethis::use_data(ca_compost_cn_distribution, overwrite = TRUE) +usethis::use_data(ca_compost_app_rate_envelope, overwrite = TRUE) +usethis::use_data(ca_compost_calendar_window, overwrite = TRUE) +usethis::use_data(ca_compost_material_whitelist, overwrite = TRUE) From adc519093a5d32db96a6b10d4f85f36ba31f2a72 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 13/97] add ca_compost_pct_c_distribution rda --- .../data/ca_compost_pct_c_distribution.rda | Bin 0 -> 331 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_compost_pct_c_distribution.rda diff --git a/modules/data.land/data/ca_compost_pct_c_distribution.rda b/modules/data.land/data/ca_compost_pct_c_distribution.rda new file mode 100644 index 0000000000000000000000000000000000000000..97334caf639c911c771153c253cde7c242e36daa GIT binary patch literal 331 zcmV-R0kr-?T4*^jL0KkKSwK~uTmS%?f587UOaeg%eCb~To^sk00FQ885s>t z6!e4C(<4mO0Mj4<(?Ds6Xbn?L)QyzHY3U5q0001JGy$N=H3-l>KmY&$28MtEqqS{P zn(Sa2&?T0uRwSI{augoZ5HLX(=ZQU05zEX3fYcAb^gJpEYcrw;z*GR(AfO~55*P?7 zfk?(M>73ytMj)MMm|=z;ooQA}s7&I>UWcfSx2k-a{Txlgxa52El@vwVH$;G~*Ie#ZZZH=^g^g&~;@Ax- zXMs={u}YA~UUF4~IuInBxtLA?gbYmr#*lD^2wRRI!AWp8ULqT&BdFb Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 14/97] add ca_compost_cn_distribution rda --- .../data.land/data/ca_compost_cn_distribution.rda | Bin 0 -> 303 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_compost_cn_distribution.rda diff --git a/modules/data.land/data/ca_compost_cn_distribution.rda b/modules/data.land/data/ca_compost_cn_distribution.rda new file mode 100644 index 0000000000000000000000000000000000000000..fb8c7aaf0ddd58a52d061b4465c8d700c43a020b GIT binary patch literal 303 zcmV+~0nq+JT4*^jL0KkKS$se3a{vI5f587UNDx3{S!iv*UckTS-k?AL00FQ7`7;qR zk?L(Bpa3+`^%^#z`lCVVH1#ylil3@^q}25@Q`CN`=zstK4GjQ#gCx~G6G7;JXaE2W z4FC-r3~@QHfX4wyxm>d(Q>T!i`KEz_Nv3#{;T}fdU?d1oK_l|=vL%h3&_Dv92H^z( zApoGjK~xGTLIb+UD~N=GK#_UJe~hx@s+a6K1+%U!^%_qj#{uX7vp;Vw@iZuCgBnw> zY|4u+W?-#EcB3Fj7w6ce1vDtGxFM3cBpsYs^m|)e;tK{^KWU7{31TK(CzMQq>7_V> z07 Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 15/97] add ca_compost_app_rate_envelope rda --- .../data/ca_compost_app_rate_envelope.rda | Bin 0 -> 314 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_compost_app_rate_envelope.rda diff --git a/modules/data.land/data/ca_compost_app_rate_envelope.rda b/modules/data.land/data/ca_compost_app_rate_envelope.rda new file mode 100644 index 0000000000000000000000000000000000000000..28d46e19126f800cdb1a0567a965f589a2c2ccfc GIT binary patch literal 314 zcmV-A0mc48T4*^jL0KkKSsg&)wEzIAf5889NJKybT}W*~UO>NR-{3$100FQ87+Hp@ z9--()h9*G7(dbPBPf3#urUO*NcmS4FCWD1Jp7ErlyK|kkR^tKU6em0Bub@ z8h``TN_goU(+UqnsPv{cz&Mi!wb>v$TYd9koi=#CEJk3W3#vZ86@4VB3{%()C}K>^ znSlos1_9mxRWk*>5DrB&PXrZ)Lr8WVqCQBHEW7tX)@Tux8A=F|-innCqQeQO(k*t8 z8lfQI+d%=qn4#}0Cl>>9B5p|}Xi^briamGG3c3sZaj*x(=^RrjDiXm;P Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 16/97] add ca_compost_calendar_window rda --- .../data.land/data/ca_compost_calendar_window.rda | Bin 0 -> 333 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_compost_calendar_window.rda diff --git a/modules/data.land/data/ca_compost_calendar_window.rda b/modules/data.land/data/ca_compost_calendar_window.rda new file mode 100644 index 0000000000000000000000000000000000000000..6603994470e38a02d90b33d9e491c5d2c0bf92db GIT binary patch literal 333 zcmV-T0kZx=T4*^jL0KkKS%gc&j{pFsf5`u`$P_>WcuYM(UO>NR-rzt01ONa5umKif zgs2qtF{Y+Xqe^;!05W6;>WvydR1FmMP3lLH0j5Eq00uw-rhzD?P}4vI)CPbJ0B8*c zgQkEmJ`CE}5m17d9B+3)2h<3)+!m&yhscEHSZPee&=7$`qlQaz!&bbXTS@o<^+cSA ziXe&#UQrPk$AC!YyofbQ20|lA@Q8SnMLg42(Y literal 0 HcmV?d00001 From 5e2fff38a308712a5bb50764ed6282de791f3db8 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:22:20 -0400 Subject: [PATCH 17/97] add ca_compost_material_whitelist rda --- .../data/ca_compost_material_whitelist.rda | Bin 0 -> 356 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_compost_material_whitelist.rda diff --git a/modules/data.land/data/ca_compost_material_whitelist.rda b/modules/data.land/data/ca_compost_material_whitelist.rda new file mode 100644 index 0000000000000000000000000000000000000000..eb5041069b646597e50f3f6b0bd4c2f78745dfc7 GIT binary patch literal 356 zcmV-q0h|6pT4*^jL0KkKS*4_7NB{u%|G@tbORy0A9 zNwOi6C#VLR0MVc{8U{h4jS1)@BSsSl(?HN<&}7IFQ5vVInI>tFO#lXssgMBlg^f@c zOKpab0_FmwWJA%It*&Sys~i#tTxrF5&_EoJF!}tEw?C|7Sygdogm=w4O9)B;8bM&A z0MiswX`+g5>WUM?Sn&^F_l=`K=NpFaP5q;Az;+H!QSk-?0r0498-~%`I7etu7`nI& z+5vPLCE-K36A(o4zM6srfE5a~jx!YlJtg0!BjW|*XWjvZuw^4O`UXR7IEQHR42LMv zW0;G*nBgm`q1=8^s>5b>qLrv?zQMpZ!C?r2UaRuRG^~gXc_syz_yex(f^A43exJRn8D6@pmLsg$W8;Ml^s* C@0H5{ literal 0 HcmV?d00001 From e41539fbc981f59fedd1985f9b420ce3e44770ea Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:24:48 -0400 Subject: [PATCH 18/97] add doc for ca_compost_pct_c_distribution --- .../man/ca_compost_pct_c_distribution.Rd | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 modules/data.land/man/ca_compost_pct_c_distribution.Rd diff --git a/modules/data.land/man/ca_compost_pct_c_distribution.Rd b/modules/data.land/man/ca_compost_pct_c_distribution.Rd new file mode 100644 index 0000000000..dab4d85ded --- /dev/null +++ b/modules/data.land/man/ca_compost_pct_c_distribution.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_compost_pct_c_distribution} +\alias{ca_compost_pct_c_distribution} +\title{California compost carbon content distribution} +\format{ +A tibble with one row: +\describe{ + \item{a, b}{Lower and upper truncation bounds.} + \item{mean, sd}{Untruncated mean and standard deviation.} + \item{source}{Short citation for the parameters.} +} +} +\source{ +Bernard et al. 2023 Frontiers in Environmental Science; + Sullivan, Bary, Miller & Brewer 2018 OSU EM9217; + CalRecycle finished compost characterization. +} +\usage{ +ca_compost_pct_c_distribution +} +\description{ +Truncated normal distribution parameters for compost %C (dry weight +basis) used by sample_ca_compost_pct_c. +} +\keyword{datasets} From de0bb71780124dbedcd1c374528eeb5a66c26953 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:24:48 -0400 Subject: [PATCH 19/97] add doc for ca_compost_cn_distribution --- .../man/ca_compost_cn_distribution.Rd | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/data.land/man/ca_compost_cn_distribution.Rd diff --git a/modules/data.land/man/ca_compost_cn_distribution.Rd b/modules/data.land/man/ca_compost_cn_distribution.Rd new file mode 100644 index 0000000000..6a15812605 --- /dev/null +++ b/modules/data.land/man/ca_compost_cn_distribution.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_compost_cn_distribution} +\alias{ca_compost_cn_distribution} +\title{California compost C:N ratio distribution} +\format{ +A tibble with one row: +\describe{ + \item{a, b}{Lower and upper truncation bounds.} + \item{mean, sd}{Untruncated mean and standard deviation.} + \item{source}{Short citation.} +} +} +\source{ +CDFA Healthy Soils Program white paper (Geisseler et al.); + HSP 2026 Practice Guidelines. +} +\usage{ +ca_compost_cn_distribution +} +\description{ +Truncated normal distribution parameters for compost C:N used by +sample_ca_compost_cn. +} +\keyword{datasets} From 9b226351ba0294380a6f2cbdfa82547eb03d28cb Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:24:48 -0400 Subject: [PATCH 20/97] add doc for ca_compost_app_rate_envelope --- .../man/ca_compost_app_rate_envelope.Rd | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/data.land/man/ca_compost_app_rate_envelope.Rd diff --git a/modules/data.land/man/ca_compost_app_rate_envelope.Rd b/modules/data.land/man/ca_compost_app_rate_envelope.Rd new file mode 100644 index 0000000000..f503f51883 --- /dev/null +++ b/modules/data.land/man/ca_compost_app_rate_envelope.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_compost_app_rate_envelope} +\alias{ca_compost_app_rate_envelope} +\title{California compost application rate envelope by PFT family} +\format{ +A tibble with one row per PFT family: +\describe{ + \item{pft_family}{"annual" or "perennial".} + \item{min_t_ac, max_t_ac}{Application rate bounds.} + \item{source}{Short citation.} +} +} +\source{ +CDFA HSP white paper Table 2; HSP 2026 Practice Guidelines; + NRCS Conservation Practice Standard 336 Soil Carbon Amendment (2022). +} +\usage{ +ca_compost_app_rate_envelope +} +\description{ +Per family uniform rate envelope (dry weight tons per acre) used by +sample_ca_compost_app_rate. +} +\keyword{datasets} From 4dfed63ac432ba3e7eb69bacc218792750fa23f3 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:24:48 -0400 Subject: [PATCH 21/97] add doc for ca_compost_calendar_window --- .../man/ca_compost_calendar_window.Rd | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/data.land/man/ca_compost_calendar_window.Rd diff --git a/modules/data.land/man/ca_compost_calendar_window.Rd b/modules/data.land/man/ca_compost_calendar_window.Rd new file mode 100644 index 0000000000..60900bc37e --- /dev/null +++ b/modules/data.land/man/ca_compost_calendar_window.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_compost_calendar_window} +\alias{ca_compost_calendar_window} +\title{California compost application calendar window by PFT family} +\format{ +A tibble with one row per PFT family: +\describe{ + \item{pft_family}{"annual" or "perennial".} + \item{offset_days_min, offset_days_max}{Bounds on days before the anchor.} + \item{source}{Short citation.} +} +} +\source{ +CDFA HSP white paper Box 1; UC ANR cost studies; + Bernard et al. 2023 vineyard timing. +} +\usage{ +ca_compost_calendar_window +} +\description{ +Per family integer day offsets (subtracted from the cycle anchor) used +by sample_ca_compost_date_offset. +} +\keyword{datasets} From 56a95f681ef9d356310f5a2e09a40f7af1d05250 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:24:48 -0400 Subject: [PATCH 22/97] add doc for ca_compost_material_whitelist --- .../man/ca_compost_material_whitelist.Rd | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/data.land/man/ca_compost_material_whitelist.Rd diff --git a/modules/data.land/man/ca_compost_material_whitelist.Rd b/modules/data.land/man/ca_compost_material_whitelist.Rd new file mode 100644 index 0000000000..35720803eb --- /dev/null +++ b/modules/data.land/man/ca_compost_material_whitelist.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_compost_material_whitelist} +\alias{ca_compost_material_whitelist} +\title{California compost material whitelist by PFT family} +\format{ +A tibble in long format, one row per allowed pair: +\describe{ + \item{pft_family}{"annual" or "perennial".} + \item{material_class}{CalRecycle class: one of green, food, wood, + yard, ag, biosolids.} + \item{source}{Short citation.} +} +} +\source{ +14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks. +} +\usage{ +ca_compost_material_whitelist +} +\description{ +Allowed CalRecycle material classes for each PFT family, used by +sample_ca_compost_material. +} +\keyword{datasets} From ee1ef5ebd0c69930305c41043f7694ce361c208b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 23/97] add sample_ca_compost functions --- modules/data.land/R/sample_ca_compost.R | 187 ++++++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 modules/data.land/R/sample_ca_compost.R diff --git a/modules/data.land/R/sample_ca_compost.R b/modules/data.land/R/sample_ca_compost.R new file mode 100644 index 0000000000..e27bbedf43 --- /dev/null +++ b/modules/data.land/R/sample_ca_compost.R @@ -0,0 +1,187 @@ +#' Sample California compost amendment %C +#' +#' Draws n values of compost carbon content (%C, dry weight basis) from +#' the bundled truncated normal distribution at +#' ca_compost_pct_c_distribution. +#' +#' The default range (15 to 30%, mean 20%, sd 5) reflects CA finished +#' compost characterizations: Bernard et al. 2023 (central coast +#' vineyard, 14 to 15% C); Sullivan, Bary, Miller and Brewer 2018 (OSU +#' EM9217 proficiency program, median 15% TOC); CalRecycle generic +#' compost roughly 20 to 23% C. +#' +#' @param n integer. Number of draws. +#' @param params optional list overriding the bundled distribution. Must +#' contain numeric a, b, mean, sd. +#' +#' @return numeric vector of length n, each value in [a, b]. +#' +#' @examples +#' sample_ca_compost_pct_c(5) +#' +#' @export +sample_ca_compost_pct_c <- function(n, params = NULL) { + p <- params %||% as.list(PEcAn.data.land::ca_compost_pct_c_distribution) + truncnorm::rtruncnorm(n, a = p$a, b = p$b, mean = p$mean, sd = p$sd) +} + +#' Sample California compost C:N ratio +#' +#' Draws n values of compost C:N from the bundled truncated normal +#' distribution at ca_compost_cn_distribution. +#' +#' Default range (8 to 25, mean 12, sd 4) reflects the bimodal CA compost +#' distribution documented in the CDFA Healthy Soils Program white paper +#' (Geisseler et al.): manure dominant compost clusters at C:N at or +#' below 11 while plant dominant compost sits above 11. HSP 2026 Practice +#' Guidelines require applied C:N at or below 25. +#' +#' @param n integer. Number of draws. +#' @param params optional list overriding the bundled distribution. +#' +#' @return numeric vector of length n. +#' +#' @examples +#' sample_ca_compost_cn(5) +#' +#' @export +sample_ca_compost_cn <- function(n, params = NULL) { + p <- params %||% as.list(PEcAn.data.land::ca_compost_cn_distribution) + truncnorm::rtruncnorm(n, a = p$a, b = p$b, mean = p$mean, sd = p$sd) +} + +#' Sample California compost application rate by PFT family +#' +#' Draws n application rates (dry weight tons per acre) uniformly from +#' the per family envelope at ca_compost_app_rate_envelope. +#' +#' Envelopes follow CDFA Healthy Soils Program white paper Table 2 plus +#' HSP 2026 Practice Guidelines plus USDA NRCS Conservation Practice +#' Standard 336 Soil Carbon Amendment (2022). Defaults: annual crops 3 +#' to 8 t/ac dry, perennial crops 2 to 6 t/ac dry. +#' +#' @param pft_family character vector. PFT family for each draw. Must be +#' one of "annual", "perennial". Length 1 broadcasts to length n. +#' @param n integer. Number of draws. If pft_family has length > 1 then +#' n must equal length(pft_family). +#' +#' @return numeric vector of length n in tons per acre dry weight. +#' +#' @examples +#' sample_ca_compost_app_rate("annual", 5) +#' sample_ca_compost_app_rate(c("annual", "perennial", "annual"), 3) +#' +#' @export +sample_ca_compost_app_rate <- function(pft_family, n = length(pft_family)) { + if (length(pft_family) == 1 && n > 1) { + pft_family <- rep(pft_family, n) + } + if (length(pft_family) != n) { + PEcAn.logger::logger.severe( + "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) + } + env <- PEcAn.data.land::ca_compost_app_rate_envelope + out <- numeric(n) + for (fam in unique(pft_family)) { + if (!fam %in% env$pft_family) { + PEcAn.logger::logger.severe( + "Unknown pft_family '", fam, "'. Supported: ", + paste(env$pft_family, collapse = ", ")) + } + row <- env[env$pft_family == fam, , drop = FALSE] + idx <- which(pft_family == fam) + out[idx] <- stats::runif(length(idx), min = row$min_t_ac, max = row$max_t_ac) + } + out +} + +#' Sample California compost application date offset by PFT family +#' +#' Returns n integer day offsets (subtract from the cycle anchor, +#' typically MSLSP mslsp_OGI) drawn uniformly from the per family +#' calendar window at ca_compost_calendar_window. +#' +#' Defaults: annual crops 7 to 28 days before the anchor (CDFA HSP Box 1, +#' applied and incorporated before planting); perennial crops 60 to 180 +#' days before the anchor (dormant season application, UC ANR cost +#' studies plus Bernard et al. 2023 vineyard timing of Nov 9 and Jan 10). +#' +#' @param pft_family character vector. PFT family for each draw. +#' @param n integer. Number of draws. +#' +#' @return integer vector of day offsets. +#' +#' @examples +#' sample_ca_compost_date_offset("annual", 5) +#' +#' @export +sample_ca_compost_date_offset <- function(pft_family, n = length(pft_family)) { + if (length(pft_family) == 1 && n > 1) { + pft_family <- rep(pft_family, n) + } + if (length(pft_family) != n) { + PEcAn.logger::logger.severe( + "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) + } + win <- PEcAn.data.land::ca_compost_calendar_window + out <- integer(n) + for (fam in unique(pft_family)) { + if (!fam %in% win$pft_family) { + PEcAn.logger::logger.severe( + "Unknown pft_family '", fam, "'. Supported: ", + paste(win$pft_family, collapse = ", ")) + } + row <- win[win$pft_family == fam, , drop = FALSE] + idx <- which(pft_family == fam) + out[idx] <- sample(row$offset_days_min:row$offset_days_max, + length(idx), replace = TRUE) + } + out +} + +#' Sample California compost material class by PFT family +#' +#' Returns n material classes drawn from the per family whitelist at +#' ca_compost_material_whitelist. Uniform within the whitelist. +#' +#' Whitelist follows the CalRecycle taxonomy (14 CCR section 17852 plus +#' SB 1383 dominant feedstocks: green, food, wood, yard, ag, biosolids). +#' Defaults: annual crops can receive green / food / ag; perennial crops +#' can receive green / food / yard. Biosolids are excluded from food +#' crop parcels for regulatory compliance; wood waste is deferred since +#' it immobilizes N. +#' +#' @param pft_family character vector. PFT family for each draw. +#' @param n integer. Number of draws. +#' +#' @return character vector of material classes. +#' +#' @examples +#' sample_ca_compost_material("annual", 5) +#' +#' @export +sample_ca_compost_material <- function(pft_family, n = length(pft_family)) { + if (length(pft_family) == 1 && n > 1) { + pft_family <- rep(pft_family, n) + } + if (length(pft_family) != n) { + PEcAn.logger::logger.severe( + "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) + } + wl <- PEcAn.data.land::ca_compost_material_whitelist + out <- character(n) + for (fam in unique(pft_family)) { + allowed <- wl$material_class[wl$pft_family == fam] + if (length(allowed) == 0) { + PEcAn.logger::logger.severe( + "No material whitelist for pft_family '", fam, "'. Supported: ", + paste(unique(wl$pft_family), collapse = ", ")) + } + idx <- which(pft_family == fam) + out[idx] <- sample(allowed, length(idx), replace = TRUE) + } + out +} + +# small null fallback helper. +`%||%` <- function(x, y) if (is.null(x)) y else x From d8584562104ebc43462bb390c016a1065a237edd Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 24/97] add doc for sample_ca_compost_pct_c --- .../data.land/man/sample_ca_compost_pct_c.Rd | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/data.land/man/sample_ca_compost_pct_c.Rd diff --git a/modules/data.land/man/sample_ca_compost_pct_c.Rd b/modules/data.land/man/sample_ca_compost_pct_c.Rd new file mode 100644 index 0000000000..84f1467667 --- /dev/null +++ b/modules/data.land/man/sample_ca_compost_pct_c.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample_ca_compost.R +\name{sample_ca_compost_pct_c} +\alias{sample_ca_compost_pct_c} +\title{Sample California compost amendment %C} +\usage{ +sample_ca_compost_pct_c(n, params = NULL) +} +\arguments{ +\item{n}{integer. Number of draws.} + +\item{params}{optional list overriding the bundled distribution. Must +contain numeric a, b, mean, sd.} +} +\value{ +numeric vector of length n, each value in [a, b]. +} +\description{ +Draws n values of compost carbon content (%C, dry weight basis) from +the bundled truncated normal distribution at +ca_compost_pct_c_distribution. +} +\details{ +The default range (15 to 30%, mean 20%, sd 5) reflects CA finished +compost characterizations: Bernard et al. 2023 (central coast +vineyard, 14 to 15% C); Sullivan, Bary, Miller and Brewer 2018 (OSU +EM9217 proficiency program, median 15% TOC); CalRecycle generic +compost roughly 20 to 23% C. +} +\examples{ +sample_ca_compost_pct_c(5) + +} From c5d72f0ddca263e60e40bd305a0d5baee25eb219 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 25/97] add doc for sample_ca_compost_cn --- modules/data.land/man/sample_ca_compost_cn.Rd | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 modules/data.land/man/sample_ca_compost_cn.Rd diff --git a/modules/data.land/man/sample_ca_compost_cn.Rd b/modules/data.land/man/sample_ca_compost_cn.Rd new file mode 100644 index 0000000000..91b1730f69 --- /dev/null +++ b/modules/data.land/man/sample_ca_compost_cn.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample_ca_compost.R +\name{sample_ca_compost_cn} +\alias{sample_ca_compost_cn} +\title{Sample California compost C:N ratio} +\usage{ +sample_ca_compost_cn(n, params = NULL) +} +\arguments{ +\item{n}{integer. Number of draws.} + +\item{params}{optional list overriding the bundled distribution.} +} +\value{ +numeric vector of length n. +} +\description{ +Draws n values of compost C:N from the bundled truncated normal +distribution at ca_compost_cn_distribution. +} +\details{ +Default range (8 to 25, mean 12, sd 4) reflects the bimodal CA compost +distribution documented in the CDFA Healthy Soils Program white paper +(Geisseler et al.): manure dominant compost clusters at C:N at or +below 11 while plant dominant compost sits above 11. HSP 2026 Practice +Guidelines require applied C:N at or below 25. +} +\examples{ +sample_ca_compost_cn(5) + +} From c353ef56b00f9853032f15c44e5df74fc5eae89f Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 26/97] add doc for sample_ca_compost_app_rate --- .../man/sample_ca_compost_app_rate.Rd | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/data.land/man/sample_ca_compost_app_rate.Rd diff --git a/modules/data.land/man/sample_ca_compost_app_rate.Rd b/modules/data.land/man/sample_ca_compost_app_rate.Rd new file mode 100644 index 0000000000..c1a938bbf6 --- /dev/null +++ b/modules/data.land/man/sample_ca_compost_app_rate.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample_ca_compost.R +\name{sample_ca_compost_app_rate} +\alias{sample_ca_compost_app_rate} +\title{Sample California compost application rate by PFT family} +\usage{ +sample_ca_compost_app_rate(pft_family, n = length(pft_family)) +} +\arguments{ +\item{pft_family}{character vector. PFT family for each draw. Must be +one of "annual", "perennial". Length 1 broadcasts to length n.} + +\item{n}{integer. Number of draws. If pft_family has length > 1 then +n must equal length(pft_family).} +} +\value{ +numeric vector of length n in tons per acre dry weight. +} +\description{ +Draws n application rates (dry weight tons per acre) uniformly from +the per family envelope at ca_compost_app_rate_envelope. +} +\details{ +Envelopes follow CDFA Healthy Soils Program white paper Table 2 plus +HSP 2026 Practice Guidelines plus USDA NRCS Conservation Practice +Standard 336 Soil Carbon Amendment (2022). Defaults: annual crops 3 +to 8 t/ac dry, perennial crops 2 to 6 t/ac dry. +} +\examples{ +sample_ca_compost_app_rate("annual", 5) +sample_ca_compost_app_rate(c("annual", "perennial", "annual"), 3) + +} From 1d249779d913a405ec4b08be5f1a3ba8f9fffe64 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 27/97] add doc for sample_ca_compost_date_offset --- .../man/sample_ca_compost_date_offset.Rd | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 modules/data.land/man/sample_ca_compost_date_offset.Rd diff --git a/modules/data.land/man/sample_ca_compost_date_offset.Rd b/modules/data.land/man/sample_ca_compost_date_offset.Rd new file mode 100644 index 0000000000..fa57f78a78 --- /dev/null +++ b/modules/data.land/man/sample_ca_compost_date_offset.Rd @@ -0,0 +1,31 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample_ca_compost.R +\name{sample_ca_compost_date_offset} +\alias{sample_ca_compost_date_offset} +\title{Sample California compost application date offset by PFT family} +\usage{ +sample_ca_compost_date_offset(pft_family, n = length(pft_family)) +} +\arguments{ +\item{pft_family}{character vector. PFT family for each draw.} + +\item{n}{integer. Number of draws.} +} +\value{ +integer vector of day offsets. +} +\description{ +Returns n integer day offsets (subtract from the cycle anchor, +typically MSLSP mslsp_OGI) drawn uniformly from the per family +calendar window at ca_compost_calendar_window. +} +\details{ +Defaults: annual crops 7 to 28 days before the anchor (CDFA HSP Box 1, +applied and incorporated before planting); perennial crops 60 to 180 +days before the anchor (dormant season application, UC ANR cost +studies plus Bernard et al. 2023 vineyard timing of Nov 9 and Jan 10). +} +\examples{ +sample_ca_compost_date_offset("annual", 5) + +} From a71ef65b9438e41195cabb6db94d3ec66bc63688 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:25:29 -0400 Subject: [PATCH 28/97] add doc for sample_ca_compost_material --- .../man/sample_ca_compost_material.Rd | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 modules/data.land/man/sample_ca_compost_material.Rd diff --git a/modules/data.land/man/sample_ca_compost_material.Rd b/modules/data.land/man/sample_ca_compost_material.Rd new file mode 100644 index 0000000000..e9e1c30de7 --- /dev/null +++ b/modules/data.land/man/sample_ca_compost_material.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/sample_ca_compost.R +\name{sample_ca_compost_material} +\alias{sample_ca_compost_material} +\title{Sample California compost material class by PFT family} +\usage{ +sample_ca_compost_material(pft_family, n = length(pft_family)) +} +\arguments{ +\item{pft_family}{character vector. PFT family for each draw.} + +\item{n}{integer. Number of draws.} +} +\value{ +character vector of material classes. +} +\description{ +Returns n material classes drawn from the per family whitelist at +ca_compost_material_whitelist. Uniform within the whitelist. +} +\details{ +Whitelist follows the CalRecycle taxonomy (14 CCR section 17852 plus +SB 1383 dominant feedstocks: green, food, wood, yard, ag, biosolids). +Defaults: annual crops can receive green / food / ag; perennial crops +can receive green / food / yard. Biosolids are excluded from food +crop parcels for regulatory compliance; wood waste is deferred since +it immobilizes N. +} +\examples{ +sample_ca_compost_material("annual", 5) + +} From 5f5172c3b502cf1a962047179964643901ea3bc7 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:26:42 -0400 Subject: [PATCH 29/97] add tests for sample_ca_compost --- .../tests/testthat/test-sample_ca_compost.R | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 modules/data.land/tests/testthat/test-sample_ca_compost.R diff --git a/modules/data.land/tests/testthat/test-sample_ca_compost.R b/modules/data.land/tests/testthat/test-sample_ca_compost.R new file mode 100644 index 0000000000..5bcf9369b9 --- /dev/null +++ b/modules/data.land/tests/testthat/test-sample_ca_compost.R @@ -0,0 +1,25 @@ +test_that("sample_ca_compost_material draws only from the per family whitelist", { + set.seed(1) + wl <- PEcAn.data.land::ca_compost_material_whitelist + ann_allowed <- wl$material_class[wl$pft_family == "annual"] + per_allowed <- wl$material_class[wl$pft_family == "perennial"] + expect_true(all(PEcAn.data.land::sample_ca_compost_material("annual", 500) %in% ann_allowed)) + expect_true(all(PEcAn.data.land::sample_ca_compost_material("perennial", 500) %in% per_allowed)) +}) + +test_that("sample_ca_compost_app_rate handles a mixed pft_family vector", { + set.seed(1) + fams <- rep(c("annual", "perennial"), 100) + x <- PEcAn.data.land::sample_ca_compost_app_rate(fams) + env <- PEcAn.data.land::ca_compost_app_rate_envelope + ann <- env[env$pft_family == "annual", ] + per <- env[env$pft_family == "perennial", ] + expect_true(all(x[fams == "annual"] >= ann$min_t_ac & x[fams == "annual"] <= ann$max_t_ac)) + expect_true(all(x[fams == "perennial"] >= per$min_t_ac & x[fams == "perennial"] <= per$max_t_ac)) +}) + +test_that("samplers fail loudly on an unknown pft_family", { + expect_error(PEcAn.data.land::sample_ca_compost_app_rate("hay", 5)) + expect_error(PEcAn.data.land::sample_ca_compost_date_offset("rice", 5)) + expect_error(PEcAn.data.land::sample_ca_compost_material("alfalfa", 5)) +}) From f52c1c38ee6726920f4c230fa609ae99a0c0c3eb Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:26:42 -0400 Subject: [PATCH 30/97] update bundled dataset docs --- modules/data.land/R/data.R | 127 +++++++++++++++++++++++++++---------- 1 file changed, 94 insertions(+), 33 deletions(-) diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index 34f5c931c7..86ba90bba2 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -238,56 +238,117 @@ #' \url{https://escholarship.org/uc/item/5mk2q1sm} #' @source Meyer, R. D., Marcum, D. B., Orloff, S. B., & Schmierer, J. L. #' (2007). Alfalfa fertilization strategies. UC ANR Publication 8296. -#' -#' @seealso \code{\link{look_up_ca_n_rate}} for looking up rates by crop name. -#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient -#' composition (N/C fractions) from the SWAT/DayCent database. "ca_n_application_rate" #' California organic amendment (compost) properties #' #' Properties of organic amendment materials used in California agriculture, -#' including C:N ratios, carbon and nitrogen content, plant-available nitrogen -#' (PAN), and application rates. Some materials appear in multiple rows when -#' values are reported by different sources (e.g. Corn stalks, Cow manure, -#' Vegetable waste). The \code{source} column disambiguates these. +#' including C:N ratios, nitrogen content, plant available nitrogen (PAN), +#' and application rates. #' #' @format A tibble with 32 rows and the following columns: #' \describe{ -#' \item{material}{\code{character}. Amendment material name.} -#' \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio -#' range and average.} -#' \item{c_pct}{\code{numeric}. Assumed carbon content (percent).} -#' \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} -#' \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks -#' (percent). Negative values indicate N immobilization.} -#' \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} -#' \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range -#' (lbs/acre).} -#' \item{total_c_min_lbs_acre, total_c_max_lbs_acre}{\code{numeric}. -#' Total carbon applied (lbs C/acre).} -#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. -#' Total nitrogen applied (lbs N/acre).} -#' \item{total_c_min_g_m2, total_c_max_g_m2}{\code{numeric}. -#' Total carbon in SI units (g C/m\eqn{^2}).} -#' \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. -#' Total nitrogen in SI units (g N/m\eqn{^2}).} -#' \item{source}{\code{character}. Short citation for the data source.} +#' \item{material}{Amendment material name.} +#' \item{material_class}{CalRecycle taxonomy (14 CCR section 17852): +#' one of green, food, wood, yard, ag, biosolids.} +#' \item{cn_min, cn_max, cn_avg}{Carbon to nitrogen ratio range and +#' average.} +#' \item{n_pct}{Total nitrogen content (percent).} +#' \item{pan_pct}{Plant available nitrogen after 4 weeks (percent). +#' Negative values indicate N immobilization.} +#' \item{n_class}{"LOWER" or "HIGHER" N content class.} +#' \item{app_rate_min, app_rate_max}{Application rate range (lbs/acre).} +#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total nitrogen +#' applied (lbs N/acre).} +#' \item{total_n_min_g_m2, total_n_max_g_m2}{Total nitrogen in SI +#' units (g N/m^2).} +#' \item{source}{Short citation for the data source.} #' } #' #' @source Eghball, B. Composting Manure and Other Organic Residues. -#' University of Nebraska-Lincoln Extension, Publication G2222. +#' University of Nebraska Lincoln Extension, Publication G2222. #' \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} #' @source Rynk, R. (ed.) Compost Production and Use in Sustainable #' Farming Systems. NC State Extension. #' \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} -#' -#' @seealso \code{\link{look_up_ca_compost_amendment}} for looking up -#' amendments by material name. -#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient -#' composition (N/C fractions) from the SWAT/DayCent database. "ca_compost_amendment" +#' California compost carbon content distribution +#' +#' Truncated normal distribution parameters for compost %C (dry weight +#' basis) used by sample_ca_compost_pct_c. +#' +#' @format A tibble with one row: +#' \describe{ +#' \item{a, b}{Lower and upper truncation bounds.} +#' \item{mean, sd}{Untruncated mean and standard deviation.} +#' \item{source}{Short citation for the parameters.} +#' } +#' @source Bernard et al. 2023 Frontiers in Environmental Science; +#' Sullivan, Bary, Miller & Brewer 2018 OSU EM9217; +#' CalRecycle finished compost characterization. +"ca_compost_pct_c_distribution" + +#' California compost C:N ratio distribution +#' +#' Truncated normal distribution parameters for compost C:N used by +#' sample_ca_compost_cn. +#' +#' @format A tibble with one row: +#' \describe{ +#' \item{a, b}{Lower and upper truncation bounds.} +#' \item{mean, sd}{Untruncated mean and standard deviation.} +#' \item{source}{Short citation.} +#' } +#' @source CDFA Healthy Soils Program white paper (Geisseler et al.); +#' HSP 2026 Practice Guidelines. +"ca_compost_cn_distribution" + +#' California compost application rate envelope by PFT family +#' +#' Per family uniform rate envelope (dry weight tons per acre) used by +#' sample_ca_compost_app_rate. +#' +#' @format A tibble with one row per PFT family: +#' \describe{ +#' \item{pft_family}{"annual" or "perennial".} +#' \item{min_t_ac, max_t_ac}{Application rate bounds.} +#' \item{source}{Short citation.} +#' } +#' @source CDFA HSP white paper Table 2; HSP 2026 Practice Guidelines; +#' NRCS Conservation Practice Standard 336 Soil Carbon Amendment (2022). +"ca_compost_app_rate_envelope" + +#' California compost application calendar window by PFT family +#' +#' Per family integer day offsets (subtracted from the cycle anchor) used +#' by sample_ca_compost_date_offset. +#' +#' @format A tibble with one row per PFT family: +#' \describe{ +#' \item{pft_family}{"annual" or "perennial".} +#' \item{offset_days_min, offset_days_max}{Bounds on days before the anchor.} +#' \item{source}{Short citation.} +#' } +#' @source CDFA HSP white paper Box 1; UC ANR cost studies; +#' Bernard et al. 2023 vineyard timing. +"ca_compost_calendar_window" + +#' California compost material whitelist by PFT family +#' +#' Allowed CalRecycle material classes for each PFT family, used by +#' sample_ca_compost_material. +#' +#' @format A tibble in long format, one row per allowed pair: +#' \describe{ +#' \item{pft_family}{"annual" or "perennial".} +#' \item{material_class}{CalRecycle class: one of green, food, wood, +#' yard, ag, biosolids.} +#' \item{source}{Short citation.} +#' } +#' @source 14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks. +"ca_compost_material_whitelist" + #' Crop-specific rooting depths and water-depletion thresholds #' #' Maximum effective rooting depth and minimum soil water content thresholds From 955e7f17988486440d6ba24cce1b4b23d684f8c0 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:26:42 -0400 Subject: [PATCH 31/97] export new helpers and samplers --- modules/data.land/NAMESPACE | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/data.land/NAMESPACE b/modules/data.land/NAMESPACE index 0c701cc961..3b5afb3896 100644 --- a/modules/data.land/NAMESPACE +++ b/modules/data.land/NAMESPACE @@ -55,6 +55,7 @@ export(mslsp_to_canopycover) export(ndti_to_sipnet_tillage) export(netcdf.writer.BADM) export(om2soc) +export(oz_per_tree_to_lb_per_acre) export(parse.MatrixNames) export(partition_roots) export(plot2AGB) @@ -63,6 +64,11 @@ export(pool_ic_netcdf2list) export(prepare_pools) export(preprocess_soilgrids_data) export(put_veg_module) +export(sample_ca_compost_app_rate) +export(sample_ca_compost_cn) +export(sample_ca_compost_date_offset) +export(sample_ca_compost_material) +export(sample_ca_compost_pct_c) export(sample_ic) export(sclass) export(shp2kml) @@ -82,6 +88,7 @@ export(subset_layer) export(to.Tag) export(to.TreeCode) export(to_co2e) +export(tpa_lookup) export(validate_events_json) export(write_ic) export(write_veg) From 30e620debcb52043be2f62c8f005e96a676c91da Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:26:43 -0400 Subject: [PATCH 32/97] add ncc event type to events schema --- modules/data.land/inst/events_schema_v0.1.2.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/data.land/inst/events_schema_v0.1.2.json b/modules/data.land/inst/events_schema_v0.1.2.json index e41596abef..3e0f0df733 100644 --- a/modules/data.land/inst/events_schema_v0.1.2.json +++ b/modules/data.land/inst/events_schema_v0.1.2.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://pecanproject.org/schema/events-mvp-0-1-1.json", + "$id": "https://pecanproject.org/schema/events-mvp-0-1-2.json", "oneOf": [ { "$ref": "#/$defs/site" }, { "type": "array", "items": { "$ref": "#/$defs/site" } } @@ -23,7 +23,7 @@ "properties": { "event_type": { "type": "string", - "enum": ["planting", "harvest", "irrigation", "fertilization", "tillage", "leafon", "leafoff"] + "enum": ["planting", "harvest", "irrigation", "fertilization", "ncc", "tillage", "leafon", "leafoff"] }, "date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "fraction_area": { "type": "number", "minimum": 0, "maximum": 1, "default": 1.0 }, @@ -50,6 +50,10 @@ "org_n_kg_m2": { "type": "number", "minimum": 0 }, "nh4_n_kg_m2": { "type": "number", "minimum": 0 }, "no3_n_kg_m2": { "type": "number", "minimum": 0 }, + "fert_subtype": { "type": "string" }, + "material": { "type": "string" }, + "ncc_subtype": { "type": "string" }, + "PFT": { "type": "string" }, "tillage_eff_0to1": { "type": "number", "minimum": 0 }, "intensity_category": { "type": "string" }, @@ -68,6 +72,8 @@ { "required": ["nh4_n_kg_m2"] }, { "required": ["no3_n_kg_m2"] } ] } }, + { "if": { "properties": { "event_type": { "const": "ncc" } } }, + "then": { "required": ["org_c_kg_m2", "org_n_kg_m2", "material"] } }, { "if": { "properties": { "event_type": { "const": "tillage" } } }, "then": { "required": ["tillage_eff_0to1"] } } ], From d0c79ef95f5976edb16feb989a008294b41c15b2 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:27:23 -0400 Subject: [PATCH 33/97] update doc for ca_n_application_rate --- modules/data.land/man/ca_n_application_rate.Rd | 5 ----- 1 file changed, 5 deletions(-) diff --git a/modules/data.land/man/ca_n_application_rate.Rd b/modules/data.land/man/ca_n_application_rate.Rd index 8c6b97d6df..9b9ee42d00 100644 --- a/modules/data.land/man/ca_n_application_rate.Rd +++ b/modules/data.land/man/ca_n_application_rate.Rd @@ -41,9 +41,4 @@ breakdowns). When multiple sources report rates for the same crop, the rate represents the envelope (min of minimums, max of maximums) across sources. } -\seealso{ -\code{\link{look_up_ca_n_rate}} for looking up rates by crop name. - \code{\link{look_up_fertilizer_components}} for fertilizer nutrient - composition (N/C fractions) from the SWAT/DayCent database. -} \keyword{datasets} From 0974b366665ebb343533a5e25844371988db4281 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:53:44 -0400 Subject: [PATCH 34/97] update dataset docs --- modules/data.land/R/data.R | 49 ++++++++++++------- modules/data.land/man/ca_compost_amendment.Rd | 46 ++++++++++------- .../data.land/man/ca_n_application_rate.Rd | 5 ++ 3 files changed, 64 insertions(+), 36 deletions(-) diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index 86ba90bba2..90b10c3fea 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -238,39 +238,52 @@ #' \url{https://escholarship.org/uc/item/5mk2q1sm} #' @source Meyer, R. D., Marcum, D. B., Orloff, S. B., & Schmierer, J. L. #' (2007). Alfalfa fertilization strategies. UC ANR Publication 8296. +#' +#' @seealso \code{\link{look_up_ca_n_rate}} for looking up rates by crop name. +#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient +#' composition (N/C fractions) from the SWAT/DayCent database. "ca_n_application_rate" #' California organic amendment (compost) properties #' #' Properties of organic amendment materials used in California agriculture, -#' including C:N ratios, nitrogen content, plant available nitrogen (PAN), -#' and application rates. +#' including C:N ratios, carbon and nitrogen content, plant-available nitrogen +#' (PAN), and application rates. Some materials appear in multiple rows when +#' values are reported by different sources (e.g. Corn stalks, Cow manure, +#' Vegetable waste). The \code{source} column disambiguates these. #' #' @format A tibble with 32 rows and the following columns: #' \describe{ -#' \item{material}{Amendment material name.} -#' \item{material_class}{CalRecycle taxonomy (14 CCR section 17852): -#' one of green, food, wood, yard, ag, biosolids.} -#' \item{cn_min, cn_max, cn_avg}{Carbon to nitrogen ratio range and -#' average.} -#' \item{n_pct}{Total nitrogen content (percent).} -#' \item{pan_pct}{Plant available nitrogen after 4 weeks (percent). -#' Negative values indicate N immobilization.} -#' \item{n_class}{"LOWER" or "HIGHER" N content class.} -#' \item{app_rate_min, app_rate_max}{Application rate range (lbs/acre).} -#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total nitrogen -#' applied (lbs N/acre).} -#' \item{total_n_min_g_m2, total_n_max_g_m2}{Total nitrogen in SI -#' units (g N/m^2).} -#' \item{source}{Short citation for the data source.} +#' \item{material}{\code{character}. Amendment material name.} +#' \item{material_class}{\code{character}. CalRecycle taxonomy +#' (14 CCR section 17852): one of green, food, wood, yard, ag, +#' biosolids.} +#' \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio +#' range and average.} +#' \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} +#' \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks +#' (percent). Negative values indicate N immobilization.} +#' \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} +#' \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range +#' (lbs/acre).} +#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. +#' Total nitrogen applied (lbs N/acre).} +#' \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. +#' Total nitrogen in SI units (g N/m\eqn{^2}).} +#' \item{source}{\code{character}. Short citation for the data source.} #' } #' #' @source Eghball, B. Composting Manure and Other Organic Residues. -#' University of Nebraska Lincoln Extension, Publication G2222. +#' University of Nebraska-Lincoln Extension, Publication G2222. #' \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} #' @source Rynk, R. (ed.) Compost Production and Use in Sustainable #' Farming Systems. NC State Extension. #' \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} +#' +#' @seealso \code{\link{look_up_ca_compost_amendment}} for looking up +#' amendments by material name. +#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient +#' composition (N/C fractions) from the SWAT/DayCent database. "ca_compost_amendment" #' California compost carbon content distribution diff --git a/modules/data.land/man/ca_compost_amendment.Rd b/modules/data.land/man/ca_compost_amendment.Rd index 5de06b63f7..0670cf794b 100644 --- a/modules/data.land/man/ca_compost_amendment.Rd +++ b/modules/data.land/man/ca_compost_amendment.Rd @@ -7,26 +7,28 @@ \format{ A tibble with 32 rows and the following columns: \describe{ - \item{material}{Amendment material name.} - \item{material_class}{CalRecycle taxonomy (14 CCR section 17852): - one of green, food, wood, yard, ag, biosolids.} - \item{cn_min, cn_max, cn_avg}{Carbon to nitrogen ratio range and - average.} - \item{n_pct}{Total nitrogen content (percent).} - \item{pan_pct}{Plant available nitrogen after 4 weeks (percent). - Negative values indicate N immobilization.} - \item{n_class}{"LOWER" or "HIGHER" N content class.} - \item{app_rate_min, app_rate_max}{Application rate range (lbs/acre).} - \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total nitrogen - applied (lbs N/acre).} - \item{total_n_min_g_m2, total_n_max_g_m2}{Total nitrogen in SI - units (g N/m^2).} - \item{source}{Short citation for the data source.} + \item{material}{\code{character}. Amendment material name.} + \item{material_class}{\code{character}. CalRecycle taxonomy + (14 CCR section 17852): one of green, food, wood, yard, ag, + biosolids.} + \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio + range and average.} + \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} + \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks + (percent). Negative values indicate N immobilization.} + \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} + \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range + (lbs/acre).} + \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. + Total nitrogen applied (lbs N/acre).} + \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. + Total nitrogen in SI units (g N/m\eqn{^2}).} + \item{source}{\code{character}. Short citation for the data source.} } } \source{ Eghball, B. Composting Manure and Other Organic Residues. - University of Nebraska Lincoln Extension, Publication G2222. + University of Nebraska-Lincoln Extension, Publication G2222. \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} Rynk, R. (ed.) Compost Production and Use in Sustainable @@ -38,7 +40,15 @@ ca_compost_amendment } \description{ Properties of organic amendment materials used in California agriculture, -including C:N ratios, nitrogen content, plant available nitrogen (PAN), -and application rates. +including C:N ratios, carbon and nitrogen content, plant-available nitrogen +(PAN), and application rates. Some materials appear in multiple rows when +values are reported by different sources (e.g. Corn stalks, Cow manure, +Vegetable waste). The \code{source} column disambiguates these. +} +\seealso{ +\code{\link{look_up_ca_compost_amendment}} for looking up + amendments by material name. + \code{\link{look_up_fertilizer_components}} for fertilizer nutrient + composition (N/C fractions) from the SWAT/DayCent database. } \keyword{datasets} diff --git a/modules/data.land/man/ca_n_application_rate.Rd b/modules/data.land/man/ca_n_application_rate.Rd index 9b9ee42d00..8c6b97d6df 100644 --- a/modules/data.land/man/ca_n_application_rate.Rd +++ b/modules/data.land/man/ca_n_application_rate.Rd @@ -41,4 +41,9 @@ breakdowns). When multiple sources report rates for the same crop, the rate represents the envelope (min of minimums, max of maximums) across sources. } +\seealso{ +\code{\link{look_up_ca_n_rate}} for looking up rates by crop name. + \code{\link{look_up_fertilizer_components}} for fertilizer nutrient + composition (N/C fractions) from the SWAT/DayCent database. +} \keyword{datasets} From d0844c9e6cb5c770fee125c2aa8ef122d6dfe314 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Mon, 18 May 2026 14:56:56 -0400 Subject: [PATCH 35/97] update create_compost_data --- modules/data.land/data-raw/create_compost_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data.land/data-raw/create_compost_data.R b/modules/data.land/data-raw/create_compost_data.R index dcf97bd927..00e4d0c372 100644 --- a/modules/data.land/data-raw/create_compost_data.R +++ b/modules/data.land/data-raw/create_compost_data.R @@ -23,7 +23,7 @@ LBS_ACRE_TO_G_M2 <- 0.112085 material_to_class <- function(m) { s <- tolower(m) dplyr::case_when( - grepl("grass", s) ~ "green", + grepl("grass", s) ~ "green", grepl("manure|alfalfa|blood|poultry|corn cob|corn stalk", s) ~ "ag", grepl("apple|coffee|fruit|vegetable", s) ~ "food", grepl("bark|sawdust|woodchip|newspaper|paper", s) ~ "wood", From 246fb5b60cd3f61cbe3a0724bfa4b863f41dc56b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 36/97] revert events schema additions; drop ncc as a seperate event --- .../data.land/data-raw/compost_amendments.csv | 33 --------------- .../data-raw/n_application_rates.csv | 42 ------------------- .../data.land/inst/events_schema_v0.1.2.json | 10 +---- 3 files changed, 2 insertions(+), 83 deletions(-) delete mode 100644 modules/data.land/data-raw/compost_amendments.csv delete mode 100644 modules/data.land/data-raw/n_application_rates.csv diff --git a/modules/data.land/data-raw/compost_amendments.csv b/modules/data.land/data-raw/compost_amendments.csv deleted file mode 100644 index ba5169b388..0000000000 --- a/modules/data.land/data-raw/compost_amendments.csv +++ /dev/null @@ -1,33 +0,0 @@ -material,material_class,cn_min,cn_max,cn_avg,n_pct,pan_pct,n_class,app_rate_min,app_rate_max,total_n_min_lbs_acre,total_n_max_lbs_acre,total_n_min_g_m2,total_n_max_g_m2,source -Alfalfa hay,ag,13,13,13,3.08,16.15,LOWER,8000,10600,246.15,326.15,27.59,36.557,"Eghball, UNL Extension" -Apple pomace,food,21,21,21,1.9,-1.43,LOWER,8000,10600,152.38,201.9,17.08,22.63,"Eghball, UNL Extension" -Bark,wood,100,130,115,0.35,-24.78,LOWER,8000,10600,27.83,36.87,3.119,4.133,"Eghball, UNL Extension" -Blood meal,ag,4,4,4,10,60,HIGHER,4400,7200,440,720,49.317,80.701,"Eghball, UNL Extension" -Coffee grounds,food,20,20,20,2,0,LOWER,8000,10600,160,212,17.934,23.762,"Eghball, UNL Extension" -Corn cobs,ag,50,120,85,0.47,-22.94,LOWER,8000,10600,37.65,49.88,4.22,5.591,"Eghball, UNL Extension" -Corn stalks,ag,60,70,65,0.62,-20.77,LOWER,8000,10600,49.23,65.23,5.518,7.311,"Rynk, NC State Extension" -Corn stalks,ag,80,80,80,0.5,-22.5,LOWER,8000,10600,40,53,4.483,5.941,"Eghball, UNL Extension" -Cow manure,ag,20,25,22.5,1.78,-3.33,LOWER,8000,10600,142.22,188.44,15.941,21.121,"Rynk, NC State Extension" -Cow manure,ag,20,20,20,2,0,LOWER,8000,10600,160,212,17.934,23.762,"Eghball, UNL Extension" -Dry leaves,yard,30,80,55,0.73,-19.09,LOWER,8000,10600,58.18,77.09,6.521,8.641,"Rynk, NC State Extension" -Fruit waste,food,35,35,35,1.14,-12.86,LOWER,8000,10600,91.43,121.14,10.248,13.578,"Eghball, UNL Extension" -Grass,green,12,25,18.5,2.16,2.43,LOWER,8000,10600,172.97,229.19,19.387,25.689,"Rynk, NC State Extension" -Grass clippings,green,12,25,18.5,2.16,2.43,LOWER,8000,10600,172.97,229.19,19.387,25.689,"Eghball, UNL Extension" -Horse manure,ag,20,30,25,1.6,-6,LOWER,8000,10600,128,169.6,14.347,19.01,"Rynk, NC State Extension" -Leaves,yard,40,80,60,0.67,-20,LOWER,8000,10600,53.33,70.67,5.977,7.921,"Eghball, UNL Extension" -Manure — cow and horse,ag,20,25,22.5,1.78,-3.33,LOWER,8000,10600,142.22,188.44,15.941,21.121,"Eghball, UNL Extension" -Manure — poultry (fresh),ag,10,10,10,4,30,HIGHER,4400,7200,176,288,19.727,32.28,"Eghball, UNL Extension" -Manure with litter — horse,ag,30,60,45,0.89,-16.67,LOWER,8000,10600,71.11,94.22,7.97,10.561,"Eghball, UNL Extension" -Manure with litter — poultry,ag,13,18,15.5,2.58,8.71,LOWER,8000,10600,206.45,273.55,23.14,30.661,"Eghball, UNL Extension" -Newspaper,wood,400,800,600,0.07,-29,LOWER,8000,10600,5.33,7.07,0.597,0.792,"Rynk, NC State Extension" -"Newspaper, shredded",wood,400,800,600,0.07,-29,LOWER,8000,10600,5.33,7.07,0.597,0.792,"Eghball, UNL Extension" -Paper,wood,150,200,175,0.23,-26.57,LOWER,8000,10600,18.29,24.23,2.05,2.716,"Eghball, UNL Extension" -Pine needles,yard,80,80,80,0.5,-22.5,LOWER,8000,10600,40,53,4.483,5.941,"Eghball, UNL Extension" -Poultry litter,ag,5,20,12.5,3.2,18,LOWER,8000,10600,256,339.2,28.694,38.019,"Rynk, NC State Extension" -Sawdust and wood chips,wood,100,500,300,0.13,-28,LOWER,8000,10600,10.67,14.13,1.196,1.584,"Eghball, UNL Extension" -Straw,yard,40,100,70,0.57,-21.43,LOWER,8000,10600,45.71,60.57,5.123,6.789,"Rynk, NC State Extension" -Straw — oats and wheat,yard,70,80,75,0.53,-22,LOWER,8000,10600,42.67,56.53,4.783,6.336,"Eghball, UNL Extension" -Swine manure,ag,8,20,14,2.86,12.86,LOWER,8000,10600,228.57,302.86,25.619,33.946,"Rynk, NC State Extension" -Vegetable waste,food,10,20,15,2.67,10,LOWER,8000,10600,213.33,282.67,23.911,31.683,"Rynk, NC State Extension" -Vegetable waste,food,12,20,16,2.5,7.5,LOWER,8000,10600,200,265,22.417,29.703,"Eghball, UNL Extension" -Woodchips,wood,100,500,300,0.13,-28,LOWER,8000,10600,10.67,14.13,1.196,1.584,"Rynk, NC State Extension" diff --git a/modules/data.land/data-raw/n_application_rates.csv b/modules/data.land/data-raw/n_application_rates.csv deleted file mode 100644 index 71d1542f43..0000000000 --- a/modules/data.land/data-raw/n_application_rates.csv +++ /dev/null @@ -1,42 +0,0 @@ -pft_group,crop,min_n_lbs_acre,max_n_lbs_acre,source,min_n_g_m2,max_n_g_m2 -rice,Rice,110,145,"Rosenstock et al., 2013",12.329,16.252 -row,Alfalfa,0,0,Meyer et al. 2007. Pub. 8292,0,0 -row,Barley,65,250,CDFA-FREP & UC Davis,7.286,28.021 -row,"Bean, blackeye",0,8,CDFA-FREP & UC Davis,0,0.897 -row,"Bean, common",70,300,CDFA-FREP & UC Davis,7.846,33.626 -row,"Bean, dry",86,116,"Rosenstock et al., 2013",9.639,13.002 -row,"Bean, lima",55,233,CDFA-FREP & UC Davis,6.165,26.116 -row,Broccoli,100,240,"Rosenstock et al., 2013; CDFA-FREP & UC Davis",11.209,26.9 -row,Carrot,100,250,"Rosenstock et al., 2013",11.209,28.021 -row,Cauliflower,40,60,CDFA-FREP & UC Davis,4.483,6.725 -row,Celery,200,275,"Rosenstock et al., 2013",22.417,30.823 -row,Corn,150,275,"Rosenstock et al., 2013",16.813,30.823 -row,"Corn, sweet",100,200,"Rosenstock et al., 2013",11.209,22.417 -row,Cotton,100,200,"Rosenstock et al., 2013",11.209,22.417 -row,Lettuce,170,220,"Rosenstock et al., 2013",19.054,24.659 -row,"Melon, cantaloupe",80,150,"Rosenstock et al., 2013",8.967,16.813 -row,"Melon, watermelon",0,160,"Rosenstock et al., 2013",0,17.934 -row,Melons,80,200,CDFA-FREP & UC Davis,8.967,22.417 -row,Melons (mixed),100,150,"Rosenstock et al., 2013",11.209,16.813 -row,Oats,50,120,"Rosenstock et al., 2013",5.604,13.45 -row,Onion,100,400,"Rosenstock et al., 2013",11.209,44.834 -row,"Pepper, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 -row,"Pepper, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 -row,Safflower,100,150,"Rosenstock et al., 2013",11.209,16.813 -row,Strawberry,150,300,"Rosenstock et al., 2013",16.813,33.626 -row,"Tomatoes, fresh market",125,350,"Rosenstock et al., 2013",14.011,39.23 -row,"Tomatoes, processing",100,150,"Rosenstock et al., 2013",11.209,16.813 -row,Wheat,100,240,"Rosenstock et al., 2013",11.209,26.9 -woody,Almonds,30,255,Brown et al. 2020 NBMP Table 2,3.363,28.582 -woody,Avocado,67,100,"Rosenstock et al., 2013",7.51,11.209 -woody,"Grape, raisin",20,60,"Rosenstock et al., 2013",2.242,6.725 -woody,Grapevines,20,60,Meyer et al. 2007. Pub. 8296,2.242,6.725 -woody,Nectarine,100,150,"Rosenstock et al., 2013",11.209,16.813 -woody,"Peach, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 -woody,"Peach, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 -woody,"Peach, cling",50,100,"Rosenstock et al., 2013",5.604,11.209 -woody,"Peach, free",50,100,"Rosenstock et al., 2013",5.604,11.209 -woody,Pistachios,100,225,"Rosenstock et al., 2013",11.209,25.219 -woody,"Plums, dried",0,100,"Rosenstock et al., 2013",0,11.209 -woody,"Plums, fresh",110,150,"Rosenstock et al., 2013",12.329,16.813 -woody,Walnuts,150,200,"Rosenstock et al., 2013",16.813,22.417 diff --git a/modules/data.land/inst/events_schema_v0.1.2.json b/modules/data.land/inst/events_schema_v0.1.2.json index 3e0f0df733..e41596abef 100644 --- a/modules/data.land/inst/events_schema_v0.1.2.json +++ b/modules/data.land/inst/events_schema_v0.1.2.json @@ -1,6 +1,6 @@ { "$schema": "https://json-schema.org/draft/2020-12/schema", - "$id": "https://pecanproject.org/schema/events-mvp-0-1-2.json", + "$id": "https://pecanproject.org/schema/events-mvp-0-1-1.json", "oneOf": [ { "$ref": "#/$defs/site" }, { "type": "array", "items": { "$ref": "#/$defs/site" } } @@ -23,7 +23,7 @@ "properties": { "event_type": { "type": "string", - "enum": ["planting", "harvest", "irrigation", "fertilization", "ncc", "tillage", "leafon", "leafoff"] + "enum": ["planting", "harvest", "irrigation", "fertilization", "tillage", "leafon", "leafoff"] }, "date": { "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}$" }, "fraction_area": { "type": "number", "minimum": 0, "maximum": 1, "default": 1.0 }, @@ -50,10 +50,6 @@ "org_n_kg_m2": { "type": "number", "minimum": 0 }, "nh4_n_kg_m2": { "type": "number", "minimum": 0 }, "no3_n_kg_m2": { "type": "number", "minimum": 0 }, - "fert_subtype": { "type": "string" }, - "material": { "type": "string" }, - "ncc_subtype": { "type": "string" }, - "PFT": { "type": "string" }, "tillage_eff_0to1": { "type": "number", "minimum": 0 }, "intensity_category": { "type": "string" }, @@ -72,8 +68,6 @@ { "required": ["nh4_n_kg_m2"] }, { "required": ["no3_n_kg_m2"] } ] } }, - { "if": { "properties": { "event_type": { "const": "ncc" } } }, - "then": { "required": ["org_c_kg_m2", "org_n_kg_m2", "material"] } }, { "if": { "properties": { "event_type": { "const": "tillage" } } }, "then": { "required": ["tillage_eff_0to1"] } } ], From f503d37ec0f65a7c877fdac6995de32c8a0081cb Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 37/97] drop sample_ca_compost functions --- modules/data.land/R/sample_ca_compost.R | 187 ------------------------ 1 file changed, 187 deletions(-) delete mode 100644 modules/data.land/R/sample_ca_compost.R diff --git a/modules/data.land/R/sample_ca_compost.R b/modules/data.land/R/sample_ca_compost.R deleted file mode 100644 index e27bbedf43..0000000000 --- a/modules/data.land/R/sample_ca_compost.R +++ /dev/null @@ -1,187 +0,0 @@ -#' Sample California compost amendment %C -#' -#' Draws n values of compost carbon content (%C, dry weight basis) from -#' the bundled truncated normal distribution at -#' ca_compost_pct_c_distribution. -#' -#' The default range (15 to 30%, mean 20%, sd 5) reflects CA finished -#' compost characterizations: Bernard et al. 2023 (central coast -#' vineyard, 14 to 15% C); Sullivan, Bary, Miller and Brewer 2018 (OSU -#' EM9217 proficiency program, median 15% TOC); CalRecycle generic -#' compost roughly 20 to 23% C. -#' -#' @param n integer. Number of draws. -#' @param params optional list overriding the bundled distribution. Must -#' contain numeric a, b, mean, sd. -#' -#' @return numeric vector of length n, each value in [a, b]. -#' -#' @examples -#' sample_ca_compost_pct_c(5) -#' -#' @export -sample_ca_compost_pct_c <- function(n, params = NULL) { - p <- params %||% as.list(PEcAn.data.land::ca_compost_pct_c_distribution) - truncnorm::rtruncnorm(n, a = p$a, b = p$b, mean = p$mean, sd = p$sd) -} - -#' Sample California compost C:N ratio -#' -#' Draws n values of compost C:N from the bundled truncated normal -#' distribution at ca_compost_cn_distribution. -#' -#' Default range (8 to 25, mean 12, sd 4) reflects the bimodal CA compost -#' distribution documented in the CDFA Healthy Soils Program white paper -#' (Geisseler et al.): manure dominant compost clusters at C:N at or -#' below 11 while plant dominant compost sits above 11. HSP 2026 Practice -#' Guidelines require applied C:N at or below 25. -#' -#' @param n integer. Number of draws. -#' @param params optional list overriding the bundled distribution. -#' -#' @return numeric vector of length n. -#' -#' @examples -#' sample_ca_compost_cn(5) -#' -#' @export -sample_ca_compost_cn <- function(n, params = NULL) { - p <- params %||% as.list(PEcAn.data.land::ca_compost_cn_distribution) - truncnorm::rtruncnorm(n, a = p$a, b = p$b, mean = p$mean, sd = p$sd) -} - -#' Sample California compost application rate by PFT family -#' -#' Draws n application rates (dry weight tons per acre) uniformly from -#' the per family envelope at ca_compost_app_rate_envelope. -#' -#' Envelopes follow CDFA Healthy Soils Program white paper Table 2 plus -#' HSP 2026 Practice Guidelines plus USDA NRCS Conservation Practice -#' Standard 336 Soil Carbon Amendment (2022). Defaults: annual crops 3 -#' to 8 t/ac dry, perennial crops 2 to 6 t/ac dry. -#' -#' @param pft_family character vector. PFT family for each draw. Must be -#' one of "annual", "perennial". Length 1 broadcasts to length n. -#' @param n integer. Number of draws. If pft_family has length > 1 then -#' n must equal length(pft_family). -#' -#' @return numeric vector of length n in tons per acre dry weight. -#' -#' @examples -#' sample_ca_compost_app_rate("annual", 5) -#' sample_ca_compost_app_rate(c("annual", "perennial", "annual"), 3) -#' -#' @export -sample_ca_compost_app_rate <- function(pft_family, n = length(pft_family)) { - if (length(pft_family) == 1 && n > 1) { - pft_family <- rep(pft_family, n) - } - if (length(pft_family) != n) { - PEcAn.logger::logger.severe( - "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) - } - env <- PEcAn.data.land::ca_compost_app_rate_envelope - out <- numeric(n) - for (fam in unique(pft_family)) { - if (!fam %in% env$pft_family) { - PEcAn.logger::logger.severe( - "Unknown pft_family '", fam, "'. Supported: ", - paste(env$pft_family, collapse = ", ")) - } - row <- env[env$pft_family == fam, , drop = FALSE] - idx <- which(pft_family == fam) - out[idx] <- stats::runif(length(idx), min = row$min_t_ac, max = row$max_t_ac) - } - out -} - -#' Sample California compost application date offset by PFT family -#' -#' Returns n integer day offsets (subtract from the cycle anchor, -#' typically MSLSP mslsp_OGI) drawn uniformly from the per family -#' calendar window at ca_compost_calendar_window. -#' -#' Defaults: annual crops 7 to 28 days before the anchor (CDFA HSP Box 1, -#' applied and incorporated before planting); perennial crops 60 to 180 -#' days before the anchor (dormant season application, UC ANR cost -#' studies plus Bernard et al. 2023 vineyard timing of Nov 9 and Jan 10). -#' -#' @param pft_family character vector. PFT family for each draw. -#' @param n integer. Number of draws. -#' -#' @return integer vector of day offsets. -#' -#' @examples -#' sample_ca_compost_date_offset("annual", 5) -#' -#' @export -sample_ca_compost_date_offset <- function(pft_family, n = length(pft_family)) { - if (length(pft_family) == 1 && n > 1) { - pft_family <- rep(pft_family, n) - } - if (length(pft_family) != n) { - PEcAn.logger::logger.severe( - "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) - } - win <- PEcAn.data.land::ca_compost_calendar_window - out <- integer(n) - for (fam in unique(pft_family)) { - if (!fam %in% win$pft_family) { - PEcAn.logger::logger.severe( - "Unknown pft_family '", fam, "'. Supported: ", - paste(win$pft_family, collapse = ", ")) - } - row <- win[win$pft_family == fam, , drop = FALSE] - idx <- which(pft_family == fam) - out[idx] <- sample(row$offset_days_min:row$offset_days_max, - length(idx), replace = TRUE) - } - out -} - -#' Sample California compost material class by PFT family -#' -#' Returns n material classes drawn from the per family whitelist at -#' ca_compost_material_whitelist. Uniform within the whitelist. -#' -#' Whitelist follows the CalRecycle taxonomy (14 CCR section 17852 plus -#' SB 1383 dominant feedstocks: green, food, wood, yard, ag, biosolids). -#' Defaults: annual crops can receive green / food / ag; perennial crops -#' can receive green / food / yard. Biosolids are excluded from food -#' crop parcels for regulatory compliance; wood waste is deferred since -#' it immobilizes N. -#' -#' @param pft_family character vector. PFT family for each draw. -#' @param n integer. Number of draws. -#' -#' @return character vector of material classes. -#' -#' @examples -#' sample_ca_compost_material("annual", 5) -#' -#' @export -sample_ca_compost_material <- function(pft_family, n = length(pft_family)) { - if (length(pft_family) == 1 && n > 1) { - pft_family <- rep(pft_family, n) - } - if (length(pft_family) != n) { - PEcAn.logger::logger.severe( - "length(pft_family) must equal n; got ", length(pft_family), " vs ", n) - } - wl <- PEcAn.data.land::ca_compost_material_whitelist - out <- character(n) - for (fam in unique(pft_family)) { - allowed <- wl$material_class[wl$pft_family == fam] - if (length(allowed) == 0) { - PEcAn.logger::logger.severe( - "No material whitelist for pft_family '", fam, "'. Supported: ", - paste(unique(wl$pft_family), collapse = ", ")) - } - idx <- which(pft_family == fam) - out[idx] <- sample(allowed, length(idx), replace = TRUE) - } - out -} - -# small null fallback helper. -`%||%` <- function(x, y) if (is.null(x)) y else x From 3fbfcec9bfb973c915a0807281c44d05ef83133a Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 38/97] drop sample_ca_compost tests --- .../tests/testthat/test-sample_ca_compost.R | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 modules/data.land/tests/testthat/test-sample_ca_compost.R diff --git a/modules/data.land/tests/testthat/test-sample_ca_compost.R b/modules/data.land/tests/testthat/test-sample_ca_compost.R deleted file mode 100644 index 5bcf9369b9..0000000000 --- a/modules/data.land/tests/testthat/test-sample_ca_compost.R +++ /dev/null @@ -1,25 +0,0 @@ -test_that("sample_ca_compost_material draws only from the per family whitelist", { - set.seed(1) - wl <- PEcAn.data.land::ca_compost_material_whitelist - ann_allowed <- wl$material_class[wl$pft_family == "annual"] - per_allowed <- wl$material_class[wl$pft_family == "perennial"] - expect_true(all(PEcAn.data.land::sample_ca_compost_material("annual", 500) %in% ann_allowed)) - expect_true(all(PEcAn.data.land::sample_ca_compost_material("perennial", 500) %in% per_allowed)) -}) - -test_that("sample_ca_compost_app_rate handles a mixed pft_family vector", { - set.seed(1) - fams <- rep(c("annual", "perennial"), 100) - x <- PEcAn.data.land::sample_ca_compost_app_rate(fams) - env <- PEcAn.data.land::ca_compost_app_rate_envelope - ann <- env[env$pft_family == "annual", ] - per <- env[env$pft_family == "perennial", ] - expect_true(all(x[fams == "annual"] >= ann$min_t_ac & x[fams == "annual"] <= ann$max_t_ac)) - expect_true(all(x[fams == "perennial"] >= per$min_t_ac & x[fams == "perennial"] <= per$max_t_ac)) -}) - -test_that("samplers fail loudly on an unknown pft_family", { - expect_error(PEcAn.data.land::sample_ca_compost_app_rate("hay", 5)) - expect_error(PEcAn.data.land::sample_ca_compost_date_offset("rice", 5)) - expect_error(PEcAn.data.land::sample_ca_compost_material("alfalfa", 5)) -}) From 81864e8baf9970bc265ea359e9a53bb68ef55494 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 39/97] drop compost distributions build script --- .../create_ca_compost_distributions.R | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 modules/data.land/data-raw/create_ca_compost_distributions.R diff --git a/modules/data.land/data-raw/create_ca_compost_distributions.R b/modules/data.land/data-raw/create_ca_compost_distributions.R deleted file mode 100644 index 63246bf803..0000000000 --- a/modules/data.land/data-raw/create_ca_compost_distributions.R +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env Rscript -# -# builds bundled CA compost sampling distributions used by the -# sample_ca_compost_* functions. five tibbles in total. each one keeps a -# source field so the provenance travels with the data when the package -# loads. - -# %C distribution. Bernard et al. 2023 (Front. Env. Sci., CA central coast -# vineyard) found 14 to 15% C; Sullivan et al. 2018 (OSU EM9217 proficiency -# program) median 15% TOC; CalRecycle generic roughly 20 to 23%. truncnorm -# with mean 20, sd 5, truncated 15 to 30 covers the literature range. -ca_compost_pct_c_distribution <- tibble::tibble( - a = 15, - b = 30, - mean = 20, - sd = 5, - source = paste("Bernard et al. 2023 Front. Env. Sci.;", - "Sullivan, Bary, Miller & Brewer 2018 OSU EM9217;", - "CalRecycle finished compost characterization") -) - -# C:N distribution. CDFA HSP white paper (Geisseler et al.) found CA -# finished compost bimodal at C:N <= 11 (manure dominant) vs > 11 (plant -# dominant); HSP 2026 requires applied C:N <= 25. truncnorm with mean 12, -# sd 4, truncated 8 to 25 covers both modes. -ca_compost_cn_distribution <- tibble::tibble( - a = 8, - b = 25, - mean = 12, - sd = 4, - source = paste("CDFA Healthy Soils Program white paper (Geisseler et al.);", - "HSP 2026 Practice Guidelines") -) - -# application rate envelope by PFT family, dry weight tons per acre. source: -# CDFA HSP white paper Table 2 + HSP 2026 Practice Guidelines, USDA NRCS -# Conservation Practice Standard 336 Soil Carbon Amendment (2022). -ca_compost_app_rate_envelope <- tibble::tibble( - pft_family = c("annual", "perennial"), - min_t_ac = c(3, 2), - max_t_ac = c(8, 6), - source = "CDFA HSP white paper Table 2; HSP 2026; NRCS CPS 336" -) - -# calendar window by PFT family, expressed as days before the cycle anchor -# (mslsp_OGI). annual: 7 to 28 days before the anchor (CDFA HSP Box 1, -# applied before planting). perennial: 60 to 180 days before the anchor -# (dormant season application; UC ANR orchard cost studies + Bernard et -# al. 2023 vineyard timing of Nov 9 and Jan 10). -ca_compost_calendar_window <- tibble::tibble( - pft_family = c("annual", "perennial"), - offset_days_min = c(7L, 60L), - offset_days_max = c(28L, 180L), - source = "CDFA HSP white paper Box 1; UC ANR cost studies; Bernard et al. 2023" -) - -# material whitelist by PFT family. long format, one row per allowed pair. -# CalRecycle taxonomy from 14 CCR section 17852 + SB 1383 dominant -# feedstocks. biosolids excluded from food crops (regulatory). wood waste -# deferred since it has high C:N and immobilizes N -ca_compost_material_whitelist <- tibble::tibble( - pft_family = c("annual", "annual", "annual", - "perennial", "perennial", "perennial"), - material_class = c("green", "food", "ag", - "green", "food", "yard"), - source = "14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks" -) - -usethis::use_data(ca_compost_pct_c_distribution, overwrite = TRUE) -usethis::use_data(ca_compost_cn_distribution, overwrite = TRUE) -usethis::use_data(ca_compost_app_rate_envelope, overwrite = TRUE) -usethis::use_data(ca_compost_calendar_window, overwrite = TRUE) -usethis::use_data(ca_compost_material_whitelist, overwrite = TRUE) From 0b71a7e035788866bfe59849cf0d429588ee2220 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 40/97] drop ca_compost_pct_c_distribution rda --- .../data/ca_compost_pct_c_distribution.rda | Bin 331 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_pct_c_distribution.rda diff --git a/modules/data.land/data/ca_compost_pct_c_distribution.rda b/modules/data.land/data/ca_compost_pct_c_distribution.rda deleted file mode 100644 index 97334caf639c911c771153c253cde7c242e36daa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 331 zcmV-R0kr-?T4*^jL0KkKSwK~uTmS%?f587UOaeg%eCb~To^sk00FQ885s>t z6!e4C(<4mO0Mj4<(?Ds6Xbn?L)QyzHY3U5q0001JGy$N=H3-l>KmY&$28MtEqqS{P zn(Sa2&?T0uRwSI{augoZ5HLX(=ZQU05zEX3fYcAb^gJpEYcrw;z*GR(AfO~55*P?7 zfk?(M>73ytMj)MMm|=z;ooQA}s7&I>UWcfSx2k-a{Txlgxa52El@vwVH$;G~*Ie#ZZZH=^g^g&~;@Ax- zXMs={u}YA~UUF4~IuInBxtLA?gbYmr#*lD^2wRRI!AWp8ULqT&BdFb Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 41/97] drop ca_compost_cn_distribution rda --- .../data.land/data/ca_compost_cn_distribution.rda | Bin 303 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_cn_distribution.rda diff --git a/modules/data.land/data/ca_compost_cn_distribution.rda b/modules/data.land/data/ca_compost_cn_distribution.rda deleted file mode 100644 index fb8c7aaf0ddd58a52d061b4465c8d700c43a020b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 303 zcmV+~0nq+JT4*^jL0KkKS$se3a{vI5f587UNDx3{S!iv*UckTS-k?AL00FQ7`7;qR zk?L(Bpa3+`^%^#z`lCVVH1#ylil3@^q}25@Q`CN`=zstK4GjQ#gCx~G6G7;JXaE2W z4FC-r3~@QHfX4wyxm>d(Q>T!i`KEz_Nv3#{;T}fdU?d1oK_l|=vL%h3&_Dv92H^z( zApoGjK~xGTLIb+UD~N=GK#_UJe~hx@s+a6K1+%U!^%_qj#{uX7vp;Vw@iZuCgBnw> zY|4u+W?-#EcB3Fj7w6ce1vDtGxFM3cBpsYs^m|)e;tK{^KWU7{31TK(CzMQq>7_V> z07 Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 42/97] drop ca_compost_app_rate_envelope rda --- .../data/ca_compost_app_rate_envelope.rda | Bin 314 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_app_rate_envelope.rda diff --git a/modules/data.land/data/ca_compost_app_rate_envelope.rda b/modules/data.land/data/ca_compost_app_rate_envelope.rda deleted file mode 100644 index 28d46e19126f800cdb1a0567a965f589a2c2ccfc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmV-A0mc48T4*^jL0KkKSsg&)wEzIAf5889NJKybT}W*~UO>NR-{3$100FQ87+Hp@ z9--()h9*G7(dbPBPf3#urUO*NcmS4FCWD1Jp7ErlyK|kkR^tKU6em0Bub@ z8h``TN_goU(+UqnsPv{cz&Mi!wb>v$TYd9koi=#CEJk3W3#vZ86@4VB3{%()C}K>^ znSlos1_9mxRWk*>5DrB&PXrZ)Lr8WVqCQBHEW7tX)@Tux8A=F|-innCqQeQO(k*t8 z8lfQI+d%=qn4#}0Cl>>9B5p|}Xi^briamGG3c3sZaj*x(=^RrjDiXm;P Date: Sat, 23 May 2026 19:06:14 -0400 Subject: [PATCH 43/97] drop ca_compost_calendar_window rda --- .../data.land/data/ca_compost_calendar_window.rda | Bin 333 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_calendar_window.rda diff --git a/modules/data.land/data/ca_compost_calendar_window.rda b/modules/data.land/data/ca_compost_calendar_window.rda deleted file mode 100644 index 6603994470e38a02d90b33d9e491c5d2c0bf92db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 333 zcmV-T0kZx=T4*^jL0KkKS%gc&j{pFsf5`u`$P_>WcuYM(UO>NR-rzt01ONa5umKif zgs2qtF{Y+Xqe^;!05W6;>WvydR1FmMP3lLH0j5Eq00uw-rhzD?P}4vI)CPbJ0B8*c zgQkEmJ`CE}5m17d9B+3)2h<3)+!m&yhscEHSZPee&=7$`qlQaz!&bbXTS@o<^+cSA ziXe&#UQrPk$AC!YyofbQ20|lA@Q8SnMLg42(Y From eb461d349b4a1a82589d84f5b02a6836bacd3ce9 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:06:15 -0400 Subject: [PATCH 44/97] drop ca_compost_material_whitelist rda --- .../data/ca_compost_material_whitelist.rda | Bin 356 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_material_whitelist.rda diff --git a/modules/data.land/data/ca_compost_material_whitelist.rda b/modules/data.land/data/ca_compost_material_whitelist.rda deleted file mode 100644 index eb5041069b646597e50f3f6b0bd4c2f78745dfc7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 356 zcmV-q0h|6pT4*^jL0KkKS*4_7NB{u%|G@tbORy0A9 zNwOi6C#VLR0MVc{8U{h4jS1)@BSsSl(?HN<&}7IFQ5vVInI>tFO#lXssgMBlg^f@c zOKpab0_FmwWJA%It*&Sys~i#tTxrF5&_EoJF!}tEw?C|7Sygdogm=w4O9)B;8bM&A z0MiswX`+g5>WUM?Sn&^F_l=`K=NpFaP5q;Az;+H!QSk-?0r0498-~%`I7etu7`nI& z+5vPLCE-K36A(o4zM6srfE5a~jx!YlJtg0!BjW|*XWjvZuw^4O`UXR7IEQHR42LMv zW0;G*nBgm`q1=8^s>5b>qLrv?zQMpZ!C?r2UaRuRG^~gXc_syz_yex(f^A43exJRn8D6@pmLsg$W8;Ml^s* C@0H5{ From 5d4070a77e44bb6c307df8c80bc0177348d3b7a4 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:57 -0400 Subject: [PATCH 45/97] drop doc for ca_compost_pct_c_distribution --- .../man/ca_compost_pct_c_distribution.Rd | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_pct_c_distribution.Rd diff --git a/modules/data.land/man/ca_compost_pct_c_distribution.Rd b/modules/data.land/man/ca_compost_pct_c_distribution.Rd deleted file mode 100644 index dab4d85ded..0000000000 --- a/modules/data.land/man/ca_compost_pct_c_distribution.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_pct_c_distribution} -\alias{ca_compost_pct_c_distribution} -\title{California compost carbon content distribution} -\format{ -A tibble with one row: -\describe{ - \item{a, b}{Lower and upper truncation bounds.} - \item{mean, sd}{Untruncated mean and standard deviation.} - \item{source}{Short citation for the parameters.} -} -} -\source{ -Bernard et al. 2023 Frontiers in Environmental Science; - Sullivan, Bary, Miller & Brewer 2018 OSU EM9217; - CalRecycle finished compost characterization. -} -\usage{ -ca_compost_pct_c_distribution -} -\description{ -Truncated normal distribution parameters for compost %C (dry weight -basis) used by sample_ca_compost_pct_c. -} -\keyword{datasets} From aec34bfa353856c11ddfa4b784a4c804ccc1758d Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:57 -0400 Subject: [PATCH 46/97] drop doc for ca_compost_cn_distribution --- .../man/ca_compost_cn_distribution.Rd | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_cn_distribution.Rd diff --git a/modules/data.land/man/ca_compost_cn_distribution.Rd b/modules/data.land/man/ca_compost_cn_distribution.Rd deleted file mode 100644 index 6a15812605..0000000000 --- a/modules/data.land/man/ca_compost_cn_distribution.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_cn_distribution} -\alias{ca_compost_cn_distribution} -\title{California compost C:N ratio distribution} -\format{ -A tibble with one row: -\describe{ - \item{a, b}{Lower and upper truncation bounds.} - \item{mean, sd}{Untruncated mean and standard deviation.} - \item{source}{Short citation.} -} -} -\source{ -CDFA Healthy Soils Program white paper (Geisseler et al.); - HSP 2026 Practice Guidelines. -} -\usage{ -ca_compost_cn_distribution -} -\description{ -Truncated normal distribution parameters for compost C:N used by -sample_ca_compost_cn. -} -\keyword{datasets} From d4567f0930f751a1dee652c21910f09dfbc0257e Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 47/97] drop doc for ca_compost_app_rate_envelope --- .../man/ca_compost_app_rate_envelope.Rd | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_app_rate_envelope.Rd diff --git a/modules/data.land/man/ca_compost_app_rate_envelope.Rd b/modules/data.land/man/ca_compost_app_rate_envelope.Rd deleted file mode 100644 index f503f51883..0000000000 --- a/modules/data.land/man/ca_compost_app_rate_envelope.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_app_rate_envelope} -\alias{ca_compost_app_rate_envelope} -\title{California compost application rate envelope by PFT family} -\format{ -A tibble with one row per PFT family: -\describe{ - \item{pft_family}{"annual" or "perennial".} - \item{min_t_ac, max_t_ac}{Application rate bounds.} - \item{source}{Short citation.} -} -} -\source{ -CDFA HSP white paper Table 2; HSP 2026 Practice Guidelines; - NRCS Conservation Practice Standard 336 Soil Carbon Amendment (2022). -} -\usage{ -ca_compost_app_rate_envelope -} -\description{ -Per family uniform rate envelope (dry weight tons per acre) used by -sample_ca_compost_app_rate. -} -\keyword{datasets} From 34a4068529010acb6a8728f09f00d0d019db9fba Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 48/97] drop doc for ca_compost_calendar_window --- .../man/ca_compost_calendar_window.Rd | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_calendar_window.Rd diff --git a/modules/data.land/man/ca_compost_calendar_window.Rd b/modules/data.land/man/ca_compost_calendar_window.Rd deleted file mode 100644 index 60900bc37e..0000000000 --- a/modules/data.land/man/ca_compost_calendar_window.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_calendar_window} -\alias{ca_compost_calendar_window} -\title{California compost application calendar window by PFT family} -\format{ -A tibble with one row per PFT family: -\describe{ - \item{pft_family}{"annual" or "perennial".} - \item{offset_days_min, offset_days_max}{Bounds on days before the anchor.} - \item{source}{Short citation.} -} -} -\source{ -CDFA HSP white paper Box 1; UC ANR cost studies; - Bernard et al. 2023 vineyard timing. -} -\usage{ -ca_compost_calendar_window -} -\description{ -Per family integer day offsets (subtracted from the cycle anchor) used -by sample_ca_compost_date_offset. -} -\keyword{datasets} From 9a9dcf0f7e061cde38680a5971b411bae667eed6 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 49/97] drop doc for ca_compost_material_whitelist --- .../man/ca_compost_material_whitelist.Rd | 26 ------------------- 1 file changed, 26 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_material_whitelist.Rd diff --git a/modules/data.land/man/ca_compost_material_whitelist.Rd b/modules/data.land/man/ca_compost_material_whitelist.Rd deleted file mode 100644 index 35720803eb..0000000000 --- a/modules/data.land/man/ca_compost_material_whitelist.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_material_whitelist} -\alias{ca_compost_material_whitelist} -\title{California compost material whitelist by PFT family} -\format{ -A tibble in long format, one row per allowed pair: -\describe{ - \item{pft_family}{"annual" or "perennial".} - \item{material_class}{CalRecycle class: one of green, food, wood, - yard, ag, biosolids.} - \item{source}{Short citation.} -} -} -\source{ -14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks. -} -\usage{ -ca_compost_material_whitelist -} -\description{ -Allowed CalRecycle material classes for each PFT family, used by -sample_ca_compost_material. -} -\keyword{datasets} From 7ee162baaeaaf58ce1b33ed7852a4d9a7b83fd64 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 50/97] drop doc for sample_ca_compost_pct_c --- .../data.land/man/sample_ca_compost_pct_c.Rd | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 modules/data.land/man/sample_ca_compost_pct_c.Rd diff --git a/modules/data.land/man/sample_ca_compost_pct_c.Rd b/modules/data.land/man/sample_ca_compost_pct_c.Rd deleted file mode 100644 index 84f1467667..0000000000 --- a/modules/data.land/man/sample_ca_compost_pct_c.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sample_ca_compost.R -\name{sample_ca_compost_pct_c} -\alias{sample_ca_compost_pct_c} -\title{Sample California compost amendment %C} -\usage{ -sample_ca_compost_pct_c(n, params = NULL) -} -\arguments{ -\item{n}{integer. Number of draws.} - -\item{params}{optional list overriding the bundled distribution. Must -contain numeric a, b, mean, sd.} -} -\value{ -numeric vector of length n, each value in [a, b]. -} -\description{ -Draws n values of compost carbon content (%C, dry weight basis) from -the bundled truncated normal distribution at -ca_compost_pct_c_distribution. -} -\details{ -The default range (15 to 30%, mean 20%, sd 5) reflects CA finished -compost characterizations: Bernard et al. 2023 (central coast -vineyard, 14 to 15% C); Sullivan, Bary, Miller and Brewer 2018 (OSU -EM9217 proficiency program, median 15% TOC); CalRecycle generic -compost roughly 20 to 23% C. -} -\examples{ -sample_ca_compost_pct_c(5) - -} From 6d943fb08378a9484526b6590daf50517d86b1e2 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 51/97] drop doc for sample_ca_compost_cn --- modules/data.land/man/sample_ca_compost_cn.Rd | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 modules/data.land/man/sample_ca_compost_cn.Rd diff --git a/modules/data.land/man/sample_ca_compost_cn.Rd b/modules/data.land/man/sample_ca_compost_cn.Rd deleted file mode 100644 index 91b1730f69..0000000000 --- a/modules/data.land/man/sample_ca_compost_cn.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sample_ca_compost.R -\name{sample_ca_compost_cn} -\alias{sample_ca_compost_cn} -\title{Sample California compost C:N ratio} -\usage{ -sample_ca_compost_cn(n, params = NULL) -} -\arguments{ -\item{n}{integer. Number of draws.} - -\item{params}{optional list overriding the bundled distribution.} -} -\value{ -numeric vector of length n. -} -\description{ -Draws n values of compost C:N from the bundled truncated normal -distribution at ca_compost_cn_distribution. -} -\details{ -Default range (8 to 25, mean 12, sd 4) reflects the bimodal CA compost -distribution documented in the CDFA Healthy Soils Program white paper -(Geisseler et al.): manure dominant compost clusters at C:N at or -below 11 while plant dominant compost sits above 11. HSP 2026 Practice -Guidelines require applied C:N at or below 25. -} -\examples{ -sample_ca_compost_cn(5) - -} From 3da67e0d37c247212f8bfe08c16922a6ea2c99d3 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 52/97] drop doc for sample_ca_compost_app_rate --- .../man/sample_ca_compost_app_rate.Rd | 33 ------------------- 1 file changed, 33 deletions(-) delete mode 100644 modules/data.land/man/sample_ca_compost_app_rate.Rd diff --git a/modules/data.land/man/sample_ca_compost_app_rate.Rd b/modules/data.land/man/sample_ca_compost_app_rate.Rd deleted file mode 100644 index c1a938bbf6..0000000000 --- a/modules/data.land/man/sample_ca_compost_app_rate.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sample_ca_compost.R -\name{sample_ca_compost_app_rate} -\alias{sample_ca_compost_app_rate} -\title{Sample California compost application rate by PFT family} -\usage{ -sample_ca_compost_app_rate(pft_family, n = length(pft_family)) -} -\arguments{ -\item{pft_family}{character vector. PFT family for each draw. Must be -one of "annual", "perennial". Length 1 broadcasts to length n.} - -\item{n}{integer. Number of draws. If pft_family has length > 1 then -n must equal length(pft_family).} -} -\value{ -numeric vector of length n in tons per acre dry weight. -} -\description{ -Draws n application rates (dry weight tons per acre) uniformly from -the per family envelope at ca_compost_app_rate_envelope. -} -\details{ -Envelopes follow CDFA Healthy Soils Program white paper Table 2 plus -HSP 2026 Practice Guidelines plus USDA NRCS Conservation Practice -Standard 336 Soil Carbon Amendment (2022). Defaults: annual crops 3 -to 8 t/ac dry, perennial crops 2 to 6 t/ac dry. -} -\examples{ -sample_ca_compost_app_rate("annual", 5) -sample_ca_compost_app_rate(c("annual", "perennial", "annual"), 3) - -} From 6e025b4ce584f70058ccd77e5c197774ec825f2b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 53/97] drop doc for sample_ca_compost_date_offset --- .../man/sample_ca_compost_date_offset.Rd | 31 ------------------- 1 file changed, 31 deletions(-) delete mode 100644 modules/data.land/man/sample_ca_compost_date_offset.Rd diff --git a/modules/data.land/man/sample_ca_compost_date_offset.Rd b/modules/data.land/man/sample_ca_compost_date_offset.Rd deleted file mode 100644 index fa57f78a78..0000000000 --- a/modules/data.land/man/sample_ca_compost_date_offset.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sample_ca_compost.R -\name{sample_ca_compost_date_offset} -\alias{sample_ca_compost_date_offset} -\title{Sample California compost application date offset by PFT family} -\usage{ -sample_ca_compost_date_offset(pft_family, n = length(pft_family)) -} -\arguments{ -\item{pft_family}{character vector. PFT family for each draw.} - -\item{n}{integer. Number of draws.} -} -\value{ -integer vector of day offsets. -} -\description{ -Returns n integer day offsets (subtract from the cycle anchor, -typically MSLSP mslsp_OGI) drawn uniformly from the per family -calendar window at ca_compost_calendar_window. -} -\details{ -Defaults: annual crops 7 to 28 days before the anchor (CDFA HSP Box 1, -applied and incorporated before planting); perennial crops 60 to 180 -days before the anchor (dormant season application, UC ANR cost -studies plus Bernard et al. 2023 vineyard timing of Nov 9 and Jan 10). -} -\examples{ -sample_ca_compost_date_offset("annual", 5) - -} From 9433f59c03a6ef956ac5ea1c859de8f03482dfb4 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:13:58 -0400 Subject: [PATCH 54/97] drop doc for sample_ca_compost_material --- .../man/sample_ca_compost_material.Rd | 32 ------------------- 1 file changed, 32 deletions(-) delete mode 100644 modules/data.land/man/sample_ca_compost_material.Rd diff --git a/modules/data.land/man/sample_ca_compost_material.Rd b/modules/data.land/man/sample_ca_compost_material.Rd deleted file mode 100644 index e9e1c30de7..0000000000 --- a/modules/data.land/man/sample_ca_compost_material.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/sample_ca_compost.R -\name{sample_ca_compost_material} -\alias{sample_ca_compost_material} -\title{Sample California compost material class by PFT family} -\usage{ -sample_ca_compost_material(pft_family, n = length(pft_family)) -} -\arguments{ -\item{pft_family}{character vector. PFT family for each draw.} - -\item{n}{integer. Number of draws.} -} -\value{ -character vector of material classes. -} -\description{ -Returns n material classes drawn from the per family whitelist at -ca_compost_material_whitelist. Uniform within the whitelist. -} -\details{ -Whitelist follows the CalRecycle taxonomy (14 CCR section 17852 plus -SB 1383 dominant feedstocks: green, food, wood, yard, ag, biosolids). -Defaults: annual crops can receive green / food / ag; perennial crops -can receive green / food / yard. Biosolids are excluded from food -crop parcels for regulatory compliance; wood waste is deferred since -it immobilizes N. -} -\examples{ -sample_ca_compost_material("annual", 5) - -} From 0a715a6507b679b53905491a46cef9a62c75878b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:45 -0400 Subject: [PATCH 55/97] drop oz_per_tree_to_lb_per_acre helper --- .../data.land/R/oz_per_tree_to_lb_per_acre.R | 20 ------------------- 1 file changed, 20 deletions(-) delete mode 100644 modules/data.land/R/oz_per_tree_to_lb_per_acre.R diff --git a/modules/data.land/R/oz_per_tree_to_lb_per_acre.R b/modules/data.land/R/oz_per_tree_to_lb_per_acre.R deleted file mode 100644 index df2113012d..0000000000 --- a/modules/data.land/R/oz_per_tree_to_lb_per_acre.R +++ /dev/null @@ -1,20 +0,0 @@ -#' Convert N application rate from oz N per tree to lb N per acre -#' -#' California extension guidelines for young orchards (CDFA FREP, UC ANR, -#' Almond Board) publish N rates per tree. This helper multiplies by -#' orchard density to give lb N per acre for pipelines that need per acre -#' inputs. -#' -#' @param oz_per_tree numeric vector. N rate in ounces N per tree. -#' @param tpa numeric scalar or vector. Orchard density in trees per acre. -#' Recycled to length of oz_per_tree if scalar. -#' -#' @return numeric vector. N rate in lb N per acre. NA inputs propagate. -#' -#' @examples -#' oz_per_tree_to_lb_per_acre(c(1, 3), tpa = 145) -#' -#' @export -oz_per_tree_to_lb_per_acre <- function(oz_per_tree, tpa) { - oz_per_tree * tpa / 16 -} From 246721653ed49b662b922eb1b9d728c0f3440af6 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:46 -0400 Subject: [PATCH 56/97] drop doc for oz_per_tree_to_lb_per_acre --- .../man/oz_per_tree_to_lb_per_acre.Rd | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd diff --git a/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd b/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd deleted file mode 100644 index 6f2e9ae194..0000000000 --- a/modules/data.land/man/oz_per_tree_to_lb_per_acre.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/oz_per_tree_to_lb_per_acre.R -\name{oz_per_tree_to_lb_per_acre} -\alias{oz_per_tree_to_lb_per_acre} -\title{Convert N application rate from oz N per tree to lb N per acre} -\usage{ -oz_per_tree_to_lb_per_acre(oz_per_tree, tpa) -} -\arguments{ -\item{oz_per_tree}{numeric vector. N rate in ounces N per tree.} - -\item{tpa}{numeric scalar or vector. Orchard density in trees per acre. -Recycled to length of oz_per_tree if scalar.} -} -\value{ -numeric vector. N rate in lb N per acre. NA inputs propagate. -} -\description{ -California extension guidelines for young orchards (CDFA FREP, UC ANR, -Almond Board) publish N rates per tree. This helper multiplies by -orchard density to give lb N per acre for pipelines that need per acre -inputs. -} -\examples{ -oz_per_tree_to_lb_per_acre(c(1, 3), tpa = 145) - -} From 1e5dbe555bd5b63c1d4d7bf934927ff80903ab00 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:46 -0400 Subject: [PATCH 57/97] drop tpa_lookup helper --- modules/data.land/R/tpa_lookup.R | 45 -------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 modules/data.land/R/tpa_lookup.R diff --git a/modules/data.land/R/tpa_lookup.R b/modules/data.land/R/tpa_lookup.R deleted file mode 100644 index 673b64d41b..0000000000 --- a/modules/data.land/R/tpa_lookup.R +++ /dev/null @@ -1,45 +0,0 @@ -#' Look up California orchard density (trees per acre) by crop -#' -#' Returns the median trees per acre value for a California orchard crop, -#' derived from the DEMETER cropland biomass dataset. DEMETER photo dates -#' span 2010 to 2016, so modern high density plantings may be under -#' represented. -#' -#' Supported crops: Almonds, Walnuts, Oranges, Pistachios. Other crops -#' return NA with a warning. -#' -#' @param crop character. Crop name (case insensitive). One of "Almonds", -#' "Walnuts", "Oranges", "Pistachios". -#' -#' @return integer scalar. Trees per acre for the requested crop. Returns -#' NA_integer_ with a warning if the crop is not supported. -#' -#' @source Kroodsma, D. A., & Field, C. B. (2006). Carbon sequestration -#' in California agriculture, 1980-2000. Ecological Applications, -#' 16(5), 1975-1985. -#' -#' @examples -#' tpa_lookup("Almonds") -#' tpa_lookup("walnuts") -#' -#' @export -tpa_lookup <- function(crop) { - # median trees per acre by crop from DEMETER. - # TODO: promote to a bundled age keyed dataset when per parcel - # orchard age becomes available. - medians <- c( - almonds = 80L, - walnuts = 41L, - oranges = 110L, - pistachios = 119L - ) - key <- tolower(crop) - if (!key %in% names(medians)) { - PEcAn.logger::logger.warn( - "No DEMETER TPA available for crop '", crop, "'. ", - "Supported: ", paste(names(medians), collapse = ", "), "." - ) - return(NA_integer_) - } - medians[[key]] -} From aa60cf26030f834a303b898dc1be5e5cd3c404fd Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:46 -0400 Subject: [PATCH 58/97] drop doc for tpa_lookup --- modules/data.land/man/tpa_lookup.Rd | 36 ----------------------------- 1 file changed, 36 deletions(-) delete mode 100644 modules/data.land/man/tpa_lookup.Rd diff --git a/modules/data.land/man/tpa_lookup.Rd b/modules/data.land/man/tpa_lookup.Rd deleted file mode 100644 index 2d712911c8..0000000000 --- a/modules/data.land/man/tpa_lookup.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/tpa_lookup.R -\name{tpa_lookup} -\alias{tpa_lookup} -\title{Look up California orchard density (trees per acre) by crop} -\source{ -Kroodsma, D. A., & Field, C. B. (2006). Carbon sequestration - in California agriculture, 1980-2000. Ecological Applications, - 16(5), 1975-1985. -} -\usage{ -tpa_lookup(crop) -} -\arguments{ -\item{crop}{character. Crop name (case insensitive). One of "Almonds", -"Walnuts", "Oranges", "Pistachios".} -} -\value{ -integer scalar. Trees per acre for the requested crop. Returns - NA_integer_ with a warning if the crop is not supported. -} -\description{ -Returns the median trees per acre value for a California orchard crop, -derived from the DEMETER cropland biomass dataset. DEMETER photo dates -span 2010 to 2016, so modern high density plantings may be under -represented. -} -\details{ -Supported crops: Almonds, Walnuts, Oranges, Pistachios. Other crops -return NA with a warning. -} -\examples{ -tpa_lookup("Almonds") -tpa_lookup("walnuts") - -} From 6d3850c5a1c94aa849d3f4b944d220464ec98b5b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:46 -0400 Subject: [PATCH 59/97] drop docs for removed compost distribution datasets --- modules/data.land/R/data.R | 76 -------------------------------------- 1 file changed, 76 deletions(-) diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index 90b10c3fea..d327c1ec39 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -286,82 +286,6 @@ #' composition (N/C fractions) from the SWAT/DayCent database. "ca_compost_amendment" -#' California compost carbon content distribution -#' -#' Truncated normal distribution parameters for compost %C (dry weight -#' basis) used by sample_ca_compost_pct_c. -#' -#' @format A tibble with one row: -#' \describe{ -#' \item{a, b}{Lower and upper truncation bounds.} -#' \item{mean, sd}{Untruncated mean and standard deviation.} -#' \item{source}{Short citation for the parameters.} -#' } -#' @source Bernard et al. 2023 Frontiers in Environmental Science; -#' Sullivan, Bary, Miller & Brewer 2018 OSU EM9217; -#' CalRecycle finished compost characterization. -"ca_compost_pct_c_distribution" - -#' California compost C:N ratio distribution -#' -#' Truncated normal distribution parameters for compost C:N used by -#' sample_ca_compost_cn. -#' -#' @format A tibble with one row: -#' \describe{ -#' \item{a, b}{Lower and upper truncation bounds.} -#' \item{mean, sd}{Untruncated mean and standard deviation.} -#' \item{source}{Short citation.} -#' } -#' @source CDFA Healthy Soils Program white paper (Geisseler et al.); -#' HSP 2026 Practice Guidelines. -"ca_compost_cn_distribution" - -#' California compost application rate envelope by PFT family -#' -#' Per family uniform rate envelope (dry weight tons per acre) used by -#' sample_ca_compost_app_rate. -#' -#' @format A tibble with one row per PFT family: -#' \describe{ -#' \item{pft_family}{"annual" or "perennial".} -#' \item{min_t_ac, max_t_ac}{Application rate bounds.} -#' \item{source}{Short citation.} -#' } -#' @source CDFA HSP white paper Table 2; HSP 2026 Practice Guidelines; -#' NRCS Conservation Practice Standard 336 Soil Carbon Amendment (2022). -"ca_compost_app_rate_envelope" - -#' California compost application calendar window by PFT family -#' -#' Per family integer day offsets (subtracted from the cycle anchor) used -#' by sample_ca_compost_date_offset. -#' -#' @format A tibble with one row per PFT family: -#' \describe{ -#' \item{pft_family}{"annual" or "perennial".} -#' \item{offset_days_min, offset_days_max}{Bounds on days before the anchor.} -#' \item{source}{Short citation.} -#' } -#' @source CDFA HSP white paper Box 1; UC ANR cost studies; -#' Bernard et al. 2023 vineyard timing. -"ca_compost_calendar_window" - -#' California compost material whitelist by PFT family -#' -#' Allowed CalRecycle material classes for each PFT family, used by -#' sample_ca_compost_material. -#' -#' @format A tibble in long format, one row per allowed pair: -#' \describe{ -#' \item{pft_family}{"annual" or "perennial".} -#' \item{material_class}{CalRecycle class: one of green, food, wood, -#' yard, ag, biosolids.} -#' \item{source}{Short citation.} -#' } -#' @source 14 CCR section 17852; CalRecycle SB 1383 dominant feedstocks. -"ca_compost_material_whitelist" - #' Crop-specific rooting depths and water-depletion thresholds #' #' Maximum effective rooting depth and minimum soil water content thresholds From b5c658bc6593c4d5b27b27347a15888091afcaae Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:14:46 -0400 Subject: [PATCH 60/97] drop namespace exports for removed functions --- modules/data.land/NAMESPACE | 7 ------- 1 file changed, 7 deletions(-) diff --git a/modules/data.land/NAMESPACE b/modules/data.land/NAMESPACE index 3b5afb3896..0c701cc961 100644 --- a/modules/data.land/NAMESPACE +++ b/modules/data.land/NAMESPACE @@ -55,7 +55,6 @@ export(mslsp_to_canopycover) export(ndti_to_sipnet_tillage) export(netcdf.writer.BADM) export(om2soc) -export(oz_per_tree_to_lb_per_acre) export(parse.MatrixNames) export(partition_roots) export(plot2AGB) @@ -64,11 +63,6 @@ export(pool_ic_netcdf2list) export(prepare_pools) export(preprocess_soilgrids_data) export(put_veg_module) -export(sample_ca_compost_app_rate) -export(sample_ca_compost_cn) -export(sample_ca_compost_date_offset) -export(sample_ca_compost_material) -export(sample_ca_compost_pct_c) export(sample_ic) export(sclass) export(shp2kml) @@ -88,7 +82,6 @@ export(subset_layer) export(to.Tag) export(to.TreeCode) export(to_co2e) -export(tpa_lookup) export(validate_events_json) export(write_ic) export(write_veg) From 1bc7c1525daa10ab78ad28895b08b66290f2c968 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:15:34 -0400 Subject: [PATCH 61/97] update look_up_ca_compost_amendment for new column set --- modules/data.land/R/look_up_ca_n_rate.R | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/modules/data.land/R/look_up_ca_n_rate.R b/modules/data.land/R/look_up_ca_n_rate.R index 5ac0f419cc..944bb0a2cc 100644 --- a/modules/data.land/R/look_up_ca_n_rate.R +++ b/modules/data.land/R/look_up_ca_n_rate.R @@ -117,9 +117,8 @@ look_up_ca_n_rate <- function( #' @param aggregate Character, one of "none" (default) or "mean". #' If "mean", rows for the same material are averaged into a single row. #' -#' @return A tibble with columns: `material`, `cn_min`, `cn_max`, -#' `cn_avg`, `c_pct`, `n_pct`, `pan_pct`, `n_class`, -#' `total_c_min_g_m2`, `total_c_max_g_m2`, +#' @return A tibble with columns: `material`, `material_class`, +#' `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, #' `total_n_min_g_m2`, `total_n_max_g_m2`, `source`. #' Returns an empty tibble (with a warning) if no match is found. #' @@ -174,10 +173,9 @@ look_up_ca_compost_amendment <- function( ) } return(dplyr::tibble( - material = character(), cn_min = numeric(), cn_max = numeric(), - cn_avg = numeric(), c_pct = numeric(), + material = character(), material_class = character(), + cn_min = numeric(), cn_max = numeric(), cn_avg = numeric(), n_pct = numeric(), pan_pct = numeric(), n_class = character(), - total_c_min_g_m2 = numeric(), total_c_max_g_m2 = numeric(), total_n_min_g_m2 = numeric(), total_n_max_g_m2 = numeric(), source = character() )) @@ -185,22 +183,22 @@ look_up_ca_compost_amendment <- function( out <- result |> dplyr::select( - "material", "cn_min", "cn_max", "cn_avg", - "c_pct", "n_pct", "pan_pct", "n_class", - "total_c_min_g_m2", "total_c_max_g_m2", + "material", "material_class", + "cn_min", "cn_max", "cn_avg", + "n_pct", "pan_pct", "n_class", "total_n_min_g_m2", "total_n_max_g_m2", "source" ) if (aggregate == "mean" && nrow(out) > 1) { numeric_cols <- c( - "cn_min", "cn_max", "cn_avg", "c_pct", "n_pct", "pan_pct", - "total_c_min_g_m2", "total_c_max_g_m2", + "cn_min", "cn_max", "cn_avg", "n_pct", "pan_pct", "total_n_min_g_m2", "total_n_max_g_m2" ) out <- out |> dplyr::summarize( dplyr::across(dplyr::all_of(numeric_cols), mean), + material_class = dplyr::first(.data$material_class), n_class = dplyr::first(.data$n_class), source = paste(unique(.data$source), collapse = "; "), .by = "material" From 740cc8c768d33bd800ec9d7c89192a9a82695706 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:15:35 -0400 Subject: [PATCH 62/97] regen doc for look_up_ca_compost_amendment --- modules/data.land/man/look_up_ca_compost_amendment.Rd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/modules/data.land/man/look_up_ca_compost_amendment.Rd b/modules/data.land/man/look_up_ca_compost_amendment.Rd index 677953772e..aa940af064 100644 --- a/modules/data.land/man/look_up_ca_compost_amendment.Rd +++ b/modules/data.land/man/look_up_ca_compost_amendment.Rd @@ -28,9 +28,8 @@ look_up_ca_compost_amendment( If "mean", rows for the same material are averaged into a single row.} } \value{ -A tibble with columns: `material`, `cn_min`, `cn_max`, - `cn_avg`, `c_pct`, `n_pct`, `pan_pct`, `n_class`, - `total_c_min_g_m2`, `total_c_max_g_m2`, +A tibble with columns: `material`, `material_class`, + `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, `total_n_min_g_m2`, `total_n_max_g_m2`, `source`. Returns an empty tibble (with a warning) if no match is found. } From 4150ede29eac522f7abc56e90c008cba71edf253 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:15:35 -0400 Subject: [PATCH 63/97] update lookup tests for recovered crops and new compost columns --- modules/data.land/tests/testthat/test.look_up_ca_n_rate.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R b/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R index 0bf09d9885..defdf87a36 100644 --- a/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R +++ b/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R @@ -47,7 +47,7 @@ test_that("partial match suggests crops and returns empty result", { test_that("no match returns empty data frame with correct columns", { level <- PEcAn.logger::logger.getLevel() PEcAn.logger::logger.setLevel("OFF") - result <- look_up_ca_n_rate("Alfalfa") + result <- look_up_ca_n_rate("Soybean") PEcAn.logger::logger.setLevel(level) expect_equal(nrow(result), 0) expect_equal(names(result), c("pft_group", "crop", "min_n", "max_n", "source")) @@ -123,7 +123,7 @@ test_that("compost partial match suggests materials", { test_that("ca_n_application_rate dataset has expected structure", { dat <- PEcAn.data.land::ca_n_application_rate - expect_equal(nrow(dat), 33) + expect_equal(nrow(dat), 41) expect_true(all(c("pft_group", "crop", "min_n_lbs_acre", "max_n_lbs_acre", "source", "min_n_g_m2", "max_n_g_m2") %in% names(dat))) }) From 7a59c49e3dd284b6fdcb5c21919f93cbb2819e5c Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 64/97] add raw compost tsv to data-raw --- modules/data.land/data-raw/compost.tsv | 33 ++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/data.land/data-raw/compost.tsv diff --git a/modules/data.land/data-raw/compost.tsv b/modules/data.land/data-raw/compost.tsv new file mode 100644 index 0000000000..32f38f419c --- /dev/null +++ b/modules/data.land/data-raw/compost.tsv @@ -0,0 +1,33 @@ +Material C_MIN (C:N) C_MAX (C:N) C_Avg (C:N) C_Assumed (%) Total N (%) 4 week PAN (%) LowerN/HigherN RowsMIN_AppRate (tons/acre) RowsMIN_AppRate (lbs/acre) RowsMIN_Total_N (lbs N/acre) RowsMIN_Avail_N (lbs N/acre) RowsMIN_Total_C (lbs C/acre) RowsMAX_AppRate (tons/acre) RowsMAX_AppRate (lbs/acre) RowsMAX_Total_N (lbs N/acre) RowsMAX_Avail_N (lbs N/acre) RowsMAX_Total_C (lbs C/acre) TreesMIN_AppRate (tons/acre) TreesMIN_AppRate (lbs/acre) TreesMIN_Total_N (lbs N/acre) TreesMIN_Avail_N (lbs N/acre) TreesMIN_Total_C (lbs C/acre) TreesMAX_AppRate (tons/acre) TreesMAX_AppRate (lbs/acre) TreesMAX_Total_N (lbs N/acre) TreesMAX_Avail_N (lbs N/acre) TreesMAX_Total_C (lbs C/acre) Source +Alfalfa hay 13.00 13.00 13.00 40.00% 3.08 16.15 LOWER 4.00 8000.00 246.15 39.76 98.46 5.30 10600.00 326.15 52.69 130.46 4.00 8000.00 246.15 39.76 98.46 5.30 10600.00 326.15 52.69 130.46 Eghball, UNL Extension +Apple pomace 21.00 21.00 21.00 40.00% 1.90 -1.43 LOWER 4.00 8000.00 152.38 -2.18 60.95 5.30 10600.00 201.90 -2.88 80.76 4.00 8000.00 152.38 -2.18 60.95 5.30 10600.00 201.90 -2.88 80.76 Eghball, UNL Extension +Bark 100.00 130.00 115.00 40.00% 0.35 -24.78 LOWER 4.00 8000.00 27.83 -6.90 11.13 5.30 10600.00 36.87 -9.14 14.75 4.00 8000.00 27.83 -6.90 11.13 5.30 10600.00 36.87 -9.14 14.75 Eghball, UNL Extension +Blood meal 4.00 4.00 4.00 40.00% 10.00 60.00 HIGHER 2.20 4400.00 440.00 264.00 176.00 3.60 7200.00 720.00 432.00 288.00 1.50 3000.00 300.00 180.00 120.00 2.90 5800.00 580.00 348.00 232.00 Eghball, UNL Extension +Coffee grounds 20.00 20.00 20.00 40.00% 2.00 0.00 LOWER 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 Eghball, UNL Extension +Corn cobs 50.00 120.00 85.00 40.00% 0.47 -22.94 LOWER 4.00 8000.00 37.65 -8.64 15.06 5.30 10600.00 49.88 -11.44 19.95 4.00 8000.00 37.65 -8.64 15.06 5.30 10600.00 49.88 -11.44 19.95 Eghball, UNL Extension +Corn stalks 60.00 70.00 65.00 40.00% 0.62 -20.77 LOWER 4.00 8000.00 49.23 -10.22 19.69 5.30 10600.00 65.23 -13.55 26.09 4.00 8000.00 49.23 -10.22 19.69 5.30 10600.00 65.23 -13.55 26.09 Rynk, NC State Extension +Corn stalks 80.00 80.00 80.00 40.00% 0.50 -22.50 LOWER 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 Eghball, UNL Extension +Cow manure 20.00 25.00 22.50 40.00% 1.78 -3.33 LOWER 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 Rynk, NC State Extension +Cow manure 20.00 20.00 20.00 40.00% 2.00 0.00 LOWER 4.00 8000.00 160.00 246.15 64.00 5.30 10600.00 212.00 0.00 84.80 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 Eghball, UNL Extension +Dry leaves 30.00 80.00 55.00 40.00% 0.73 -19.09 LOWER 4.00 8000.00 58.18 -11.11 23.27 5.30 10600.00 77.09 -14.72 30.84 4.00 8000.00 58.18 -11.11 23.27 5.30 10600.00 77.09 -14.72 30.84 Rynk, NC State Extension +Fruit waste 35.00 35.00 35.00 40.00% 1.14 -12.86 LOWER 4.00 8000.00 91.43 -11.76 36.57 5.30 10600.00 121.14 -15.58 48.46 4.00 8000.00 91.43 -11.76 36.57 5.30 10600.00 121.14 -15.58 48.46 Eghball, UNL Extension +Grass 12.00 25.00 18.50 40.00% 2.16 2.43 LOWER 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 Rynk, NC State Extension +Grass clippings 12.00 25.00 18.50 40.00% 2.16 2.43 LOWER 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 Eghball, UNL Extension +Horse manure 20.00 30.00 25.00 40.00% 1.60 -6.00 LOWER 4.00 8000.00 128.00 -7.68 51.20 5.30 10600.00 169.60 -10.18 67.84 4.00 8000.00 128.00 -7.68 51.20 5.30 10600.00 169.60 -10.18 67.84 Rynk, NC State Extension +Leaves 40.00 80.00 60.00 40.00% 0.67 -20.00 LOWER 4.00 8000.00 53.33 -10.67 21.33 5.30 10600.00 70.67 -14.13 28.27 4.00 8000.00 53.33 -10.67 21.33 5.30 10600.00 70.67 -14.13 28.27 Eghball, UNL Extension +Manure — cow and horse 20.00 25.00 22.50 40.00% 1.78 -3.33 LOWER 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 Eghball, UNL Extension +Manure — poultry (fresh) 10.00 10.00 10.00 40.00% 4.00 30.00 HIGHER 2.20 4400.00 176.00 52.80 70.40 3.60 7200.00 288.00 86.40 115.20 1.50 3000.00 120.00 36.00 48.00 2.90 5800.00 232.00 69.60 92.80 Eghball, UNL Extension +Manure with litter — horse 30.00 60.00 45.00 40.00% 0.89 -16.67 LOWER 4.00 8000.00 71.11 -11.85 28.44 5.30 10600.00 94.22 -15.70 37.69 4.00 8000.00 71.11 -11.85 28.44 5.30 10600.00 94.22 -15.70 37.69 Eghball, UNL Extension +Manure with litter — poultry 13.00 18.00 15.50 40.00% 2.58 8.71 LOWER 4.00 8000.00 206.45 17.98 82.58 5.30 10600.00 273.55 23.83 109.42 4.00 8000.00 206.45 17.98 82.58 5.30 10600.00 273.55 23.83 109.42 Eghball, UNL Extension +Newspaper 400.00 800.00 600.00 40.00% 0.07 -29.00 LOWER 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 Rynk, NC State Extension +Newspaper, shredded 400.00 800.00 600.00 40.00% 0.07 -29.00 LOWER 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 Eghball, UNL Extension +Paper 150.00 200.00 175.00 40.00% 0.23 -26.57 LOWER 4.00 8000.00 18.29 -4.86 7.31 5.30 10600.00 24.23 -6.44 9.69 4.00 8000.00 18.29 -4.86 7.31 5.30 10600.00 24.23 -6.44 9.69 Eghball, UNL Extension +Pine needles 80.00 80.00 80.00 40.00% 0.50 -22.50 LOWER 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 Eghball, UNL Extension +Poultry litter 5.00 20.00 12.50 40.00% 3.20 18.00 LOWER 4.00 8000.00 256.00 46.08 102.40 5.30 10600.00 339.20 61.06 135.68 4.00 8000.00 256.00 46.08 102.40 5.30 10600.00 339.20 61.06 135.68 Rynk, NC State Extension +Sawdust and wood chips 100.00 500.00 300.00 40.00% 0.13 -28.00 LOWER 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 Eghball, UNL Extension +Straw 40.00 100.00 70.00 40.00% 0.57 -21.43 LOWER 4.00 8000.00 45.71 -9.80 18.29 5.30 10600.00 60.57 -12.98 24.23 4.00 8000.00 45.71 -9.80 18.29 5.30 10600.00 60.57 -12.98 24.23 Rynk, NC State Extension +Straw — oats and wheat 70.00 80.00 75.00 40.00% 0.53 -22.00 LOWER 4.00 8000.00 42.67 -9.39 17.07 5.30 10600.00 56.53 -12.44 22.61 4.00 8000.00 42.67 -9.39 17.07 5.30 10600.00 56.53 -12.44 22.61 Eghball, UNL Extension +Swine manure 8.00 20.00 14.00 40.00% 2.86 12.86 LOWER 4.00 8000.00 228.57 29.39 91.43 5.30 10600.00 302.86 38.94 121.14 4.00 8000.00 228.57 29.39 91.43 5.30 10600.00 302.86 38.94 121.14 Rynk, NC State Extension +Vegetable waste 10.00 20.00 15.00 40.00% 2.67 10.00 LOWER 4.00 8000.00 213.33 21.33 85.33 5.30 10600.00 282.67 28.27 113.07 4.00 8000.00 213.33 21.33 85.33 5.30 10600.00 282.67 28.27 113.07 Rynk, NC State Extension +Vegetable waste 12.00 20.00 16.00 40.00% 2.50 7.50 LOWER 4.00 8000.00 200.00 15.00 80.00 5.30 10600.00 265.00 19.88 106.00 4.00 8000.00 200.00 15.00 80.00 5.30 10600.00 265.00 19.88 106.00 Eghball, UNL Extension +Woodchips 100.00 500.00 300.00 40.00% 0.13 -28.00 LOWER 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 Rynk, NC State Extension \ No newline at end of file From 229b2acba813f492c255ae18ba136f1fed05d80f Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 65/97] add raw n fertilization tsv to data-raw --- .../data.land/data-raw/n_fertilization.tsv | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 modules/data.land/data-raw/n_fertilization.tsv diff --git a/modules/data.land/data-raw/n_fertilization.tsv b/modules/data.land/data-raw/n_fertilization.tsv new file mode 100644 index 0000000000..29d81a9a28 --- /dev/null +++ b/modules/data.land/data-raw/n_fertilization.tsv @@ -0,0 +1,90 @@ +PFT Group Crop PlantStage Season MINN MAXN Unit Source Notes +row Alfalfa starter 20 40 lbs N/acre CDFA-FREP & UC Davis when the residual nitrate concentration is below 3-4 ppm NO3-N (15 ppm NO3) +row Alfalfa 0 0 lbs N/acre Meyer et al. 2007. Pub. 8292 From Meyer et al 2007 ""Seldom: Less than 1% of the acreage shows need for fertilization."" +woody Almonds year 1 30 30 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds year 2 55 55 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds year 3 116 116 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds year 4 174 174 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds year 5 232 232 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds year 6 237 237 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds years 7-15 210 255 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Almonds years 16-25 152 220 lbs N/acre Brown et al. 2020 NBMP Table 2 +woody Avocado 67 100 lbs N/acre Rosenstock et al., 2013 +row Barley preplant fall 25 100 lbs N/acre CDFA-FREP & UC Davis +row Barley starter 0 30 lbs N/acre CDFA-FREP & UC Davis +row Barley topdress spring 30 100 lbs N/acre CDFA-FREP & UC Davis +row Barley foliar 10 20 lbs N/acre CDFA-FREP & UC Davis +row Bean, blackeye preplant 0 0 lbs N/acre CDFA-FREP & UC Davis +row Bean, blackeye starter 0 8 lbs N/acre CDFA-FREP & UC Davis small amount +row Bean, blackeye sidedress 0 0 lbs N/acre CDFA-FREP & UC Davis +row Bean, common preplant 200 lbs N/acre CDFA-FREP & UC Davis +row Bean, common sidedress 70 100 lbs N/acre CDFA-FREP & UC Davis +row Bean, dry 86 116 lbs N/acre Rosenstock et al., 2013 +row Bean, dry foliar 0 0 lbs N/acre CDFA-FREP & UC Davis +row Bean, lima starter 0 8 lbs N/acre CDFA-FREP & UC Davis +row Bean, lima preplant 100 lbs N/acre CDFA-FREP & UC Davis +row Bean, lima sidedress 55 125 lbs N/acre CDFA-FREP & UC Davis +row Broccoli 100 200 lbs N/acre Rosenstock et al., 2013 +row Broccoli preplant 20 30 lbs N/acre CDFA-FREP & UC Davis +row Broccoli starter 20 30 lbs N/acre CDFA-FREP & UC Davis +row Broccoli winter 180 240 lbs N/acre CDFA-FREP & UC Davis +row Broccoli spring 180 240 lbs N/acre CDFA-FREP & UC Davis +row Broccoli summer 150 180 lbs N/acre CDFA-FREP & UC Davis +row Broccoli fall 150 180 lbs N/acre CDFA-FREP & UC Davis +row Carrot 100 250 lbs N/acre Rosenstock et al., 2013 +row Carrot preplant 40 50 lbs N/acre CDFA-FREP & UC Davis +row Carrot sidedress 60 80 lbs N/acre CDFA-FREP & UC Davis +row Carrot in-season 150 lbs N/acre CDFA-FREP & UC Davis +row Cauliflower preplant 20 30 lbs N/acre CDFA-FREP & UC Davis +row Cauliflower preplant fall 0 0 lbs N/acre CDFA-FREP & UC Davis +row Cauliflower starter 20 30 lbs N/acre CDFA-FREP & UC Davis +row Celery 200 275 lbs N/acre Rosenstock et al., 2013 +row Celery preplant 20 30 lbs N/acre CDFA-FREP & UC Davis +row Celery starter 20 30 lbs N/acre CDFA-FREP & UC Davis +row Corn 150 275 lbs N/acre Rosenstock et al., 2013 +row Corn preplant 200 275 lbs N/acre CDFA-FREP & UC Davis +row Corn starter 10 60 lbs N/acre CDFA-FREP & UC Davis +row Corn sidedress 180 216 lbs N/acre CDFA-FREP & UC Davis +row Corn foliar 0 0 lbs N/acre CDFA-FREP & UC Davis +row Corn, sweet 100 200 lbs N/acre Rosenstock et al., 2013 +row Cotton 100 200 lbs N/acre Rosenstock et al., 2013 +row Cotton preplant 0 0 lbs N/acre CDFA-FREP & UC Davis +row Cotton starter 5 35 lbs N/acre CDFA-FREP & UC Davis +row Cotton sidedress 55 200 lbs N/acre CDFA-FREP & UC Davis +row Cotton foliar 18 30 lbs N/acre CDFA-FREP & UC Davis *total spead over three applications +woody Grape, raisin 20 60 lbs N/acre Rosenstock et al., 2013 +woody Grapevines after budbreak until fruit set OR post-harvest spring 0 60 lbs N/acre Meyer et al. 2007. Pub. 8295 raisin production; dependent on vine ""vigor"" and soil* wine grapes may have lower N* +woody Grapevines 20 60 lbs N/acre Meyer et al. 2007. Pub. 8296 raisin +row Lettuce 170 220 lbs N/acre Rosenstock et al., 2013 +row Lettuce preplant 20 40 lbs N/acre CDFA-FREP & UC Davis dependent on residual N concentration in soil (less than 20 ppm indicates no preplant N amendment) +row Lettuce starter 0 0 lbs N/acre CDFA-FREP & UC Davis dependent on residual N concentration in soil (less than 20 ppm indicates no preplant N amendment) +row Lettuce sidedress winter 150 180 lbs N/acre CDFA-FREP & UC Davis +row Lettuce sidedress spring 150 180 lbs N/acre CDFA-FREP & UC Davis +row Lettuce sidedress fall 100 140 lbs N/acre CDFA-FREP & UC Davis +row Lettuce sidedress summer 100 140 lbs N/acre CDFA-FREP & UC Davis +row Melon, cantaloupe 80 150 lbs N/acre Rosenstock et al., 2013 +row Melon, watermelon 160 lbs N/acre Rosenstock et al., 2013 +row Melons preplant 0 50 lbs N/acre CDFA-FREP & UC Davis +row Melons sidedress 80 150 lbs N/acre CDFA-FREP & UC Davis +row Melons (mixed) 100 150 lbs N/acre Rosenstock et al., 2013 +woody Nectarine 100 150 lbs N/acre Rosenstock et al., 2013 +row Oats 50 120 lbs N/acre Rosenstock et al., 2013 +row Onion 100 400 lbs N/acre Rosenstock et al., 2013 +row Onions preplant lbs N/acre CDFA-FREP & UC Davis 1/3 of total N at preplant +woody Peach, bell 180 240 lbs N/acre Rosenstock et al., 2013 +woody Peach, chili 150 200 lbs N/acre Rosenstock et al., 2013 +woody Peach, cling 50 100 lbs N/acre Rosenstock et al., 2013 +woody Peach, free 50 100 lbs N/acre Rosenstock et al., 2013 +row Pepper, bell 180 240 lbs N/acre Rosenstock et al., 2013 +row Pepper, chili 150 200 lbs N/acre Rosenstock et al., 2013 +woody Pistachios 100 225 lbs N/acre Rosenstock et al., 2013 +woody Plums, dried 100 lbs N/acre Rosenstock et al., 2013 +woody Plums, fresh 110 150 lbs N/acre Rosenstock et al., 2013 +row Potato preplant lbs N/acre CDFA-FREP & UC Davis 2/3-3/4 should be applied pre-plant +rice Rice 110 145 lbs N/acre Rosenstock et al., 2013 +row Safflower 100 150 lbs N/acre Rosenstock et al., 2013 +row Strawberry 150 300 lbs N/acre Rosenstock et al., 2013 +row Tomatoes, fresh market 125 350 lbs N/acre Rosenstock et al., 2013 +row Tomatoes, processing 100 150 lbs N/acre Rosenstock et al., 2013 +woody Walnuts 150 200 lbs N/acre Rosenstock et al., 2013 +row Wheat 100 240 lbs N/acre Rosenstock et al., 2013 From ca51a6847de74e4fb0472f03f0bde0dc802352bd Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 66/97] read raw compost tsv from data-raw and use ud_convert --- .../data.land/data-raw/create_compost_data.R | 33 +++++-------------- 1 file changed, 9 insertions(+), 24 deletions(-) diff --git a/modules/data.land/data-raw/create_compost_data.R b/modules/data.land/data-raw/create_compost_data.R index 00e4d0c372..e9e004281e 100644 --- a/modules/data.land/data-raw/create_compost_data.R +++ b/modules/data.land/data-raw/create_compost_data.R @@ -1,22 +1,11 @@ #!/usr/bin/env Rscript # # builds the ca_compost_amendment packaged dataset from the raw -# fertilization spreadsheet. reads the raw Compost TSV, renames columns -# into the snake_case schema we expose downstream, adds the CalRecycle -# material_class taxonomy (14 CCR section 17852), and writes a cached -# CSV plus the packaged .rda. -# -# the compost sampling distributions live in -# create_ca_compost_distributions.R as separate bundled tibbles. - -raw_path <- file.path( - "/projectnb/dietzelab/ccmmf/usr/akash/management/fertilization", - "CCMMF Fertilization - Compost.tsv" -) -out_csv <- file.path("data-raw", "compost_amendments.csv") +# compost TSV that ships in data-raw/. renames columns into the +# snake_case schema we expose downstream and adds the CalRecycle +# material_class taxonomy (14 CCR section 17852). -# 1 lb/acre = 0.112085 g/m^2. -LBS_ACRE_TO_G_M2 <- 0.112085 +raw_path <- file.path("data-raw", "compost.tsv") # map each raw material name to one of the CalRecycle classes # (14 CCR section 17852). biosolids is empty in the current table. @@ -47,11 +36,12 @@ ca_compost_amendment <- raw |> n_class = .data$`LowerN/HigherN`, app_rate_min = .data$`RowsMIN_AppRate (lbs/acre)`, app_rate_max = .data$`RowsMAX_AppRate (lbs/acre)`, - # %C is sampled at runtime via sample_ca_compost_pct_c(). total_n_min_lbs_acre = .data$`RowsMIN_Total_N (lbs N/acre)`, total_n_max_lbs_acre = .data$`RowsMAX_Total_N (lbs N/acre)`, - total_n_min_g_m2 = round(.data$total_n_min_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), - total_n_max_g_m2 = round(.data$total_n_max_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), + total_n_min_g_m2 = round( + PEcAn.utils::ud_convert(.data$total_n_min_lbs_acre, "lb/acre", "g/m^2"), 3), + total_n_max_g_m2 = round( + PEcAn.utils::ud_convert(.data$total_n_max_lbs_acre, "lb/acre", "g/m^2"), 3), source = trimws(.data$Source) ) @@ -67,11 +57,6 @@ if (length(unclassified) > 0) { } PEcAn.logger::logger.info(sprintf( - "Harmonized %d compost materials into compost_amendments.csv", - nrow(ca_compost_amendment) -)) - -readr::write_csv(ca_compost_amendment, out_csv) -PEcAn.logger::logger.info("Wrote ", out_csv) + "Harmonized %d compost materials", nrow(ca_compost_amendment))) usethis::use_data(ca_compost_amendment, overwrite = TRUE) From 39ce033c74deca977d06b6fa67971d370e8d6cd3 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 67/97] read raw n tsv from data-raw and use ud_convert --- .../data.land/data-raw/create_n_rate_data.R | 57 +++++-------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/modules/data.land/data-raw/create_n_rate_data.R b/modules/data.land/data-raw/create_n_rate_data.R index dbd9891bc2..808da4f8d4 100644 --- a/modules/data.land/data-raw/create_n_rate_data.R +++ b/modules/data.land/data-raw/create_n_rate_data.R @@ -1,27 +1,14 @@ #!/usr/bin/env Rscript # # Build the ca_n_application_rate packaged dataset from the raw -# fertilization spreadsheet. Reads the raw TSV directly, classifies each -# row by stage and unit, converts oz N per tree rows to lb N per acre via -# DEMETER orchard density, sums within year stage rows for crops that -# lack a total season row, and writes both a cached CSV in data-raw/ and -# the packaged .rda in data/ via usethis::use_data +# fertilization TSV that ships in data-raw/. Classifies each row by +# stage, sums within year stage rows for crops that lack a total season +# row, and writes the packaged .rda via usethis::use_data. -# pull in build time helpers we expose in R/. -source(file.path("R", "tpa_lookup.R")) -source(file.path("R", "oz_per_tree_to_lb_per_acre.R")) - -raw_path <- file.path( - "/projectnb/dietzelab/ccmmf/usr/akash/management/fertilization", - "CCMMF Fertilization - N_Fertilization.tsv" -) -out_csv <- file.path("data-raw", "n_application_rates.csv") - -# 1 lb/acre = 0.112085 g/m^2. -LBS_ACRE_TO_G_M2 <- 0.112085 +raw_path <- file.path("data-raw", "n_fertilization.tsv") # stages whose rows sum to an annual total for the same crop. other stage -# tags (e.g. "first season", "first-leaf trees") describe year conditional +# tags (e.g. "first season", "first leaf trees") describe year conditional # rates and get treated as separate years. WITHIN_YEAR_STAGES <- c( "preplant", "starter", "starter ", "sidedress", @@ -49,22 +36,11 @@ usable <- raw |> max_n = dplyr::coalesce(.data$max_n, .data$min_n) ) -# convert any oz N per tree rows to lb N per acre using DEMETER orchard -# density. currently only almond young tree rows hit this branch. -oz_rows <- usable |> - dplyr::filter(.data$unit == "oz N/tree") |> - dplyr::mutate( - tpa = vapply(.data$crop, tpa_lookup, integer(1)), - min_n = oz_per_tree_to_lb_per_acre(.data$min_n, .data$tpa), - max_n = oz_per_tree_to_lb_per_acre(.data$max_n, .data$tpa), - unit = "lbs N/acre" - ) |> - dplyr::select(-"tpa") - -all_lb <- dplyr::bind_rows( - usable |> dplyr::filter(.data$unit == "lbs N/acre"), - oz_rows -) |> +# all rows in the current raw TSV are in lbs N per acre. classify by +# stage so per-stage rows can be aggregated to an annual total when no +# total-season row is available. +all_lb <- usable |> + dplyr::filter(.data$unit == "lbs N/acre") |> dplyr::mutate( row_kind = dplyr::case_when( is.na(.data$stage) | .data$stage == "" ~ "total", @@ -129,15 +105,15 @@ envelope_year <- all_lb |> ca_n_application_rate <- dplyr::bind_rows(envelope_total, sum_stages, envelope_year) |> dplyr::mutate( - min_n_g_m2 = round(.data$min_n_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3), - max_n_g_m2 = round(.data$max_n_lbs_acre * .env$LBS_ACRE_TO_G_M2, 3) + min_n_g_m2 = round( + PEcAn.utils::ud_convert(.data$min_n_lbs_acre, "lb/acre", "g/m^2"), 3), + max_n_g_m2 = round( + PEcAn.utils::ud_convert(.data$max_n_lbs_acre, "lb/acre", "g/m^2"), 3) ) |> dplyr::arrange(.data$pft_group, .data$crop) PEcAn.logger::logger.info(sprintf( - "Harmonized %d crops into n_application_rates.csv", - nrow(ca_n_application_rate) -)) + "Harmonized %d crops", nrow(ca_n_application_rate))) # flag crops whose raw rows had NA for both MINN and MAXN. raw_crops <- unique(raw$crop) @@ -151,7 +127,4 @@ if (length(dropped) > 0) { ) } -readr::write_csv(ca_n_application_rate, out_csv) -PEcAn.logger::logger.info("Wrote ", out_csv) - usethis::use_data(ca_n_application_rate, overwrite = TRUE) From 50c2ffa19766cba5fa4313df9f17cc6853803504 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 68/97] rebuild ca_compost_amendment rda --- .../data.land/data/ca_compost_amendment.rda | Bin 2053 -> 2052 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/modules/data.land/data/ca_compost_amendment.rda b/modules/data.land/data/ca_compost_amendment.rda index 3f15e8ee2170de862a70dcb360cbec578a34e570..7c4c483203c1153c58a513692df0bc4a065c6af0 100644 GIT binary patch literal 2052 zcmZ9Fdpy$(8^(V#W@a;|#zwQ*a*T#0c?g4atKkD=DWBDvg#gw72>>t!0MHN|05AY104c{n zC?x)BGF-gsKR8Tgqw9d7RShtiYxDoXk^k$g_OBH(w7CGNV6_y(V4{KE)eEqT7XZkw z#%m0%{R7|`ssLaKkO8n~J{YIHngdMns!#OgyQIladb&U*RG%R)uQwNl>*rH)4!hP@ z&4byjsv17FCc_I&mcd<%>}&Gata-A8ZOOzI4`UE@3&m`#fYmz6Br}ijVfH?*pEb88 z;qrDl7+A!a+35OZM}bc#|;A00BrS2my_oouruK`dA%4Xffklb?-)q{0V?Z^sw8{#L2-& zP`^sPAI9TR*IPzyslZdx zn|7pdnNxcyv04K&j*h1iDazc@@&le(3G3B%eoX(MaV(nWOnSX&6I*Vn;6DFM-)X5U zHTsDA@=!-vfecIkjl6?dr<)=rrqn;&6?gK!f+F!BL@sS`%bQq>*85~>_$xwa!BBpq zYm3xLr>F6mpN=6^*#0KoIxystGyEtsrokpcr;;;QF$sFS`NL8`rzu1)FVP6PV?HCQ zaOA8rv}l`~{NEcNNV3PC>78Dl6=o8nt}p$>j^Je{t|@(}&$`hS;X#5y@@JulYg2?D zMz8#M`r!daR~+6OhQQ^^d`rNKhK_U9i8w8eVG-JTozx`CWRqKY*Sb z;^tuY~uGd!fRPmPJ|#9?uhmBGJLOMrlt;9RV^6PC!bevkpLg3{)&Uqw0muMhpn&E;aWy~*t0waAL~ z-%3f{8*WoKaaA}kWhjHB+o0~5c+>v9=&$|wq1g~g`)i;)FYK>TrDuUr3y>UWbKyxnY zfltwq4yzl<=HE_;ZS0iqITv;8iP0g^vnI#b7fgfjma?a3n`h`TvE-a6H(s6cKc-<5 zgJYW+V;X(L;5s0QsKG!E26{(U?oxAmy!`? zQ=Stxgz4h#rtTj~aM2j(D+674V56bm@Ku!Jp(WPDUe}{KLk~ozG-?rdu?!#9xEmAb zDc3f9ZerD|OdZ5E8b%c=mEG@5cS~${pVLp*%s<^iz5;9b?%@+&NCZ)^nI#)hO%0)4 z>YtikGJw9ZYh_!6^DMfnSA;iQvYRCeBBWWN_8KS9dLA)6b!&p(ohcrl`y^Js>`@CyQiKh6F^cT({tOc z^lOuj=N*FOPz|0D6kXZwC1%~A6hT1jmx0lESdNzUV7hcu_t3}!;(YLu39nYB`<|2NmM_#Fi6%?z3|zT0rH%>WD! z?=I@-sb){u^I~Y7shsDMJDbA~UitoaYQFTG&B;B~$zzBs#+U6+!UyZ-IlSBg-4#WE z<065!$Uj=XC~!&6_9af+4hM;0L$yrT@9QW+NvUKQ+?Ob4c736XhuR#evltVEG{UR> z+g*&1<*D_;_%UaCI)x7U3i2oz`AL)m(WkgFrxf1M-9Rz*Q;$^wwU);J`?5{Mq~!Xx zxKHn8?6!NawH>X%WjT2)LStx-3|y0krv6W>8HF76UZ;={WZCCTCl3N6Q~)K0#XDT? e%`(T+E6jk)%81@@xvm!SOzT4*^jL0KkKS?0;HegFq9fB*mg|NsC0|NsC0|M&m@|Nr~z{`al@{Z;?} zU%UG6`>o&x-(&y=#sC1Js16wDG8fehbwKOyUVm(0GhMESRqd+kL z&@>GjQMEDv003xcXagfgng*I=G}>wnO-z|h86@#CnDn5?ZK?ozjRQ>$8fX9j27mxz z01W^JfB*mh00003Kr{iPMt~3i4FG5~XaS=UplBKZ01X2O4FC-Q0009(0i!?w0MIl5 z00E!?00;mEfHWF30MUrhGz|a%27!bIfChj700E!?(VzeTXc_FDti+|^wm6?pP@}Q z(oaeHntGFE9;3=+&}pCz8&RR7O%F{Y$*Hvu)R;$-dWWcZrqpCTO*9%kOr8>LK+qni zr~rD60jKu*ed33E1QCn}`r{Vj(}DHIC9WD21hR&OHlv+Y%4+_1R#|+GQc)_Gw#v(2 zE@=#gDUA?9C5)q)c2`;AG01$Cv1Eg)^wujN!!fNq8Ebr43m~3P>Qr zn9QepMLAj80}fers@+N^?%Y)mU0%#+ZPHnERSQ*C1Wlx90|AIZoPa>m0csjKiJ-dB zy?a7~Km?8%7|IGkt~1cu zV`+?Ow7Ue2YC}Ri|4WzMO2F0(HkXHp;6NNShyv4BE~Y4y&BJqqvYAnrpAs zF55awWx!j81aCmpMIH#vvPRhm!iwzqCwUxw6hC(bz~v0I_xx?#Lx?q)pHoal&En~( z0GQF*z<}Fr@_(!pYA%Fo0u?#?38li}C6pxq{Au1%cbE_hGB_y|lC@4eN>p^!*EXRG zM8c_GyNlTA*W0S5G3^HzhtZ)hF_q6b<6Xh>GWpdU57nYQ>Ps>eMFk$x(x*JAGM|Wg zMqhjBws*7KNXDW#mdGwxnv%fe1c8c-;bsYLKZxn9RXWI1WFotyN=#+Q0W%+3IH9P~ zF(VBj*%QX958Q&FU*7eWw6n77>0x!6tj$bxb-B(tvw_~Qy_H6?P-%lrx2AP97PXOq zW!s#$4^bF9Rw;~~6|2J5f}3)iiGFpWYgq^R82}{ElV}%1^zk6G2k@=KZZqX1X?PXN z4$6Sbj(C*)z+oS`L!9ZvslK0k%wlm_=}&$q8ao!7p7(VyJ*@8HA0i+%|G`%RJtc!hJ*9tB)R zZoGqLC1bTF6th-@d`fK=vQ>cj!K{&}H|Xi~D#6&S9VNtx7EL6}k~UKhjfQWIG9rXj zv5Oc5C&N0sG+V!uaE5Adb1#(^O6`rXY{F(EXJ3~YTCoZX_p&lacFSXFq*E$Os$qda zTK2+=RMnAGPau(ApaJ0!O^`ncRXIj+Y%N+914}~1{Pg_4J;DC|r5-Qd(g|oWi|0&) zbOxJ8bi^^`hJ<8f5hX&=n4w3S$Djbk(w*G|Relp*HH(Q8I?R0$6d}Qe3cg#Bpwm&z zrb;OzS%S6&#bDFY8||cmyq%UrC^3w}2_>I(Tjb1zBV}zTK;Wvuq_p!AB!DIdo#l%O ztF^6QiFf#MvH)Z1+e{fl!YI;0`on+_laP~X&^z>o(i;$rfdU}|h!R8?o;R*?(?Cc_ zn+C^>EKgQjFBupJVR&JOmR7D&jHR}M;M96I{w=Ebj}f?PetD~%slnHBG1RejpaynP zgp1fz5ma9xV;#bxkcqQM!o{^EN*2%n!B8qTdnW2S6*;bLoelypK+#gUJI&%FLT(q7 zU8ZbA?-C5q1JjrTMbNS%N=UNKba4wl=jt5ETpY+<{J@imS{GX~lBuxn^;SNu%7|l-5RL9Vn zTo9NgtU!MPQtJ+mR$R`aAS6H!(P#DT|{bUqKqkR_4zRe17u!soMEBsx_6yZWcn Date: Sat, 23 May 2026 19:16:31 -0400 Subject: [PATCH 69/97] rebuild ca_n_application_rate rda --- .../data.land/data/ca_n_application_rate.rda | Bin 1360 -> 1359 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/modules/data.land/data/ca_n_application_rate.rda b/modules/data.land/data/ca_n_application_rate.rda index 6ac8e2f5bb6768f2e4e052cfd583fb2bfc387fed..5f8c831da1ac054144d8a5c9937f60916527091c 100644 GIT binary patch delta 1342 zcmV-E1;P5z3eO4=LRx4!F+o`-Q(5E_E|35O`H>MMf1179F2$Ef=_3G=Q5pdgLmEvQ zXf%2znq&c>&}a<-iJ_*N8UdgTfMn62WY7!&2ALj&)6^OujRG{p8YY^64^U_{G|`{{ z003wJ02*jC!e{^h00000#7dr1P-G1N8U`ak&>0O414fvc0AvjYO$`GHgwdb_OieV& zh|mK;f1vqfCHcjG7HHV2un$38sKzGzN_^4K&Gw(?HRJXu>fvV3I^h zgH&uNdTJX}MrsB?XaE2J4^RLA4F~F)0000000009Ev5&pD;En9nZ}J4Fikjw6CtqU z9rB}~VZ!M&Q8IAD&N!_1_D((@Sa;tLC9Gwxe}0$PR}r(*QQ}O@XTjhQX{1n40#F4I zl0=a=1_jC?1V9!jQ2brMLp3zy5-XLcI^+97Vo3wo6882qI!F+b6$V05Il>foTs5Ax6TL3xj4dOIJO>0xoSd%<)cT z6C%xkdns&dQwml@!f_|z1WLI9$|RM_`<5)>s*@>ucD3yjozYbc$N**1vr4Jb1(I5H zfPf;9qqhJZ4O<5hBKRjB@dIruW|DeIf0(zhT*e2SHlP4SUtTkZQfD}GQgK-GtC-T8 zQCOS-zy?z*@H%Ed5MN3lm;h@+I&d;TTM?v|61mJ087T*3!@(qmSl*G5Z}D>CjJ$io zdghhtjzLz&D{dj}uNmBTGagnLJ&qJw*2#e`!}xJt9p~f7N;$P1yd>cc0|$NPe@VU( zh`W)zqbP)k+ovSZK?H*4GR?ShfJh=6CgmqcBoaXql0_sS!H`2ppEb!?E5at{o!yBW zxm|XZsj6UwXwyzP^_VLXyMmJ?`Rv@0S`jzWJRmF8%9R@8*+t*o$r*5(b z&W5NRiBv!M*v+H_Ka>~Ih+zfN6Zo`r(V4tuyR04dN<`9yFBrY;7?3>(M6iYt4#vTE z$T0)yU<(F-00&Vq8bx{U7{O9oLRUx>lb)Dvn^&q$^k*|>1%MnJH)lMwxfdIfCP%l)UaWPB1lZzE#P7DJmQiv#K8Px%| zL@UabJx#TdMODsOS(q~;GAr^cSU>nmqGF%Bqz5@zg>Rfwq(WB^J+VxA~z zPoZ>p&T%~oO{on~0qF^{Li5TJx zV$Qsklx7Gdm6aQ>Bz>rrBP-GB@(BILRx4!F+o`-Q(5BVqlf?n0FeW`*L=mGzG{~NblT%Yi zqI#aALFpQ320#D+9-spd2dHVF#0DS%kN^PC1|pR|(wd%=)Y^>=9+N-~05rs8X_FzL z>H|iAe*ge9Gynq=Kp6&r13{(;fHct4MnGuLGGx)FKrlv42AMEMh9d;iKrtEvMwo`0 zWWs5nXu&jL7@06hAxY|*dNnk9L)wt_9;cMh&;SOS0qQgW&;S|%>JL*u&}bR}0B8Wv z00x%ebl5MeGmM%nVojhzB*;?On)NoZhSQ4Be}g9sAkI{*?Og&JUQ`IBZRK3}?xE4D zt-n;uy+#uRl;!~xE9Zh!U?(A%1&M=%^vGe59F{2Ez2L-k??OaMz#U8bTO}Yc>>&_f zO3&TcdIXY%z=cj#65Xovc7wqs^7b3=PfnbQ*t^ez8w_+%`J=tS+8)cQ`Q08{eE7Or zf6$WSAZKMp@g#`}ShEuaibOsz45|Q;Fn~Y|B$4VFEnWf4%q9e^2>|0+%}F@|FAOB0 z$pQ{DAlwX+*WVlfBacH=&lI**Y>6NY0f}p{e{qbS06a1*9@HzKy_adXHk49&NtnsTx$F-u znpgo>Sy(fNOlLTAOmS#=)ik8dSR;lw0L|w<1<8*D6NzA$0BQv|@lqU+7_yp4M9dWo zl!LTBpoK`@k&$D7;@*s|?97y?wK1d{>-RqGuz?!&ox*aH&yFn1jno@fp8Bo(e?m+P zaIWMf4BDRU#W@sHSUc)vx6&~VtZyll1c=*_gb_GFAh+zMIC6kUA{twiogk1&1WHL1 zkx<~{3^sc%N=n^ckTyJ?ya+vR478+{3=i&_vBy3Ti0MmtCQAP4D|D)5bs;*jpbch2 z^Y;q4ej*_9XjQeGsXm0S9>-9te_d=MJlEtADBz+ZTXtzkaC0#cwk5U8(-|Z{II2cT zG=fI`j$0B-UyH276RREfyS-=*z_c+J+<0jLiT1rwNjO2I&!bbArXD0Ur-AW98YGS_ z`Hla&rG#$`#dv}t!|orzVwBL>1I1tfx$VBKH1I`Djjxc!ItgV_xU;OAfA=?mTHNl# zAa6G~b~ED3wlDKxvH&O~DlV2nsfzFvmSES;L<3rh-BHNt0O3GCU@}_YCMiBrqd_qh z2F+3El!behW?^N{9mQ*-j#r{z%QmWd=$!8L5ibB27WQkSB8US=Rx?6Z`CAO~-8^xa zmJC6179I`Tr4!O}dui_|f7bkOw#(%JnddpV4emo}N`i{Q0buCSr2-3N*+MtUSRQeON<8iSYf1$+tdmykF^C2|B zmlnEn0fvBfSuiWOaZl1qSa?3O$;Mc`)fO}8O#s6S3ncxLW}y%YIy45&PMR-~d`Sq5 zlVL0Z;@GD^q^A+}CEG9R6?ymu!T(!PyP{0;8TC%SlBQG25XS$Dxgwk>NO5ve!~oHv BR(}8h From 76455c1df54cbdba1aa55202520ca0f71c33c801 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:38:11 -0400 Subject: [PATCH 70/97] update news entry to match new compost and n rate columns --- modules/data.land/NEWS.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/data.land/NEWS.md b/modules/data.land/NEWS.md index 702e3484b5..50e809553a 100644 --- a/modules/data.land/NEWS.md +++ b/modules/data.land/NEWS.md @@ -12,8 +12,8 @@ * Datasets * `landiq_crop_mapping_codes` dataset mapping LandIQ crop classification codes to human-readable crop names. * `bism_kc_by_crop` dataset containing BISm crop coefficient schedules and stage timing references for use in ET estimation, including columns that map to LandIQ class and subclass. - * `ca_n_application_rate` dataset with recommended N application rates (g N/m2) for 33 California crops from CDFA-FREP and UC ANR sources. - * `ca_compost_amendment` dataset with C:N ratios, carbon, nitrogen, and PAN (g/m2) for 32 organic amendment materials. + * `ca_n_application_rate` dataset with recommended N application rates (g N/m2) for 41 California crops from CDFA-FREP and UC ANR sources. + * `ca_compost_amendment` dataset with C:N ratios, nitrogen, and PAN (g/m2) for 32 organic amendment materials, plus a `material_class` column mapping each material to the CalRecycle taxonomy (14 CCR section 17852). * Functions * `look_up_ca_n_rate()` for looking up crop-specific N application rates by name (exact match first, partial match suggestions on miss). * `look_up_ca_compost_amendment()` for looking up organic amendment properties by material name. From 335031c2f4d02e7e065f76e6792e181942817d11 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:38:11 -0400 Subject: [PATCH 71/97] update ca_compost_amendment doc to mention material_class --- modules/data.land/R/data.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index d327c1ec39..f4fe662378 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -247,10 +247,12 @@ #' California organic amendment (compost) properties #' #' Properties of organic amendment materials used in California agriculture, -#' including C:N ratios, carbon and nitrogen content, plant-available nitrogen -#' (PAN), and application rates. Some materials appear in multiple rows when -#' values are reported by different sources (e.g. Corn stalks, Cow manure, -#' Vegetable waste). The \code{source} column disambiguates these. +#' including C:N ratios, nitrogen content, plant-available nitrogen (PAN), +#' and application rates. Each material is also tagged with the CalRecycle +#' material_class taxonomy (14 CCR section 17852). Some materials appear +#' in multiple rows when values are reported by different sources +#' (e.g. Corn stalks, Cow manure, Vegetable waste). The \code{source} +#' column disambiguates these. #' #' @format A tibble with 32 rows and the following columns: #' \describe{ From fc67a4e1ccf320813256c050592f714b1511b3e2 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Sat, 23 May 2026 19:38:12 -0400 Subject: [PATCH 72/97] regen doc for ca_compost_amendment --- modules/data.land/man/ca_compost_amendment.Rd | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/data.land/man/ca_compost_amendment.Rd b/modules/data.land/man/ca_compost_amendment.Rd index 0670cf794b..ed0d7b546c 100644 --- a/modules/data.land/man/ca_compost_amendment.Rd +++ b/modules/data.land/man/ca_compost_amendment.Rd @@ -40,10 +40,12 @@ ca_compost_amendment } \description{ Properties of organic amendment materials used in California agriculture, -including C:N ratios, carbon and nitrogen content, plant-available nitrogen -(PAN), and application rates. Some materials appear in multiple rows when -values are reported by different sources (e.g. Corn stalks, Cow manure, -Vegetable waste). The \code{source} column disambiguates these. +including C:N ratios, nitrogen content, plant-available nitrogen (PAN), +and application rates. Each material is also tagged with the CalRecycle +material_class taxonomy (14 CCR section 17852). Some materials appear +in multiple rows when values are reported by different sources +(e.g. Corn stalks, Cow manure, Vegetable waste). The \code{source} +column disambiguates these. } \seealso{ \code{\link{look_up_ca_compost_amendment}} for looking up From e721e3f88a7c48e09e06d616b9e155fce26ae1ef Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 73/97] add harmonized ca_n_application_rate csv --- .../data-raw/ca_n_application_rate.csv | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 modules/data.land/data-raw/ca_n_application_rate.csv diff --git a/modules/data.land/data-raw/ca_n_application_rate.csv b/modules/data.land/data-raw/ca_n_application_rate.csv new file mode 100644 index 0000000000..ee822dc638 --- /dev/null +++ b/modules/data.land/data-raw/ca_n_application_rate.csv @@ -0,0 +1,41 @@ +pft_group,crop,min_n_lbs_acre,max_n_lbs_acre,source,min_n_g_m2,max_n_g_m2 +rice,Rice,110,145,"Rosenstock et al., 2013",12.329,16.252 +row,Alfalfa,0,0,Meyer et al. 2007. Pub. 8292,0,0 +row,Barley,65,250,CDFA-FREP & UC Davis,7.286,28.021 +row,"Bean, blackeye",0,8,CDFA-FREP & UC Davis,0,0.897 +row,"Bean, common",70,300,CDFA-FREP & UC Davis,7.846,33.625 +row,"Bean, dry",86,116,"Rosenstock et al., 2013",9.639,13.002 +row,"Bean, lima",55,233,CDFA-FREP & UC Davis,6.165,26.116 +row,Broccoli,100,240,"Rosenstock et al., 2013; CDFA-FREP & UC Davis",11.208,26.9 +row,Carrot,100,250,"Rosenstock et al., 2013",11.208,28.021 +row,Cauliflower,40,60,CDFA-FREP & UC Davis,4.483,6.725 +row,Celery,200,275,"Rosenstock et al., 2013",22.417,30.823 +row,Corn,150,275,"Rosenstock et al., 2013",16.813,30.823 +row,"Corn, sweet",100,200,"Rosenstock et al., 2013",11.208,22.417 +row,Cotton,100,200,"Rosenstock et al., 2013",11.208,22.417 +row,Lettuce,170,220,"Rosenstock et al., 2013",19.054,24.659 +row,"Melon, cantaloupe",80,150,"Rosenstock et al., 2013",8.967,16.813 +row,"Melon, watermelon",0,160,"Rosenstock et al., 2013",0,17.934 +row,Melons,80,200,CDFA-FREP & UC Davis,8.967,22.417 +row,Melons (mixed),100,150,"Rosenstock et al., 2013",11.208,16.813 +row,Oats,50,120,"Rosenstock et al., 2013",5.604,13.45 +row,Onion,100,400,"Rosenstock et al., 2013",11.208,44.834 +row,"Pepper, bell",180,240,"Rosenstock et al., 2013",20.175,26.9 +row,"Pepper, chili",150,200,"Rosenstock et al., 2013",16.813,22.417 +row,Potato,189,248,"Lazicki et al. 2016, CDFA-FREP UC Davis",21.184,27.797 +row,Safflower,100,150,"Rosenstock et al., 2013",11.208,16.813 +row,Strawberry,150,300,"Rosenstock et al., 2013",16.813,33.625 +row,"Tomatoes, fresh market",125,350,"Rosenstock et al., 2013",14.011,39.23 +row,"Tomatoes, processing",100,150,"Rosenstock et al., 2013",11.208,16.813 +row,Wheat,100,240,"Rosenstock et al., 2013",11.208,26.9 +woody,Almonds,30,255,Brown et al. 2020 NBMP Table 2,3.363,28.582 +woody,Avocado,67,100,"Rosenstock et al., 2013",7.51,11.208 +woody,"Grape, raisin",20,60,"Rosenstock et al., 2013",2.242,6.725 +woody,Grapevines,20,60,Meyer et al. 2007. Pub. 8296,2.242,6.725 +woody,Nectarine,100,150,"Rosenstock et al., 2013",11.208,16.813 +woody,"Peach, cling",50,100,"Rosenstock et al., 2013",5.604,11.208 +woody,"Peach, free",50,100,"Rosenstock et al., 2013",5.604,11.208 +woody,Pistachios,100,225,"Rosenstock et al., 2013",11.208,25.219 +woody,"Plums, dried",0,100,"Rosenstock et al., 2013",0,11.208 +woody,"Plums, fresh",110,150,"Rosenstock et al., 2013",12.329,16.813 +woody,Walnuts,150,200,"Rosenstock et al., 2013",16.813,22.417 From aadf430e52fb9c1dbff9bbd0242820266ab55735 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 74/97] add harmonized ca_organic_amendment_properties csv --- .../ca_organic_amendment_properties.csv | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 modules/data.land/data-raw/ca_organic_amendment_properties.csv diff --git a/modules/data.land/data-raw/ca_organic_amendment_properties.csv b/modules/data.land/data-raw/ca_organic_amendment_properties.csv new file mode 100644 index 0000000000..3b7dbc3d50 --- /dev/null +++ b/modules/data.land/data-raw/ca_organic_amendment_properties.csv @@ -0,0 +1,33 @@ +material,material_class,cn_min,cn_max,cn_avg,n_pct,pan_pct,n_class,source +Alfalfa hay,ag,13,13,13,3.08,16.15,LOWER,"Eghball, UNL Extension" +Apple pomace,food,21,21,21,1.9,-1.43,LOWER,"Eghball, UNL Extension" +Bark,wood,100,130,115,0.35,-24.78,LOWER,"Eghball, UNL Extension" +Blood meal,ag,4,4,4,10,60,HIGHER,"Eghball, UNL Extension" +Coffee grounds,food,20,20,20,2,0,LOWER,"Eghball, UNL Extension" +Corn cobs,ag,50,120,85,0.47,-22.94,LOWER,"Eghball, UNL Extension" +Corn stalks,ag,60,70,65,0.62,-20.77,LOWER,"Rynk, NC State Extension" +Corn stalks,ag,80,80,80,0.5,-22.5,LOWER,"Eghball, UNL Extension" +Cow manure,ag,20,25,22.5,1.78,-3.33,LOWER,"Rynk, NC State Extension" +Cow manure,ag,20,20,20,2,0,LOWER,"Eghball, UNL Extension" +Dry leaves,yard,30,80,55,0.73,-19.09,LOWER,"Rynk, NC State Extension" +Fruit waste,food,35,35,35,1.14,-12.86,LOWER,"Eghball, UNL Extension" +Grass,yard,12,25,18.5,2.16,2.43,LOWER,"Rynk, NC State Extension" +Grass clippings,yard,12,25,18.5,2.16,2.43,LOWER,"Eghball, UNL Extension" +Horse manure,ag,20,30,25,1.6,-6,LOWER,"Rynk, NC State Extension" +Leaves,yard,40,80,60,0.67,-20,LOWER,"Eghball, UNL Extension" +Manure — cow and horse,ag,20,25,22.5,1.78,-3.33,LOWER,"Eghball, UNL Extension" +Manure — poultry (fresh),ag,10,10,10,4,30,HIGHER,"Eghball, UNL Extension" +Manure with litter — horse,ag,30,60,45,0.89,-16.67,LOWER,"Eghball, UNL Extension" +Manure with litter — poultry,ag,13,18,15.5,2.58,8.71,LOWER,"Eghball, UNL Extension" +Newspaper,wood,400,800,600,0.07,-29,LOWER,"Rynk, NC State Extension" +"Newspaper, shredded",wood,400,800,600,0.07,-29,LOWER,"Eghball, UNL Extension" +Paper,wood,150,200,175,0.23,-26.57,LOWER,"Eghball, UNL Extension" +Pine needles,yard,80,80,80,0.5,-22.5,LOWER,"Eghball, UNL Extension" +Poultry litter,ag,5,20,12.5,3.2,18,LOWER,"Rynk, NC State Extension" +Sawdust and wood chips,wood,100,500,300,0.13,-28,LOWER,"Eghball, UNL Extension" +Straw,ag,40,100,70,0.57,-21.43,LOWER,"Rynk, NC State Extension" +Straw — oats and wheat,ag,70,80,75,0.53,-22,LOWER,"Eghball, UNL Extension" +Swine manure,ag,8,20,14,2.86,12.86,LOWER,"Rynk, NC State Extension" +Vegetable waste,food,10,20,15,2.67,10,LOWER,"Rynk, NC State Extension" +Vegetable waste,food,12,20,16,2.5,7.5,LOWER,"Eghball, UNL Extension" +Woodchips,wood,100,500,300,0.13,-28,LOWER,"Rynk, NC State Extension" From 3f7592e15a971115510ab84cafeed64d2deb7763 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 75/97] add harmonized ca_organic_amendment_app_rate csv --- .../ca_organic_amendment_app_rate.csv | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 modules/data.land/data-raw/ca_organic_amendment_app_rate.csv diff --git a/modules/data.land/data-raw/ca_organic_amendment_app_rate.csv b/modules/data.land/data-raw/ca_organic_amendment_app_rate.csv new file mode 100644 index 0000000000..cd5b9e22fb --- /dev/null +++ b/modules/data.land/data-raw/ca_organic_amendment_app_rate.csv @@ -0,0 +1,65 @@ +material,crop_structure,app_rate_min,app_rate_max,total_n_min_lbs_acre,total_n_max_lbs_acre,source,total_n_min_g_m2,total_n_max_g_m2 +Alfalfa hay,rows,8000,10600,246.15,326.15,"Eghball, UNL Extension",27.59,36.556 +Alfalfa hay,trees,8000,10600,246.15,326.15,"Eghball, UNL Extension",27.59,36.556 +Apple pomace,rows,8000,10600,152.38,201.9,"Eghball, UNL Extension",17.079,22.63 +Apple pomace,trees,8000,10600,152.38,201.9,"Eghball, UNL Extension",17.079,22.63 +Bark,rows,8000,10600,27.83,36.87,"Eghball, UNL Extension",3.119,4.133 +Bark,trees,8000,10600,27.83,36.87,"Eghball, UNL Extension",3.119,4.133 +Blood meal,rows,4400,7200,440,720,"Eghball, UNL Extension",49.317,80.701 +Blood meal,trees,3000,5800,300,580,"Eghball, UNL Extension",33.625,65.009 +Coffee grounds,rows,8000,10600,160,212,"Eghball, UNL Extension",17.934,23.762 +Coffee grounds,trees,8000,10600,160,212,"Eghball, UNL Extension",17.934,23.762 +Corn cobs,rows,8000,10600,37.65,49.88,"Eghball, UNL Extension",4.22,5.591 +Corn cobs,trees,8000,10600,37.65,49.88,"Eghball, UNL Extension",4.22,5.591 +Corn stalks,rows,8000,10600,49.23,65.23,"Rynk, NC State Extension",5.518,7.311 +Corn stalks,rows,8000,10600,40,53,"Eghball, UNL Extension",4.483,5.94 +Corn stalks,trees,8000,10600,49.23,65.23,"Rynk, NC State Extension",5.518,7.311 +Corn stalks,trees,8000,10600,40,53,"Eghball, UNL Extension",4.483,5.94 +Cow manure,rows,8000,10600,142.22,188.44,"Rynk, NC State Extension",15.941,21.121 +Cow manure,rows,8000,10600,160,212,"Eghball, UNL Extension",17.934,23.762 +Cow manure,trees,8000,10600,142.22,188.44,"Rynk, NC State Extension",15.941,21.121 +Cow manure,trees,8000,10600,160,212,"Eghball, UNL Extension",17.934,23.762 +Dry leaves,rows,8000,10600,58.18,77.09,"Rynk, NC State Extension",6.521,8.641 +Dry leaves,trees,8000,10600,58.18,77.09,"Rynk, NC State Extension",6.521,8.641 +Fruit waste,rows,8000,10600,91.43,121.14,"Eghball, UNL Extension",10.248,13.578 +Fruit waste,trees,8000,10600,91.43,121.14,"Eghball, UNL Extension",10.248,13.578 +Grass,rows,8000,10600,172.97,229.19,"Rynk, NC State Extension",19.387,25.689 +Grass,trees,8000,10600,172.97,229.19,"Rynk, NC State Extension",19.387,25.689 +Grass clippings,rows,8000,10600,172.97,229.19,"Eghball, UNL Extension",19.387,25.689 +Grass clippings,trees,8000,10600,172.97,229.19,"Eghball, UNL Extension",19.387,25.689 +Horse manure,rows,8000,10600,128,169.6,"Rynk, NC State Extension",14.347,19.01 +Horse manure,trees,8000,10600,128,169.6,"Rynk, NC State Extension",14.347,19.01 +Leaves,rows,8000,10600,53.33,70.67,"Eghball, UNL Extension",5.977,7.921 +Leaves,trees,8000,10600,53.33,70.67,"Eghball, UNL Extension",5.977,7.921 +Manure with litter — horse,rows,8000,10600,71.11,94.22,"Eghball, UNL Extension",7.97,10.561 +Manure with litter — horse,trees,8000,10600,71.11,94.22,"Eghball, UNL Extension",7.97,10.561 +Manure with litter — poultry,rows,8000,10600,206.45,273.55,"Eghball, UNL Extension",23.14,30.661 +Manure with litter — poultry,trees,8000,10600,206.45,273.55,"Eghball, UNL Extension",23.14,30.661 +Manure — cow and horse,rows,8000,10600,142.22,188.44,"Eghball, UNL Extension",15.941,21.121 +Manure — cow and horse,trees,8000,10600,142.22,188.44,"Eghball, UNL Extension",15.941,21.121 +Manure — poultry (fresh),rows,4400,7200,176,288,"Eghball, UNL Extension",19.727,32.28 +Manure — poultry (fresh),trees,3000,5800,120,232,"Eghball, UNL Extension",13.45,26.004 +Newspaper,rows,8000,10600,5.33,7.07,"Rynk, NC State Extension",0.597,0.792 +Newspaper,trees,8000,10600,5.33,7.07,"Rynk, NC State Extension",0.597,0.792 +"Newspaper, shredded",rows,8000,10600,5.33,7.07,"Eghball, UNL Extension",0.597,0.792 +"Newspaper, shredded",trees,8000,10600,5.33,7.07,"Eghball, UNL Extension",0.597,0.792 +Paper,rows,8000,10600,18.29,24.23,"Eghball, UNL Extension",2.05,2.716 +Paper,trees,8000,10600,18.29,24.23,"Eghball, UNL Extension",2.05,2.716 +Pine needles,rows,8000,10600,40,53,"Eghball, UNL Extension",4.483,5.94 +Pine needles,trees,8000,10600,40,53,"Eghball, UNL Extension",4.483,5.94 +Poultry litter,rows,8000,10600,256,339.2,"Rynk, NC State Extension",28.694,38.019 +Poultry litter,trees,8000,10600,256,339.2,"Rynk, NC State Extension",28.694,38.019 +Sawdust and wood chips,rows,8000,10600,10.67,14.13,"Eghball, UNL Extension",1.196,1.584 +Sawdust and wood chips,trees,8000,10600,10.67,14.13,"Eghball, UNL Extension",1.196,1.584 +Straw,rows,8000,10600,45.71,60.57,"Rynk, NC State Extension",5.123,6.789 +Straw,trees,8000,10600,45.71,60.57,"Rynk, NC State Extension",5.123,6.789 +Straw — oats and wheat,rows,8000,10600,42.67,56.53,"Eghball, UNL Extension",4.783,6.336 +Straw — oats and wheat,trees,8000,10600,42.67,56.53,"Eghball, UNL Extension",4.783,6.336 +Swine manure,rows,8000,10600,228.57,302.86,"Rynk, NC State Extension",25.619,33.946 +Swine manure,trees,8000,10600,228.57,302.86,"Rynk, NC State Extension",25.619,33.946 +Vegetable waste,rows,8000,10600,213.33,282.67,"Rynk, NC State Extension",23.911,31.683 +Vegetable waste,rows,8000,10600,200,265,"Eghball, UNL Extension",22.417,29.702 +Vegetable waste,trees,8000,10600,213.33,282.67,"Rynk, NC State Extension",23.911,31.683 +Vegetable waste,trees,8000,10600,200,265,"Eghball, UNL Extension",22.417,29.702 +Woodchips,rows,8000,10600,10.67,14.13,"Rynk, NC State Extension",1.196,1.584 +Woodchips,trees,8000,10600,10.67,14.13,"Rynk, NC State Extension",1.196,1.584 From 37a7245937d608b00784a6fc10e850db05260463 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 76/97] add create script for ca_n_application_rate --- .../data.land/data-raw/create_ca_n_application_rate.R | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 modules/data.land/data-raw/create_ca_n_application_rate.R diff --git a/modules/data.land/data-raw/create_ca_n_application_rate.R b/modules/data.land/data-raw/create_ca_n_application_rate.R new file mode 100644 index 0000000000..87308b3822 --- /dev/null +++ b/modules/data.land/data-raw/create_ca_n_application_rate.R @@ -0,0 +1,10 @@ +#!/usr/bin/env Rscript + +# Build ca_n_application_rate from the harmonized CSV in this folder + +ca_n_application_rate <- readr::read_csv( + file.path("data-raw", "ca_n_application_rate.csv"), + show_col_types = FALSE +) + +usethis::use_data(ca_n_application_rate, overwrite = TRUE) From 3fcaab0c251fb6bc10c0a6d922fca23cc1efa9ff Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 77/97] add create script for organic amendment tables --- .../data-raw/create_ca_organic_amendment.R | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 modules/data.land/data-raw/create_ca_organic_amendment.R diff --git a/modules/data.land/data-raw/create_ca_organic_amendment.R b/modules/data.land/data-raw/create_ca_organic_amendment.R new file mode 100644 index 0000000000..4b01743831 --- /dev/null +++ b/modules/data.land/data-raw/create_ca_organic_amendment.R @@ -0,0 +1,17 @@ +#!/usr/bin/env Rscript + +# Build ca_organic_amendment_properties and ca_organic_amendment_app_rate +# from the harmonized CSVs in this folder + +ca_organic_amendment_properties <- readr::read_csv( + file.path("data-raw", "ca_organic_amendment_properties.csv"), + show_col_types = FALSE +) + +ca_organic_amendment_app_rate <- readr::read_csv( + file.path("data-raw", "ca_organic_amendment_app_rate.csv"), + show_col_types = FALSE +) + +usethis::use_data(ca_organic_amendment_properties, overwrite = TRUE) +usethis::use_data(ca_organic_amendment_app_rate, overwrite = TRUE) From 702cf07eed040b6f437458be4e8560c7b88b0e02 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 78/97] build ca_organic_amendment_properties rda --- .../data/ca_organic_amendment_properties.rda | Bin 0 -> 1407 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_organic_amendment_properties.rda diff --git a/modules/data.land/data/ca_organic_amendment_properties.rda b/modules/data.land/data/ca_organic_amendment_properties.rda new file mode 100644 index 0000000000000000000000000000000000000000..2377807fa17d85966aaedca56019329761cf86be GIT binary patch literal 1407 zcmV-_1%UcOT4*^jL0KkKS*Gxd1ONtbfB*mg&DG_1-*^A-|KKVgrOlBP#SF}hMQ69Jx@q^LugGJdI&Tb82|<*fH9~v88q5} z+L{_P^xC2fm?oJROpHx5z)T5%6A7jOn3*sDBN2cRk)eV#$kQg68L3lhr-agE$i&l4 zG->JvjTnH$XaE2hjDW!a8W{ip02(04f@zV2$i&l31i+X9Fq&WqiIV^VF&F_E8WP;S=~3DY=t6P|vJ-2N5~>;yzNY-FY1Dk7$~Xjv%Tngg4SXQe${ zy6QEw??Nx5^LRSZ!8xrzhZ{IL{7JY_(lnml>W=F-CYo({V9yW&1QTbVR4|RR{8SK_ zqoiRd3mqXwXyd6&GvE!fUks#lFGYCN!kXuc9R?9h!kd7Iw2LsH!qQ0=f&gq17y?F_ zwqJ~r4m1Raw3`4*VWz|h7Brd$k|5}w0D>$MZ3AdPjTVr>h#}4VmzvTf8!u346t`>; zQVjtHm0+xbCAfZf;FOX@b-^V&+dB;qiwiNU71n4Nfrvu}^-Zi+(9=~dEp;(l=%e10 z>TAHIMG_Qv zV;dR>ErDv{c7ry$xlKMAEiCFRG-)c$Gfh0wKzF)B6p&Q)&9P=iCO^FE6i4s_>3aQQQ z%D5RS04B<0oQkfrh#Q^$=|u=+442UaTFdi-A)!ZK6*MU%ih&xA@NZ!-cc!_FrcTyG zvWiBMT}&$BzZg<)&EtZq^<~E|0U~4p03}^kiF@!8Gim@c^w`r)=WJD!5t&-Zaq%M4 zEjdfnkMdhC?x9Uua* zz@ioyBnYgyrkQThnM9&1z+#Fbo4%mxW?-HIMZf`QMCC{j>Y^CLeU)G&6@JtvvuHCl zSI4lk5b_}jST#57IMq!& Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 79/97] build ca_organic_amendment_app_rate rda --- .../data/ca_organic_amendment_app_rate.rda | Bin 0 -> 2121 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 modules/data.land/data/ca_organic_amendment_app_rate.rda diff --git a/modules/data.land/data/ca_organic_amendment_app_rate.rda b/modules/data.land/data/ca_organic_amendment_app_rate.rda new file mode 100644 index 0000000000000000000000000000000000000000..1deabd87c5ed022ec71885a5cfffffe4ac7da755 GIT binary patch literal 2121 zcmV-P2)6e^T4*^jL0KkKS&=V*ivS6t|NsC0|NsC0`~Uy{|JVQj|Nr~z+{dl;{Z;+{ zUb?&Q`zhcEUjP6Dga7~l0096114e)VF%1m{jQ{`u(?BvZG{_AGLj(gr0iXte0ia|6 zXaE2MKw z^pWVujWb4qF$^OJ(8VyrvJsOWB%u_O+D0-fw z)XhfJY3e^oq}phoshX#wQ_U&0Jg2GT$Y~y?L(@_1Q$Wp3#XU!RAo%K%EQ9(LByJJ#em7~4v+CSSe(kMwVe&CwotsyEwUtwG zbVx2m5^prF-C=ANL{&tK*DWND+l%0O7he;V?4s(FyX(}2sw6T_3T*k_FHvyf)_ZxT zh>is$XWtB2FVD$L_7vZ7qdjLMA#6bAf-#)yR{3P-4Q| z4Sfr+(5pbjGp%;jR%qn5Dz%kLrTM#@FDluzt}m_~uB)sH!XA ztz`gd)RhVmpOVOo^+?U&ES!ojR76f$NfebzBaO{C)A`l!KhnH=N|eGTF{Mc6nrjrP z8dR>lurm^opgFfZ$Wz1`#LmRW9fRsDQh44?N|drNPO*iQNT(_G+-1pnCxWqO?s{jg z|0OP9sxWzd^5xU$r^GuYi_fFxJ;U2^)k3KiRaB~ql~SaoQYyXDM>vs4k8c zWAYv9mUO*JM^cE{uTK-pJMGrL-ueod&oNF%g0G2j?}~fGr%hsg$MtWOggZ4Snd+*^ z`PA*72(+KF`{(d3PSNn^&w0XQ$LAWn zzNqoU1gaTLW;A5QZis=z1?aWFl0Y&Qu&Tug$Bo1_bxYf7g$v+CQogDy05WkhC`0x2 zIf|tt>4V=PyaFK4GLaY~w33!eQwtpBg54%uvQ7ylgaP9sApmfcA&f{t z038L_FRRsyGdlU5em!e6*I|<#t!+DF$8FthI2J<+ktI|Tr;6BkWzONGv-XNP)Q$tc zWicNKi07_Z@=+alA9X&%uFAyvuKD9VyV0pt`uUY(JGBF@Q7uOal@ zcbpqUj88QYw|1@b?FJKQ({9%v*m_9*Z4`^!wt_}g?5s2}L}BH&<_H7_=MI(#{?r;b~P&e7VP+3s*73O-ADFG>SG&!)J)R=-4KET>c~JlH^8ocIme> zO%pRK_sxsHdmBZqH9e(QIY)8AM?p4e&h+@1=Rm2TMypV>RlQP<#lyLKP4zW4YuPN6 z-8UN?$;?}AD{z)Ab&E=}mPpFMki?h`CL<$q>KL2(L}@ZJ+va-UU+0yJJ3I=?w5qC# zQrT@%YSh`BSLIZ5WTGbCVd_3Bv>Wrp8RRJ}A*YB7;*!z2Bg`B>8Q zk(@`hR-~S}rza0Y!H{#ylP${GQsm8x8l;kHC5y)AfsHZjn2hBw@lr5=uyy}oRE-rT znw$@rD=NvSk<2`|& zyCJq19V$lEKc@RSmlH z(0Xn%E@Mhnn`F67MJ3?d7pFo8>6<0WPRS!`p0bG4`%66s+@C#4uaj@T(e%jVqp@fC z!^wUjcfdFfjOEWTI$iv#{145hm6c_@6^YO?Gku>q9{KbR5>HjsyrZ&kPmL3;b4jB- zMG|QmPr`RB-20Gn@5XRnG3q;s))I5i<8$q)r1bt;y5p{H2`8>Sf3HJGZs>^VS}?>t5mNa+S}pN%f8TIwSC-lkA-9guwhq z1swa>dk3U>r^`CGvXeOPT&IM7Ob5+tV|M7PuQ-ui$68H$P#X1J= literal 0 HcmV?d00001 From b5aa883c5b1dcd3a9298152173f4a15c40050c3b Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:19:24 -0400 Subject: [PATCH 80/97] rebuild ca_n_application_rate rda from harmonized csv --- .../data.land/data/ca_n_application_rate.rda | Bin 1359 -> 1533 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/modules/data.land/data/ca_n_application_rate.rda b/modules/data.land/data/ca_n_application_rate.rda index 5f8c831da1ac054144d8a5c9937f60916527091c..7caddb972c5a07ce7dc90fd574894268fdeb0036 100644 GIT binary patch literal 1533 zcmVJKV42DdDBTS7NWEwO8 z!5U~W4FC+9888u`(V$3@6Ce{wr=h7HAvP3#sL0W#fEodzw1Koh0B8Y`=uI><&;vjK z0iXZ@JV!41VWbPR%`nq%G$a#|hvG~|L6iXnNCdG>N0?1OY00?nv!$~e4kOmg_X0Do z5U4F^E$wEmdKxrgsYNeez5{bnCHrNVcL?Du4OkxfDHotVF zm;3(#CY}yTbOe}yscXVGJ1ypng}io5d!Qw+X$ZA4R8uk%#vNR0J)OpkxGt~(N(Pbu z8xW3OzYQU8ukH5txI|Nvz>hi7BEJJWCXIxy5>(?Iw`ukcH(sd2;*?Szg>E~}q&7!( zR$0NeSVIFGc!Tw$WtbSpLP2U!if>PaPsiSpT0{~tM80~B*Vgw91R(Y-TE6dL9Pc;~SIO1tlD&1sA+S}t;tmxrI z%3>!ftsX5AGikB+aP?9o4JHwKNys2=v5k$5gB;9;G3aW|m>V?j46)sEnGQE!bOpJI zP$~;$PHC?!vseYvz)%;QYfv%(FRN)Ww24+nUXN#>OrvsF5F)11sk652B6k%0x=M;B zi805EOXv{Xpov0MWtEUx*0coIXC(&TvMIcPU8yy}y6o2AVF9}$157tRAt8-Xz_w}W zSDTUB60NoiN{@aghy-s7?m|Wf+aTMc(AQ$*L1zZhkU)4KlSBvI4Lu(raqY8HZqkXv z2Imwi5sJ98R^G!d6-uKWQ4$hPjyi6F{(u}scsRVJYT*UgOal>_+4ioKFr>`HNXfs6 zj630K4H{=9!=c^nO<-$gT`d3@GwbDRxd+bT^MO_oC2*#p6%izE1;9l(kY6WHN4JEn;qbjc~ zHf(J+E$TVvcu8Aj?8}j0KuFAU>Ov6k0;->175b_*tEC;MfEN2`DwyKpHw=|18jiCH zWQ!MBB1d07KBDcy(w$kc8P;K`MYI!yYcRxvnS#KQrq6H%oV@5QWwK!z0|`cGlA8q9!bLjb5R?w(^5E}KvWVsg#v8Dw?Ab723qVi{N2_@ST^PS0Z)#YKy*Y#hhEN=Gqe)cErKFm zp>ftUhy?+->#2Hti3@cUixCk-#=th1CaTRDgn}?mTqZ@k^v(w->;(u*7Hg7P2@(uw zbd;`Xp)23bvueju7n#))V^vSy?m|BJaIoG3_I^F28Lvo?<1 literal 1359 zcmV-V1+e-;T4*^jL0KkKS>zKgkN^bvfB*mgf8YIo{r~^3|L_0*|KVsVhR(ZSRS{G+ zaEi%=x-ZZKn!VdD#g|CwBLI?78UYhS8ciB#G0$%NBD(Sm5gF*0D1L`j2GY$$qa8&gJV20&;4000kA000dK>Y4xm z0000000}Lo2dyg?3lW*djTSIXID``+u;U%_qo85J=`>L?aKp|xtoQa#J|9?j-w-9N zWv+gg*jEv=(^29~%xA&i5NV`PPy$c|5RycZHwFdDAp}4cC{X-ez(X}OUv*V zCYs$-)>mtJQRPs_xR*HzNZtt|LR^MoVp7P5%mFNjBy7k80|_L0#!9s}49tdR1h8Zw zk<>s5Ax6TL3xj4dOIJO>0xoSd%<)cT6C%xkdns&dQwml@!f_|z1WLI9$|RM_`<5)> zs*@>ucD3yjozYbc$N**1vr4Jb1(I5HfPf;9qqhJZ4O<5hBKRjB@dIruW|DeIn76Q8 z#s{1>pa4Z*UNeVMXE<|Gaai-Kn9`e3SeyaC22(5WI%Yr+UrHdD0Bb@za56w!5u}z9 zxy%w7DFK~}~qZXxZj8Qga>9#$AVjucwf$$>7z z_;Fqx=i|sqIkg?UB;gJN2Yu#Az7dGKk-VcQgoxXxB+x+wg61;KxN?9u%lH`3$8 zl92P_Ubj3>mi$)?BZ{RR-OpT$vdWWzoN=H$AD!(YQEn1SJiI6b{40$UiDuu-smEaM z%>&2_=2gXYTO9^1O54|2h^KC{2hN759f?#w_}I;)1V5A)(THIM(i8Z!bkUi-WxK2$ z_DV$3g)bPr?HG_f2t=@k5e~+|cgQgV>0k>6fB*+kF&agA?-;>STS8Yz6qBBqZkt!C zP4s6oW(9y89OVofvemQ^WWd9K0DLqj38F?$a7R2qB%g6ahyk>H)lMwxfdIfCP%l)U zaWPB1lZzE#P7DJmQiv#K8Px%|L@UabJx#TdMODsOS(q~;GAr^cSU>%l8aXku6sSQv8?`Uec2#^j65FF~j^5~Ez!`E)$ zSS4U?1zGRV3oANs6R?XoSrx6}5GfjQ!0Uej7*sS+hLJMLp%K*z6~e#(AT63$6s7a^*zyKJTZAmXYyihe*g_H5Nw5a`w;7VciXH-XZ$Bq@9w$WF(!sFhX~eNPZBug}xR^B%eLB=Cda&6Cf#d>Juc* zl|lwxGD@XM!xic9Bo>Jn;tXQWyp@z@2qcx28?Wj`5sD3s{;$jM<(M9WP^D332qhAy Rh~t07+>uTcBsm1jqySouJe2?d From c56a21cc9ddd8794feebdb92fe61702f50322cab Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 81/97] rename look_up_ca_compost_amendment to look_up_ca_organic_amendment --- modules/data.land/R/look_up_ca_n_rate.R | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/modules/data.land/R/look_up_ca_n_rate.R b/modules/data.land/R/look_up_ca_n_rate.R index 944bb0a2cc..73579360a3 100644 --- a/modules/data.land/R/look_up_ca_n_rate.R +++ b/modules/data.land/R/look_up_ca_n_rate.R @@ -100,10 +100,12 @@ look_up_ca_n_rate <- function( } -#' Look up California compost amendment properties +#' Look up California organic amendment properties #' #' Returns properties of organic amendment materials including carbon and #' nitrogen content, C:N ratio, and plant-available nitrogen (PAN). +#' Application rates live in +#' \code{\link{ca_organic_amendment_app_rate}}; join on \code{material}. #' #' Matching is case-insensitive. Exact matches are returned directly. #' If no exact match is found, partial matching suggests possible materials. @@ -118,8 +120,7 @@ look_up_ca_n_rate <- function( #' If "mean", rows for the same material are averaged into a single row. #' #' @return A tibble with columns: `material`, `material_class`, -#' `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, -#' `total_n_min_g_m2`, `total_n_max_g_m2`, `source`. +#' `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, `source`. #' Returns an empty tibble (with a warning) if no match is found. #' #' @source Eghball, B. Composting Manure and Other Organic Residues. @@ -131,21 +132,22 @@ look_up_ca_n_rate <- function( #' #' @seealso [look_up_fertilizer_components()] for fertilizer nutrient #' composition (N/C fractions) from the SWAT/DayCent database. -#' [ca_compost_amendment] for the underlying dataset. +#' [ca_organic_amendment_properties] for the underlying dataset. +#' [ca_organic_amendment_app_rate] for the matching application rates. #' #' @examples -#' look_up_ca_compost_amendment("Cow manure") -#' look_up_ca_compost_amendment("Cow manure", aggregate = "mean") -#' look_up_ca_compost_amendment("Poultry litter", n_class = "LOWER") +#' look_up_ca_organic_amendment("Cow manure") +#' look_up_ca_organic_amendment("Cow manure", aggregate = "mean") +#' look_up_ca_organic_amendment("Poultry litter", n_class = "LOWER") #' #' @export -look_up_ca_compost_amendment <- function( +look_up_ca_organic_amendment <- function( material, n_class = NULL, aggregate = c("none", "mean") ) { aggregate <- match.arg(aggregate) - dat <- PEcAn.data.land::ca_compost_amendment + dat <- PEcAn.data.land::ca_organic_amendment_properties if (!is.null(n_class)) { dat <- dat |> @@ -169,14 +171,13 @@ look_up_ca_compost_amendment <- function( ) } else { PEcAn.logger::logger.warn( - "No compost amendment found for material '", material, "'" + "No organic amendment found for material '", material, "'" ) } return(dplyr::tibble( material = character(), material_class = character(), cn_min = numeric(), cn_max = numeric(), cn_avg = numeric(), n_pct = numeric(), pan_pct = numeric(), n_class = character(), - total_n_min_g_m2 = numeric(), total_n_max_g_m2 = numeric(), source = character() )) } @@ -186,14 +187,12 @@ look_up_ca_compost_amendment <- function( "material", "material_class", "cn_min", "cn_max", "cn_avg", "n_pct", "pan_pct", "n_class", - "total_n_min_g_m2", "total_n_max_g_m2", "source" ) if (aggregate == "mean" && nrow(out) > 1) { numeric_cols <- c( - "cn_min", "cn_max", "cn_avg", "n_pct", "pan_pct", - "total_n_min_g_m2", "total_n_max_g_m2" + "cn_min", "cn_max", "cn_avg", "n_pct", "pan_pct" ) out <- out |> dplyr::summarize( From e8752f60ec90e001a4dc126f39e978648fd2ea1d Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 82/97] rewrite dataset docs for split amendment tables --- modules/data.land/R/data.R | 140 ++++++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 58 deletions(-) diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index f4fe662378..975fad76fe 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -209,84 +209,108 @@ #' California recommended N application rates by crop #' -#' Crop-specific recommended nitrogen fertilizer application rates for -#' California agriculture. Contains total-season rates (not per-stage -#' breakdowns). When multiple sources report rates for the same crop, -#' the rate represents the envelope (min of minimums, max of maximums) -#' across sources. -#' -#' @format A tibble with one row per crop and the following columns: +#' Recommended nitrogen fertilizer application rates for California crops. +#' When multiple sources report rates for the same crop the value is the +#' envelope across sources. Crops reported only as within year stages +#' (Barley, Beans, Cauliflower, Melons) have stages summed to an annual +#' total. Crops reported only by age (Almonds) get the envelope across +#' ages. +#' +#' @format A tibble with one row per crop and the columns: #' \describe{ -#' \item{pft_group}{\code{character}. Plant functional type group -#' (e.g. "row", "woody", "rice").} -#' \item{crop}{\code{character}. Crop name as given in the source.} -#' \item{min_n_lbs_acre}{\code{numeric}. Minimum recommended N rate -#' (lbs N/acre).} -#' \item{max_n_lbs_acre}{\code{numeric}. Maximum recommended N rate -#' (lbs N/acre).} -#' \item{source}{\code{character}. Short citation for the source(s). -#' Multiple sources are separated by "; ".} -#' \item{min_n_g_m2}{\code{numeric}. Minimum N rate in SI units -#' (g N/m\eqn{^2}). Conversion: 1 lb/acre = 0.112085 g/m\eqn{^2}.} -#' \item{max_n_g_m2}{\code{numeric}. Maximum N rate in SI units -#' (g N/m\eqn{^2}).} +#' \item{pft_group}{Plant functional type group: \code{"row"}, +#' \code{"woody"}, or \code{"rice"}.} +#' \item{crop}{Crop name as given in the source.} +#' \item{min_n_lbs_acre, max_n_lbs_acre}{Recommended N rate range +#' (lbs N / acre).} +#' \item{source}{Short citation. Multiple sources are joined with +#' \code{"; "}.} +#' \item{min_n_g_m2, max_n_g_m2}{Same range in SI units (g N / m\eqn{^2}).} #' } #' -#' @source Rosenstock, T. S., Liptzin, D., Six, J., & Tomich, T. P. (2013). +#' @source Rosenstock, T. S., Liptzin, D., Six, J., Tomich, T. P. (2013). #' Nitrogen fertilizer use in California: Assessing the data, trends and a -#' way forward. California Agriculture, 67(1). +#' way forward. California Agriculture 67(1). #' \url{https://escholarship.org/uc/item/5mk2q1sm} -#' @source Meyer, R. D., Marcum, D. B., Orloff, S. B., & Schmierer, J. L. +#' @source Meyer, R. D., Marcum, D. B., Orloff, S. B., Schmierer, J. L. #' (2007). Alfalfa fertilization strategies. UC ANR Publication 8296. +#' @source Brown, P. H. et al. (2020). Nitrogen Best Management Practices +#' for Almonds. Almond Board of California. Source for Almonds rates by +#' age. +#' @source Lazicki, P., Geisseler, D., Horwath, W. R. (2016). Potato +#' Production in California. CDFA FREP / UC Davis. Source for Potato. #' -#' @seealso \code{\link{look_up_ca_n_rate}} for looking up rates by crop name. -#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient -#' composition (N/C fractions) from the SWAT/DayCent database. +#' @seealso \code{\link{look_up_ca_n_rate}}. "ca_n_application_rate" -#' California organic amendment (compost) properties +#' California organic amendment properties #' -#' Properties of organic amendment materials used in California agriculture, -#' including C:N ratios, nitrogen content, plant-available nitrogen (PAN), -#' and application rates. Each material is also tagged with the CalRecycle -#' material_class taxonomy (14 CCR section 17852). Some materials appear -#' in multiple rows when values are reported by different sources -#' (e.g. Corn stalks, Cow manure, Vegetable waste). The \code{source} -#' column disambiguates these. +#' Properties of organic amendment materials used in California +#' agriculture: C:N ratio range, total N, plant available N at 4 weeks +#' (PAN), and CalRecycle feedstock class (14 CCR section 17852). +#' Materials reported by more than one source appear once per source; +#' the \code{source} column disambiguates. Application rates live in +#' \code{\link{ca_organic_amendment_app_rate}} and join on +#' \code{material}. #' -#' @format A tibble with 32 rows and the following columns: +#' @format A tibble with 32 rows and the columns: #' \describe{ -#' \item{material}{\code{character}. Amendment material name.} -#' \item{material_class}{\code{character}. CalRecycle taxonomy -#' (14 CCR section 17852): one of green, food, wood, yard, ag, -#' biosolids.} -#' \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio -#' range and average.} -#' \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} -#' \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks -#' (percent). Negative values indicate N immobilization.} -#' \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} -#' \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range -#' (lbs/acre).} -#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. -#' Total nitrogen applied (lbs N/acre).} -#' \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. -#' Total nitrogen in SI units (g N/m\eqn{^2}).} -#' \item{source}{\code{character}. Short citation for the data source.} +#' \item{material}{Material name.} +#' \item{material_class}{CalRecycle feedstock class +#' (14 CCR section 17852): one of \code{"ag"}, \code{"food"}, +#' \code{"green"}, \code{"wood"}, \code{"yard"}, \code{"biosolids"}.} +#' \item{cn_min, cn_max, cn_avg}{C:N ratio range.} +#' \item{n_pct}{Total N (percent of dry mass).} +#' \item{pan_pct}{Plant available N at 4 weeks (percent of total N). +#' Negative values indicate net immobilization.} +#' \item{n_class}{N tier reported in the source (\code{"LOWER"} or +#' \code{"HIGHER"}).} +#' \item{source}{Short citation.} #' } #' #' @source Eghball, B. Composting Manure and Other Organic Residues. -#' University of Nebraska-Lincoln Extension, Publication G2222. +#' University of Nebraska Lincoln Extension, Publication G2222. #' \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} #' @source Rynk, R. (ed.) Compost Production and Use in Sustainable #' Farming Systems. NC State Extension. #' \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} #' -#' @seealso \code{\link{look_up_ca_compost_amendment}} for looking up -#' amendments by material name. -#' \code{\link{look_up_fertilizer_components}} for fertilizer nutrient -#' composition (N/C fractions) from the SWAT/DayCent database. -"ca_compost_amendment" +#' @seealso \code{\link{ca_organic_amendment_app_rate}}. +#' \code{\link{look_up_ca_organic_amendment}}. +"ca_organic_amendment_properties" + +#' California organic amendment application rates +#' +#' Recommended application rates for each material in +#' \code{\link{ca_organic_amendment_properties}}, broken out by crop +#' structure (row crops vs orchards). The two rate sets are identical +#' for most materials in the source, but a handful of N rich materials +#' (Blood meal, poultry manure) differ between row and tree applications. +#' +#' @format A tibble with 64 rows (32 materials x 2 crop structures) and +#' the columns: +#' \describe{ +#' \item{material}{Material name. Joins to +#' \code{\link{ca_organic_amendment_properties}}.} +#' \item{crop_structure}{\code{"rows"} for annual row crops, +#' \code{"trees"} for perennial orchards.} +#' \item{app_rate_min, app_rate_max}{Amendment application rate range +#' (lbs of amendment / acre).} +#' \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total N delivered +#' at those rates (lbs N / acre).} +#' \item{source}{Short citation.} +#' \item{total_n_min_g_m2, total_n_max_g_m2}{Same N range in SI units +#' (g N / m\eqn{^2}).} +#' } +#' +#' @source Eghball, B. Composting Manure and Other Organic Residues. +#' University of Nebraska Lincoln Extension, Publication G2222. +#' @source Rynk, R. (ed.) Compost Production and Use in Sustainable +#' Farming Systems. NC State Extension. +#' +#' @seealso \code{\link{ca_organic_amendment_properties}}. +#' \code{\link{look_up_ca_organic_amendment}}. +"ca_organic_amendment_app_rate" #' Crop-specific rooting depths and water-depletion thresholds #' From db4b6b16d51a02c5d7c7f2fb28232d888ade5951 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 83/97] update exports for renamed lookup function --- modules/data.land/NAMESPACE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/data.land/NAMESPACE b/modules/data.land/NAMESPACE index 1d99ca8e4f..904d787cd6 100644 --- a/modules/data.land/NAMESPACE +++ b/modules/data.land/NAMESPACE @@ -46,8 +46,8 @@ export(get_veg_module) export(ic_process) export(id_resolveable) export(load_veg) -export(look_up_ca_compost_amendment) export(look_up_ca_n_rate) +export(look_up_ca_organic_amendment) export(look_up_fertilizer_components) export(matchInventoryRings) export(match_pft) From d7b4391528217831859a2d6fc2dba059f1b6868d Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 84/97] add doc for ca_organic_amendment_properties --- .../man/ca_organic_amendment_properties.Rd | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 modules/data.land/man/ca_organic_amendment_properties.Rd diff --git a/modules/data.land/man/ca_organic_amendment_properties.Rd b/modules/data.land/man/ca_organic_amendment_properties.Rd new file mode 100644 index 0000000000..64077158c8 --- /dev/null +++ b/modules/data.land/man/ca_organic_amendment_properties.Rd @@ -0,0 +1,48 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_organic_amendment_properties} +\alias{ca_organic_amendment_properties} +\title{California organic amendment properties} +\format{ +A tibble with 32 rows and the columns: +\describe{ + \item{material}{Material name.} + \item{material_class}{CalRecycle feedstock class + (14 CCR section 17852): one of \code{"ag"}, \code{"food"}, + \code{"green"}, \code{"wood"}, \code{"yard"}, \code{"biosolids"}.} + \item{cn_min, cn_max, cn_avg}{C:N ratio range.} + \item{n_pct}{Total N (percent of dry mass).} + \item{pan_pct}{Plant available N at 4 weeks (percent of total N). + Negative values indicate net immobilization.} + \item{n_class}{N tier reported in the source (\code{"LOWER"} or + \code{"HIGHER"}).} + \item{source}{Short citation.} +} +} +\source{ +Eghball, B. Composting Manure and Other Organic Residues. + University of Nebraska Lincoln Extension, Publication G2222. + \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} + +Rynk, R. (ed.) Compost Production and Use in Sustainable + Farming Systems. NC State Extension. + \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} +} +\usage{ +ca_organic_amendment_properties +} +\description{ +Properties of organic amendment materials used in California +agriculture: C:N ratio range, total N, plant available N at 4 weeks +(PAN), and CalRecycle feedstock class (14 CCR section 17852). +Materials reported by more than one source appear once per source; +the \code{source} column disambiguates. Application rates live in +\code{\link{ca_organic_amendment_app_rate}} and join on +\code{material}. +} +\seealso{ +\code{\link{ca_organic_amendment_app_rate}}. + \code{\link{look_up_ca_organic_amendment}}. +} +\keyword{datasets} From 2044ea3f5e4d15657d420e0ad66168591ef8b212 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 85/97] add doc for ca_organic_amendment_app_rate --- .../man/ca_organic_amendment_app_rate.Rd | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/data.land/man/ca_organic_amendment_app_rate.Rd diff --git a/modules/data.land/man/ca_organic_amendment_app_rate.Rd b/modules/data.land/man/ca_organic_amendment_app_rate.Rd new file mode 100644 index 0000000000..03692dc20c --- /dev/null +++ b/modules/data.land/man/ca_organic_amendment_app_rate.Rd @@ -0,0 +1,45 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/data.R +\docType{data} +\name{ca_organic_amendment_app_rate} +\alias{ca_organic_amendment_app_rate} +\title{California organic amendment application rates} +\format{ +A tibble with 64 rows (32 materials x 2 crop structures) and +the columns: +\describe{ + \item{material}{Material name. Joins to + \code{\link{ca_organic_amendment_properties}}.} + \item{crop_structure}{\code{"rows"} for annual row crops, + \code{"trees"} for perennial orchards.} + \item{app_rate_min, app_rate_max}{Amendment application rate range + (lbs of amendment / acre).} + \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{Total N delivered + at those rates (lbs N / acre).} + \item{source}{Short citation.} + \item{total_n_min_g_m2, total_n_max_g_m2}{Same N range in SI units + (g N / m\eqn{^2}).} +} +} +\source{ +Eghball, B. Composting Manure and Other Organic Residues. + University of Nebraska Lincoln Extension, Publication G2222. + +Rynk, R. (ed.) Compost Production and Use in Sustainable + Farming Systems. NC State Extension. +} +\usage{ +ca_organic_amendment_app_rate +} +\description{ +Recommended application rates for each material in +\code{\link{ca_organic_amendment_properties}}, broken out by crop +structure (row crops vs orchards). The two rate sets are identical +for most materials in the source, but a handful of N rich materials +(Blood meal, poultry manure) differ between row and tree applications. +} +\seealso{ +\code{\link{ca_organic_amendment_properties}}. + \code{\link{look_up_ca_organic_amendment}}. +} +\keyword{datasets} From 1a4a05a53bc2f20ce30cadbbb9451fcca812fcb1 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 86/97] add doc for look_up_ca_organic_amendment --- .../man/look_up_ca_organic_amendment.Rd | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 modules/data.land/man/look_up_ca_organic_amendment.Rd diff --git a/modules/data.land/man/look_up_ca_organic_amendment.Rd b/modules/data.land/man/look_up_ca_organic_amendment.Rd new file mode 100644 index 0000000000..8a54784a65 --- /dev/null +++ b/modules/data.land/man/look_up_ca_organic_amendment.Rd @@ -0,0 +1,60 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/look_up_ca_n_rate.R +\name{look_up_ca_organic_amendment} +\alias{look_up_ca_organic_amendment} +\title{Look up California organic amendment properties} +\source{ +Eghball, B. Composting Manure and Other Organic Residues. + University of Nebraska-Lincoln Extension, Publication G2222. + \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} + +Rynk, R. (ed.) Compost Production and Use in Sustainable + Farming Systems. NC State Extension. + \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} +} +\usage{ +look_up_ca_organic_amendment( + material, + n_class = NULL, + aggregate = c("none", "mean") +) +} +\arguments{ +\item{material}{Character string. Amendment material to look up.} + +\item{n_class}{Optional, one of "LOWER" or "HIGHER". Filter by N class.} + +\item{aggregate}{Character, one of "none" (default) or "mean". +If "mean", rows for the same material are averaged into a single row.} +} +\value{ +A tibble with columns: `material`, `material_class`, + `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, `source`. + Returns an empty tibble (with a warning) if no match is found. +} +\description{ +Returns properties of organic amendment materials including carbon and +nitrogen content, C:N ratio, and plant-available nitrogen (PAN). +Application rates live in +\code{\link{ca_organic_amendment_app_rate}}; join on \code{material}. +} +\details{ +Matching is case-insensitive. Exact matches are returned directly. +If no exact match is found, partial matching suggests possible materials. + +Some materials have multiple rows from different sources (e.g. Cow manure, +Vegetable waste). Set `aggregate = "mean"` to collapse these into a +single row per material using the mean of numeric columns. +} +\examples{ +look_up_ca_organic_amendment("Cow manure") +look_up_ca_organic_amendment("Cow manure", aggregate = "mean") +look_up_ca_organic_amendment("Poultry litter", n_class = "LOWER") + +} +\seealso{ +[look_up_fertilizer_components()] for fertilizer nutrient + composition (N/C fractions) from the SWAT/DayCent database. + [ca_organic_amendment_properties] for the underlying dataset. + [ca_organic_amendment_app_rate] for the matching application rates. +} From 95165aafecab03f721cbfc1448ae6abd58614af8 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 87/97] regen doc for ca_n_application_rate --- .../data.land/man/ca_n_application_rate.Rd | 51 ++++++++++--------- 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/modules/data.land/man/ca_n_application_rate.Rd b/modules/data.land/man/ca_n_application_rate.Rd index 8c6b97d6df..99564a4fc5 100644 --- a/modules/data.land/man/ca_n_application_rate.Rd +++ b/modules/data.land/man/ca_n_application_rate.Rd @@ -5,45 +5,46 @@ \alias{ca_n_application_rate} \title{California recommended N application rates by crop} \format{ -A tibble with one row per crop and the following columns: +A tibble with one row per crop and the columns: \describe{ - \item{pft_group}{\code{character}. Plant functional type group - (e.g. "row", "woody", "rice").} - \item{crop}{\code{character}. Crop name as given in the source.} - \item{min_n_lbs_acre}{\code{numeric}. Minimum recommended N rate - (lbs N/acre).} - \item{max_n_lbs_acre}{\code{numeric}. Maximum recommended N rate - (lbs N/acre).} - \item{source}{\code{character}. Short citation for the source(s). - Multiple sources are separated by "; ".} - \item{min_n_g_m2}{\code{numeric}. Minimum N rate in SI units - (g N/m\eqn{^2}). Conversion: 1 lb/acre = 0.112085 g/m\eqn{^2}.} - \item{max_n_g_m2}{\code{numeric}. Maximum N rate in SI units - (g N/m\eqn{^2}).} + \item{pft_group}{Plant functional type group: \code{"row"}, + \code{"woody"}, or \code{"rice"}.} + \item{crop}{Crop name as given in the source.} + \item{min_n_lbs_acre, max_n_lbs_acre}{Recommended N rate range + (lbs N / acre).} + \item{source}{Short citation. Multiple sources are joined with + \code{"; "}.} + \item{min_n_g_m2, max_n_g_m2}{Same range in SI units (g N / m\eqn{^2}).} } } \source{ -Rosenstock, T. S., Liptzin, D., Six, J., & Tomich, T. P. (2013). +Rosenstock, T. S., Liptzin, D., Six, J., Tomich, T. P. (2013). Nitrogen fertilizer use in California: Assessing the data, trends and a - way forward. California Agriculture, 67(1). + way forward. California Agriculture 67(1). \url{https://escholarship.org/uc/item/5mk2q1sm} -Meyer, R. D., Marcum, D. B., Orloff, S. B., & Schmierer, J. L. +Meyer, R. D., Marcum, D. B., Orloff, S. B., Schmierer, J. L. (2007). Alfalfa fertilization strategies. UC ANR Publication 8296. + +Brown, P. H. et al. (2020). Nitrogen Best Management Practices + for Almonds. Almond Board of California. Source for Almonds rates by + age. + +Lazicki, P., Geisseler, D., Horwath, W. R. (2016). Potato + Production in California. CDFA FREP / UC Davis. Source for Potato. } \usage{ ca_n_application_rate } \description{ -Crop-specific recommended nitrogen fertilizer application rates for -California agriculture. Contains total-season rates (not per-stage -breakdowns). When multiple sources report rates for the same crop, -the rate represents the envelope (min of minimums, max of maximums) -across sources. +Recommended nitrogen fertilizer application rates for California crops. +When multiple sources report rates for the same crop the value is the +envelope across sources. Crops reported only as within year stages +(Barley, Beans, Cauliflower, Melons) have stages summed to an annual +total. Crops reported only by age (Almonds) get the envelope across +ages. } \seealso{ -\code{\link{look_up_ca_n_rate}} for looking up rates by crop name. - \code{\link{look_up_fertilizer_components}} for fertilizer nutrient - composition (N/C fractions) from the SWAT/DayCent database. +\code{\link{look_up_ca_n_rate}}. } \keyword{datasets} From 2ad640399902f172f882369ea4835d711767912f Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 88/97] update lookup tests for split tables --- .../tests/testthat/test.look_up_ca_n_rate.R | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R b/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R index defdf87a36..955a3fae67 100644 --- a/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R +++ b/modules/data.land/tests/testthat/test.look_up_ca_n_rate.R @@ -66,10 +66,10 @@ test_that("broccoli has multi-source citation", { expect_true(grepl("CDFA-FREP", result$source)) }) -# look_up_ca_compost_amendment tests +# look_up_ca_organic_amendment tests test_that("exact compost match returns correct properties", { - result <- look_up_ca_compost_amendment("Poultry litter") + result <- look_up_ca_organic_amendment("Poultry litter") expect_equal(nrow(result), 1) expect_equal(result$material, "Poultry litter") expect_equal(result$n_class, "LOWER") @@ -77,7 +77,7 @@ test_that("exact compost match returns correct properties", { }) test_that("duplicate materials return multiple rows", { - result <- look_up_ca_compost_amendment("Cow manure") + result <- look_up_ca_organic_amendment("Cow manure") expect_equal(nrow(result), 2) expect_true(all(result$material == "Cow manure")) expect_equal(sort(result$source), @@ -85,7 +85,7 @@ test_that("duplicate materials return multiple rows", { }) test_that("aggregate = mean collapses duplicate materials", { - result <- look_up_ca_compost_amendment("Cow manure", aggregate = "mean") + result <- look_up_ca_organic_amendment("Cow manure", aggregate = "mean") expect_equal(nrow(result), 1) expect_equal(result$material, "Cow manure") # cn_avg should be mean of 22.5 and 20.0 @@ -96,7 +96,7 @@ test_that("aggregate = mean collapses duplicate materials", { }) test_that("n_class filter works", { - result <- look_up_ca_compost_amendment("Blood meal", n_class = "HIGHER") + result <- look_up_ca_organic_amendment("Blood meal", n_class = "HIGHER") expect_equal(nrow(result), 1) expect_equal(result$n_class, "HIGHER") }) @@ -104,7 +104,7 @@ test_that("n_class filter works", { test_that("no compost match returns empty tibble with correct columns", { level <- PEcAn.logger::logger.getLevel() PEcAn.logger::logger.setLevel("OFF") - result <- look_up_ca_compost_amendment("Unicorn dust") + result <- look_up_ca_organic_amendment("Unicorn dust") PEcAn.logger::logger.setLevel(level) expect_equal(nrow(result), 0) expect_true("source" %in% names(result)) @@ -114,7 +114,7 @@ test_that("no compost match returns empty tibble with correct columns", { test_that("compost partial match suggests materials", { level <- PEcAn.logger::logger.getLevel() PEcAn.logger::logger.setLevel("OFF") - result <- look_up_ca_compost_amendment("manure") + result <- look_up_ca_organic_amendment("manure") PEcAn.logger::logger.setLevel(level) expect_equal(nrow(result), 0) }) @@ -123,14 +123,22 @@ test_that("compost partial match suggests materials", { test_that("ca_n_application_rate dataset has expected structure", { dat <- PEcAn.data.land::ca_n_application_rate - expect_equal(nrow(dat), 41) + expect_equal(nrow(dat), 40) expect_true(all(c("pft_group", "crop", "min_n_lbs_acre", "max_n_lbs_acre", "source", "min_n_g_m2", "max_n_g_m2") %in% names(dat))) }) -test_that("ca_compost_amendment dataset has expected structure", { - dat <- PEcAn.data.land::ca_compost_amendment +test_that("ca_organic_amendment_properties dataset has expected structure", { + dat <- PEcAn.data.land::ca_organic_amendment_properties expect_equal(nrow(dat), 32) expect_true("source" %in% names(dat)) expect_true(all(dat$n_class %in% c("LOWER", "HIGHER"))) }) + +test_that("ca_organic_amendment_app_rate dataset has expected structure", { + dat <- PEcAn.data.land::ca_organic_amendment_app_rate + expect_equal(nrow(dat), 64) + expect_true(all(c("material", "crop_structure", "app_rate_min", + "app_rate_max", "source") %in% names(dat))) + expect_true(all(dat$crop_structure %in% c("rows", "trees"))) +}) From d58ca0942191aa63e49ccb23488fc6e6f78f1ede Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:43 -0400 Subject: [PATCH 89/97] document fertilization datasets in data-raw readme --- modules/data.land/data-raw/README.md | 100 +++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/modules/data.land/data-raw/README.md b/modules/data.land/data-raw/README.md index a5d81ffbd0..1e295e410b 100644 --- a/modules/data.land/data-raw/README.md +++ b/modules/data.land/data-raw/README.md @@ -27,3 +27,103 @@ from which it is lazy-loaded when `soil_class` is used inside package functions. The saved file includes all of `texture.csv`, hence why that lives in `data-raw` rather than directly in `data/`. + + +# California fertilization datasets + +Three datasets for nitrogen management on California crops. Like BADM +above, each one ships as a harmonized CSV in this folder, and its +`create_*.R` script just reads that CSV and writes the `.rda`, nothing +fancy. `ca_n_application_rate` carries recommended N rate ranges for 40 +crops. `ca_organic_amendment_properties` carries the intrinsic +properties of 32 amendment materials (C:N, total N, plant available N at +4 weeks, and the CalRecycle feedstock class). +`ca_organic_amendment_app_rate` carries how much of each material you +put down, 64 rows because every material gets one rate for row crops and +one for orchards. + +The CSVs are not where the work happens. They fall out of +`harmonize_fertilization_data.R`, which lives with the rest of the CCMMF +management workflow under +`/projectnb/dietzelab/ccmmf/management/fertilization/`, outside this +package. That script reads the curated TSV exports of the CCMMF +fertilization spreadsheet, maps the source URLs to short author-year +citations, folds the per-stage N rows into one range per crop, converts +lbs/acre to g/m2 with `PEcAn.utils::ud_convert`, splits the +spreadsheet's wide Rows/Trees layout into the long properties and +app-rate tables, drops a couple of bad columns, and assigns the +`material_class`. Whatever lands in the three CSVs here is what the +package builds from. + +## Where the numbers come from + +The N rates trace back to Rosenstock et al. 2013 (*California +Agriculture* 67(1), doi:10.3733/ca.E.v067n01p68), the CDFA-FREP and UC +Davis fertilization guidelines, Meyer et al. 2007 for alfalfa (UC ANR +pubs 8292 and 8296), Brown et al. 2020 NBMP Table 2 for almonds by age +(Almond Board of California), and Lazicki, Geisseler and Horwath 2016 +for potato (CDFA-FREP / UC Davis). The citation for each crop sits in +its `source` column. The `pft_group` labels (row, woody, rice) come +straight off the spreadsheet, hand-authored rather than mapped from +`cadwr_pfts.csv`, though they follow the same grouping it uses. + +The amendment numbers come from Eghball (UNL Extension G2222) and Rynk +(NC State Extension compost handbook), again cited per row. +`material_class` is the one field we set by hand, slotting each material +into the CalRecycle feedstock taxonomy from 14 CCR 17852. The current 32 +materials only land in four of the classes (ag, food, yard, wood); green +and biosolids are valid classes but nothing here falls in them. + +Everything else is verbatim off the spreadsheet: crop, pft_group, +material, total N, PAN, the C:N range, the N tier, and the raw Rows and +Trees application rates. The pieces we computed or assigned are the +per-crop N range (aggregated as below), the short citation strings, the +`material_class`, the `crop_structure` label, and every g/m2 column +(converted from lbs/acre). + +## How the per-crop N range gets built + +Most crops, 33 of them, report a whole season rate, so we take that +range as is. Six report only by growth stage (Barley, the three Beans, +Cauliflower, Melons), so their within year stages get summed into a +season total. Almonds are the odd one out, reporting by orchard age +across 8 NBMP stages, so there we envelope the low and high across all +ages. Onions drop out, since its only row is a "1/3 of total N at +preplant" note with no rate attached. + +## Fixes we made at the source + +A few things in the spreadsheet were wrong and got fixed upstream before +harmonizing: + +- Dropped `Peach, bell` and `Peach, chili`. Their numbers were + byte for byte copies of `Pepper, bell` and `Pepper, chili`, and the + paper they cite (Rosenstock 2013 Table 2, p. 76) lists no peach-bell + or peach-chili at all. Clearly a copy paste slip. +- Added `Potato` at 189 to 248 lb N/acre from Lazicki, Geisseler and + Horwath 2016. Worth being upfront: Rosenstock 2013 p. 76 says outright + that no UC ANR guideline exists for potato in California, so this is a + grower-reported envelope, not an official guideline. +- Tossed the `Total_C` columns. The spreadsheet built them as + `Total_N * C_assumed` instead of `AppRate * C_assumed`, which is + dimensionally wrong and would feed the model garbage carbon inputs. +- Added the `material_class` column with the 32 hand-assigned CalRecycle + classes. + +One more on the amendment rates: for 30 of the 32 materials the row-crop +and orchard rates match in the spreadsheet, but two N-rich materials +(Blood meal and fresh poultry manure) carry lower rates on trees than on +rows. Splitting into the long app-rate table keeps both rather than +picking one. + +## Updating the data + +1. Edit the source TSV under + `/projectnb/dietzelab/ccmmf/management/fertilization/`. +2. Rerun `harmonize_fertilization_data.R` from that folder. It + overwrites the three `ca_*.csv` files there. +3. Copy those three CSVs into this folder. +4. Rerun `create_ca_n_application_rate.R` and + `create_ca_organic_amendment.R`. +5. Bump the package version, add a `NEWS.md` line, and regenerate the + man pages with `devtools::document()`. From 6b95f43bfee2764ff6b897d894214f9aed9b0844 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 90/97] add news entries for ca fertilization datasets --- modules/data.land/NEWS.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/data.land/NEWS.md b/modules/data.land/NEWS.md index 50e809553a..ed1dfdf635 100644 --- a/modules/data.land/NEWS.md +++ b/modules/data.land/NEWS.md @@ -12,11 +12,12 @@ * Datasets * `landiq_crop_mapping_codes` dataset mapping LandIQ crop classification codes to human-readable crop names. * `bism_kc_by_crop` dataset containing BISm crop coefficient schedules and stage timing references for use in ET estimation, including columns that map to LandIQ class and subclass. - * `ca_n_application_rate` dataset with recommended N application rates (g N/m2) for 41 California crops from CDFA-FREP and UC ANR sources. - * `ca_compost_amendment` dataset with C:N ratios, nitrogen, and PAN (g/m2) for 32 organic amendment materials, plus a `material_class` column mapping each material to the CalRecycle taxonomy (14 CCR section 17852). + * `ca_n_application_rate` dataset with recommended N application rates (g N/m2) for 40 California crops from CDFA-FREP, UC ANR, Rosenstock 2013, Brown 2020 NBMP (Almonds age stages) and Lazicki 2016 (Potato) sources. + * `ca_organic_amendment_properties` dataset with C:N ratios, nitrogen, and PAN for 32 organic amendment materials, plus a `material_class` column mapping each material to the CalRecycle taxonomy (14 CCR section 17852). + * `ca_organic_amendment_app_rate` dataset with row-crop and orchard application rate envelopes (64 rows = 32 materials x 2 crop structures) that joins to `ca_organic_amendment_properties` on `material`. * Functions * `look_up_ca_n_rate()` for looking up crop-specific N application rates by name (exact match first, partial match suggestions on miss). - * `look_up_ca_compost_amendment()` for looking up organic amendment properties by material name. + * `look_up_ca_organic_amendment()` for looking up organic amendment properties by material name. * `to_co2e()` for converting SOC change, CH4, and N2O to CO2-equivalent emissions using IPCC Global Warming Potential values. ## Changed From 7d7ae2f500ceed7cc9eaf62f7faedff431bcb89e Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 91/97] drop raw compost tsv superseded by harmonized csv --- modules/data.land/data-raw/compost.tsv | 33 -------------------------- 1 file changed, 33 deletions(-) delete mode 100644 modules/data.land/data-raw/compost.tsv diff --git a/modules/data.land/data-raw/compost.tsv b/modules/data.land/data-raw/compost.tsv deleted file mode 100644 index 32f38f419c..0000000000 --- a/modules/data.land/data-raw/compost.tsv +++ /dev/null @@ -1,33 +0,0 @@ -Material C_MIN (C:N) C_MAX (C:N) C_Avg (C:N) C_Assumed (%) Total N (%) 4 week PAN (%) LowerN/HigherN RowsMIN_AppRate (tons/acre) RowsMIN_AppRate (lbs/acre) RowsMIN_Total_N (lbs N/acre) RowsMIN_Avail_N (lbs N/acre) RowsMIN_Total_C (lbs C/acre) RowsMAX_AppRate (tons/acre) RowsMAX_AppRate (lbs/acre) RowsMAX_Total_N (lbs N/acre) RowsMAX_Avail_N (lbs N/acre) RowsMAX_Total_C (lbs C/acre) TreesMIN_AppRate (tons/acre) TreesMIN_AppRate (lbs/acre) TreesMIN_Total_N (lbs N/acre) TreesMIN_Avail_N (lbs N/acre) TreesMIN_Total_C (lbs C/acre) TreesMAX_AppRate (tons/acre) TreesMAX_AppRate (lbs/acre) TreesMAX_Total_N (lbs N/acre) TreesMAX_Avail_N (lbs N/acre) TreesMAX_Total_C (lbs C/acre) Source -Alfalfa hay 13.00 13.00 13.00 40.00% 3.08 16.15 LOWER 4.00 8000.00 246.15 39.76 98.46 5.30 10600.00 326.15 52.69 130.46 4.00 8000.00 246.15 39.76 98.46 5.30 10600.00 326.15 52.69 130.46 Eghball, UNL Extension -Apple pomace 21.00 21.00 21.00 40.00% 1.90 -1.43 LOWER 4.00 8000.00 152.38 -2.18 60.95 5.30 10600.00 201.90 -2.88 80.76 4.00 8000.00 152.38 -2.18 60.95 5.30 10600.00 201.90 -2.88 80.76 Eghball, UNL Extension -Bark 100.00 130.00 115.00 40.00% 0.35 -24.78 LOWER 4.00 8000.00 27.83 -6.90 11.13 5.30 10600.00 36.87 -9.14 14.75 4.00 8000.00 27.83 -6.90 11.13 5.30 10600.00 36.87 -9.14 14.75 Eghball, UNL Extension -Blood meal 4.00 4.00 4.00 40.00% 10.00 60.00 HIGHER 2.20 4400.00 440.00 264.00 176.00 3.60 7200.00 720.00 432.00 288.00 1.50 3000.00 300.00 180.00 120.00 2.90 5800.00 580.00 348.00 232.00 Eghball, UNL Extension -Coffee grounds 20.00 20.00 20.00 40.00% 2.00 0.00 LOWER 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 Eghball, UNL Extension -Corn cobs 50.00 120.00 85.00 40.00% 0.47 -22.94 LOWER 4.00 8000.00 37.65 -8.64 15.06 5.30 10600.00 49.88 -11.44 19.95 4.00 8000.00 37.65 -8.64 15.06 5.30 10600.00 49.88 -11.44 19.95 Eghball, UNL Extension -Corn stalks 60.00 70.00 65.00 40.00% 0.62 -20.77 LOWER 4.00 8000.00 49.23 -10.22 19.69 5.30 10600.00 65.23 -13.55 26.09 4.00 8000.00 49.23 -10.22 19.69 5.30 10600.00 65.23 -13.55 26.09 Rynk, NC State Extension -Corn stalks 80.00 80.00 80.00 40.00% 0.50 -22.50 LOWER 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 Eghball, UNL Extension -Cow manure 20.00 25.00 22.50 40.00% 1.78 -3.33 LOWER 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 Rynk, NC State Extension -Cow manure 20.00 20.00 20.00 40.00% 2.00 0.00 LOWER 4.00 8000.00 160.00 246.15 64.00 5.30 10600.00 212.00 0.00 84.80 4.00 8000.00 160.00 0.00 64.00 5.30 10600.00 212.00 0.00 84.80 Eghball, UNL Extension -Dry leaves 30.00 80.00 55.00 40.00% 0.73 -19.09 LOWER 4.00 8000.00 58.18 -11.11 23.27 5.30 10600.00 77.09 -14.72 30.84 4.00 8000.00 58.18 -11.11 23.27 5.30 10600.00 77.09 -14.72 30.84 Rynk, NC State Extension -Fruit waste 35.00 35.00 35.00 40.00% 1.14 -12.86 LOWER 4.00 8000.00 91.43 -11.76 36.57 5.30 10600.00 121.14 -15.58 48.46 4.00 8000.00 91.43 -11.76 36.57 5.30 10600.00 121.14 -15.58 48.46 Eghball, UNL Extension -Grass 12.00 25.00 18.50 40.00% 2.16 2.43 LOWER 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 Rynk, NC State Extension -Grass clippings 12.00 25.00 18.50 40.00% 2.16 2.43 LOWER 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 4.00 8000.00 172.97 4.21 69.19 5.30 10600.00 229.19 5.57 91.68 Eghball, UNL Extension -Horse manure 20.00 30.00 25.00 40.00% 1.60 -6.00 LOWER 4.00 8000.00 128.00 -7.68 51.20 5.30 10600.00 169.60 -10.18 67.84 4.00 8000.00 128.00 -7.68 51.20 5.30 10600.00 169.60 -10.18 67.84 Rynk, NC State Extension -Leaves 40.00 80.00 60.00 40.00% 0.67 -20.00 LOWER 4.00 8000.00 53.33 -10.67 21.33 5.30 10600.00 70.67 -14.13 28.27 4.00 8000.00 53.33 -10.67 21.33 5.30 10600.00 70.67 -14.13 28.27 Eghball, UNL Extension -Manure — cow and horse 20.00 25.00 22.50 40.00% 1.78 -3.33 LOWER 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 4.00 8000.00 142.22 -4.74 56.89 5.30 10600.00 188.44 -6.28 75.38 Eghball, UNL Extension -Manure — poultry (fresh) 10.00 10.00 10.00 40.00% 4.00 30.00 HIGHER 2.20 4400.00 176.00 52.80 70.40 3.60 7200.00 288.00 86.40 115.20 1.50 3000.00 120.00 36.00 48.00 2.90 5800.00 232.00 69.60 92.80 Eghball, UNL Extension -Manure with litter — horse 30.00 60.00 45.00 40.00% 0.89 -16.67 LOWER 4.00 8000.00 71.11 -11.85 28.44 5.30 10600.00 94.22 -15.70 37.69 4.00 8000.00 71.11 -11.85 28.44 5.30 10600.00 94.22 -15.70 37.69 Eghball, UNL Extension -Manure with litter — poultry 13.00 18.00 15.50 40.00% 2.58 8.71 LOWER 4.00 8000.00 206.45 17.98 82.58 5.30 10600.00 273.55 23.83 109.42 4.00 8000.00 206.45 17.98 82.58 5.30 10600.00 273.55 23.83 109.42 Eghball, UNL Extension -Newspaper 400.00 800.00 600.00 40.00% 0.07 -29.00 LOWER 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 Rynk, NC State Extension -Newspaper, shredded 400.00 800.00 600.00 40.00% 0.07 -29.00 LOWER 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 4.00 8000.00 5.33 -1.55 2.13 5.30 10600.00 7.07 -2.05 2.83 Eghball, UNL Extension -Paper 150.00 200.00 175.00 40.00% 0.23 -26.57 LOWER 4.00 8000.00 18.29 -4.86 7.31 5.30 10600.00 24.23 -6.44 9.69 4.00 8000.00 18.29 -4.86 7.31 5.30 10600.00 24.23 -6.44 9.69 Eghball, UNL Extension -Pine needles 80.00 80.00 80.00 40.00% 0.50 -22.50 LOWER 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 4.00 8000.00 40.00 -9.00 16.00 5.30 10600.00 53.00 -11.93 21.20 Eghball, UNL Extension -Poultry litter 5.00 20.00 12.50 40.00% 3.20 18.00 LOWER 4.00 8000.00 256.00 46.08 102.40 5.30 10600.00 339.20 61.06 135.68 4.00 8000.00 256.00 46.08 102.40 5.30 10600.00 339.20 61.06 135.68 Rynk, NC State Extension -Sawdust and wood chips 100.00 500.00 300.00 40.00% 0.13 -28.00 LOWER 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 Eghball, UNL Extension -Straw 40.00 100.00 70.00 40.00% 0.57 -21.43 LOWER 4.00 8000.00 45.71 -9.80 18.29 5.30 10600.00 60.57 -12.98 24.23 4.00 8000.00 45.71 -9.80 18.29 5.30 10600.00 60.57 -12.98 24.23 Rynk, NC State Extension -Straw — oats and wheat 70.00 80.00 75.00 40.00% 0.53 -22.00 LOWER 4.00 8000.00 42.67 -9.39 17.07 5.30 10600.00 56.53 -12.44 22.61 4.00 8000.00 42.67 -9.39 17.07 5.30 10600.00 56.53 -12.44 22.61 Eghball, UNL Extension -Swine manure 8.00 20.00 14.00 40.00% 2.86 12.86 LOWER 4.00 8000.00 228.57 29.39 91.43 5.30 10600.00 302.86 38.94 121.14 4.00 8000.00 228.57 29.39 91.43 5.30 10600.00 302.86 38.94 121.14 Rynk, NC State Extension -Vegetable waste 10.00 20.00 15.00 40.00% 2.67 10.00 LOWER 4.00 8000.00 213.33 21.33 85.33 5.30 10600.00 282.67 28.27 113.07 4.00 8000.00 213.33 21.33 85.33 5.30 10600.00 282.67 28.27 113.07 Rynk, NC State Extension -Vegetable waste 12.00 20.00 16.00 40.00% 2.50 7.50 LOWER 4.00 8000.00 200.00 15.00 80.00 5.30 10600.00 265.00 19.88 106.00 4.00 8000.00 200.00 15.00 80.00 5.30 10600.00 265.00 19.88 106.00 Eghball, UNL Extension -Woodchips 100.00 500.00 300.00 40.00% 0.13 -28.00 LOWER 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 4.00 8000.00 10.67 -2.99 4.27 5.30 10600.00 14.13 -3.96 5.65 Rynk, NC State Extension \ No newline at end of file From 5d60c92cacf2b4b79792c540cdb5531e19245c59 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 92/97] drop raw n fertilization tsv superseded by harmonized csv --- .../data.land/data-raw/n_fertilization.tsv | 90 ------------------- 1 file changed, 90 deletions(-) delete mode 100644 modules/data.land/data-raw/n_fertilization.tsv diff --git a/modules/data.land/data-raw/n_fertilization.tsv b/modules/data.land/data-raw/n_fertilization.tsv deleted file mode 100644 index 29d81a9a28..0000000000 --- a/modules/data.land/data-raw/n_fertilization.tsv +++ /dev/null @@ -1,90 +0,0 @@ -PFT Group Crop PlantStage Season MINN MAXN Unit Source Notes -row Alfalfa starter 20 40 lbs N/acre CDFA-FREP & UC Davis when the residual nitrate concentration is below 3-4 ppm NO3-N (15 ppm NO3) -row Alfalfa 0 0 lbs N/acre Meyer et al. 2007. Pub. 8292 From Meyer et al 2007 ""Seldom: Less than 1% of the acreage shows need for fertilization."" -woody Almonds year 1 30 30 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds year 2 55 55 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds year 3 116 116 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds year 4 174 174 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds year 5 232 232 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds year 6 237 237 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds years 7-15 210 255 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Almonds years 16-25 152 220 lbs N/acre Brown et al. 2020 NBMP Table 2 -woody Avocado 67 100 lbs N/acre Rosenstock et al., 2013 -row Barley preplant fall 25 100 lbs N/acre CDFA-FREP & UC Davis -row Barley starter 0 30 lbs N/acre CDFA-FREP & UC Davis -row Barley topdress spring 30 100 lbs N/acre CDFA-FREP & UC Davis -row Barley foliar 10 20 lbs N/acre CDFA-FREP & UC Davis -row Bean, blackeye preplant 0 0 lbs N/acre CDFA-FREP & UC Davis -row Bean, blackeye starter 0 8 lbs N/acre CDFA-FREP & UC Davis small amount -row Bean, blackeye sidedress 0 0 lbs N/acre CDFA-FREP & UC Davis -row Bean, common preplant 200 lbs N/acre CDFA-FREP & UC Davis -row Bean, common sidedress 70 100 lbs N/acre CDFA-FREP & UC Davis -row Bean, dry 86 116 lbs N/acre Rosenstock et al., 2013 -row Bean, dry foliar 0 0 lbs N/acre CDFA-FREP & UC Davis -row Bean, lima starter 0 8 lbs N/acre CDFA-FREP & UC Davis -row Bean, lima preplant 100 lbs N/acre CDFA-FREP & UC Davis -row Bean, lima sidedress 55 125 lbs N/acre CDFA-FREP & UC Davis -row Broccoli 100 200 lbs N/acre Rosenstock et al., 2013 -row Broccoli preplant 20 30 lbs N/acre CDFA-FREP & UC Davis -row Broccoli starter 20 30 lbs N/acre CDFA-FREP & UC Davis -row Broccoli winter 180 240 lbs N/acre CDFA-FREP & UC Davis -row Broccoli spring 180 240 lbs N/acre CDFA-FREP & UC Davis -row Broccoli summer 150 180 lbs N/acre CDFA-FREP & UC Davis -row Broccoli fall 150 180 lbs N/acre CDFA-FREP & UC Davis -row Carrot 100 250 lbs N/acre Rosenstock et al., 2013 -row Carrot preplant 40 50 lbs N/acre CDFA-FREP & UC Davis -row Carrot sidedress 60 80 lbs N/acre CDFA-FREP & UC Davis -row Carrot in-season 150 lbs N/acre CDFA-FREP & UC Davis -row Cauliflower preplant 20 30 lbs N/acre CDFA-FREP & UC Davis -row Cauliflower preplant fall 0 0 lbs N/acre CDFA-FREP & UC Davis -row Cauliflower starter 20 30 lbs N/acre CDFA-FREP & UC Davis -row Celery 200 275 lbs N/acre Rosenstock et al., 2013 -row Celery preplant 20 30 lbs N/acre CDFA-FREP & UC Davis -row Celery starter 20 30 lbs N/acre CDFA-FREP & UC Davis -row Corn 150 275 lbs N/acre Rosenstock et al., 2013 -row Corn preplant 200 275 lbs N/acre CDFA-FREP & UC Davis -row Corn starter 10 60 lbs N/acre CDFA-FREP & UC Davis -row Corn sidedress 180 216 lbs N/acre CDFA-FREP & UC Davis -row Corn foliar 0 0 lbs N/acre CDFA-FREP & UC Davis -row Corn, sweet 100 200 lbs N/acre Rosenstock et al., 2013 -row Cotton 100 200 lbs N/acre Rosenstock et al., 2013 -row Cotton preplant 0 0 lbs N/acre CDFA-FREP & UC Davis -row Cotton starter 5 35 lbs N/acre CDFA-FREP & UC Davis -row Cotton sidedress 55 200 lbs N/acre CDFA-FREP & UC Davis -row Cotton foliar 18 30 lbs N/acre CDFA-FREP & UC Davis *total spead over three applications -woody Grape, raisin 20 60 lbs N/acre Rosenstock et al., 2013 -woody Grapevines after budbreak until fruit set OR post-harvest spring 0 60 lbs N/acre Meyer et al. 2007. Pub. 8295 raisin production; dependent on vine ""vigor"" and soil* wine grapes may have lower N* -woody Grapevines 20 60 lbs N/acre Meyer et al. 2007. Pub. 8296 raisin -row Lettuce 170 220 lbs N/acre Rosenstock et al., 2013 -row Lettuce preplant 20 40 lbs N/acre CDFA-FREP & UC Davis dependent on residual N concentration in soil (less than 20 ppm indicates no preplant N amendment) -row Lettuce starter 0 0 lbs N/acre CDFA-FREP & UC Davis dependent on residual N concentration in soil (less than 20 ppm indicates no preplant N amendment) -row Lettuce sidedress winter 150 180 lbs N/acre CDFA-FREP & UC Davis -row Lettuce sidedress spring 150 180 lbs N/acre CDFA-FREP & UC Davis -row Lettuce sidedress fall 100 140 lbs N/acre CDFA-FREP & UC Davis -row Lettuce sidedress summer 100 140 lbs N/acre CDFA-FREP & UC Davis -row Melon, cantaloupe 80 150 lbs N/acre Rosenstock et al., 2013 -row Melon, watermelon 160 lbs N/acre Rosenstock et al., 2013 -row Melons preplant 0 50 lbs N/acre CDFA-FREP & UC Davis -row Melons sidedress 80 150 lbs N/acre CDFA-FREP & UC Davis -row Melons (mixed) 100 150 lbs N/acre Rosenstock et al., 2013 -woody Nectarine 100 150 lbs N/acre Rosenstock et al., 2013 -row Oats 50 120 lbs N/acre Rosenstock et al., 2013 -row Onion 100 400 lbs N/acre Rosenstock et al., 2013 -row Onions preplant lbs N/acre CDFA-FREP & UC Davis 1/3 of total N at preplant -woody Peach, bell 180 240 lbs N/acre Rosenstock et al., 2013 -woody Peach, chili 150 200 lbs N/acre Rosenstock et al., 2013 -woody Peach, cling 50 100 lbs N/acre Rosenstock et al., 2013 -woody Peach, free 50 100 lbs N/acre Rosenstock et al., 2013 -row Pepper, bell 180 240 lbs N/acre Rosenstock et al., 2013 -row Pepper, chili 150 200 lbs N/acre Rosenstock et al., 2013 -woody Pistachios 100 225 lbs N/acre Rosenstock et al., 2013 -woody Plums, dried 100 lbs N/acre Rosenstock et al., 2013 -woody Plums, fresh 110 150 lbs N/acre Rosenstock et al., 2013 -row Potato preplant lbs N/acre CDFA-FREP & UC Davis 2/3-3/4 should be applied pre-plant -rice Rice 110 145 lbs N/acre Rosenstock et al., 2013 -row Safflower 100 150 lbs N/acre Rosenstock et al., 2013 -row Strawberry 150 300 lbs N/acre Rosenstock et al., 2013 -row Tomatoes, fresh market 125 350 lbs N/acre Rosenstock et al., 2013 -row Tomatoes, processing 100 150 lbs N/acre Rosenstock et al., 2013 -woody Walnuts 150 200 lbs N/acre Rosenstock et al., 2013 -row Wheat 100 240 lbs N/acre Rosenstock et al., 2013 From 24f9212c5dd3651ee6090ceac478dbd667814d6e Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 93/97] drop old compost build script --- .../data.land/data-raw/create_compost_data.R | 62 ------------------- 1 file changed, 62 deletions(-) delete mode 100644 modules/data.land/data-raw/create_compost_data.R diff --git a/modules/data.land/data-raw/create_compost_data.R b/modules/data.land/data-raw/create_compost_data.R deleted file mode 100644 index e9e004281e..0000000000 --- a/modules/data.land/data-raw/create_compost_data.R +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env Rscript -# -# builds the ca_compost_amendment packaged dataset from the raw -# compost TSV that ships in data-raw/. renames columns into the -# snake_case schema we expose downstream and adds the CalRecycle -# material_class taxonomy (14 CCR section 17852). - -raw_path <- file.path("data-raw", "compost.tsv") - -# map each raw material name to one of the CalRecycle classes -# (14 CCR section 17852). biosolids is empty in the current table. -material_to_class <- function(m) { - s <- tolower(m) - dplyr::case_when( - grepl("grass", s) ~ "green", - grepl("manure|alfalfa|blood|poultry|corn cob|corn stalk", s) ~ "ag", - grepl("apple|coffee|fruit|vegetable", s) ~ "food", - grepl("bark|sawdust|woodchip|newspaper|paper", s) ~ "wood", - grepl("leaf|leaves|pine needle|straw", s) ~ "yard", - TRUE ~ NA_character_ - ) -} - -PEcAn.logger::logger.info("Reading raw compost TSV: ", raw_path) -raw <- readr::read_tsv(raw_path, show_col_types = FALSE) - -ca_compost_amendment <- raw |> - dplyr::transmute( - material = .data$Material, - material_class = material_to_class(.data$Material), - cn_min = .data$`C_MIN (C:N)`, - cn_max = .data$`C_MAX (C:N)`, - cn_avg = .data$`C_Avg (C:N)`, - n_pct = as.numeric(.data$`Total N (%)`), - pan_pct = as.numeric(.data$`4 week PAN (%)`), - n_class = .data$`LowerN/HigherN`, - app_rate_min = .data$`RowsMIN_AppRate (lbs/acre)`, - app_rate_max = .data$`RowsMAX_AppRate (lbs/acre)`, - total_n_min_lbs_acre = .data$`RowsMIN_Total_N (lbs N/acre)`, - total_n_max_lbs_acre = .data$`RowsMAX_Total_N (lbs N/acre)`, - total_n_min_g_m2 = round( - PEcAn.utils::ud_convert(.data$total_n_min_lbs_acre, "lb/acre", "g/m^2"), 3), - total_n_max_g_m2 = round( - PEcAn.utils::ud_convert(.data$total_n_max_lbs_acre, "lb/acre", "g/m^2"), 3), - source = trimws(.data$Source) - ) - -unclassified <- ca_compost_amendment |> - dplyr::filter(is.na(.data$material_class)) |> - dplyr::pull(.data$material) |> - unique() -if (length(unclassified) > 0) { - PEcAn.logger::logger.warn(sprintf( - "Unclassified materials: %s", - paste(unclassified, collapse = ", ") - )) -} - -PEcAn.logger::logger.info(sprintf( - "Harmonized %d compost materials", nrow(ca_compost_amendment))) - -usethis::use_data(ca_compost_amendment, overwrite = TRUE) From b7ee992728edbc65731cc7c5cb526c01e3fb0c88 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 94/97] drop old n rate build script --- .../data.land/data-raw/create_n_rate_data.R | 130 ------------------ 1 file changed, 130 deletions(-) delete mode 100644 modules/data.land/data-raw/create_n_rate_data.R diff --git a/modules/data.land/data-raw/create_n_rate_data.R b/modules/data.land/data-raw/create_n_rate_data.R deleted file mode 100644 index 808da4f8d4..0000000000 --- a/modules/data.land/data-raw/create_n_rate_data.R +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env Rscript -# -# Build the ca_n_application_rate packaged dataset from the raw -# fertilization TSV that ships in data-raw/. Classifies each row by -# stage, sums within year stage rows for crops that lack a total season -# row, and writes the packaged .rda via usethis::use_data. - -raw_path <- file.path("data-raw", "n_fertilization.tsv") - -# stages whose rows sum to an annual total for the same crop. other stage -# tags (e.g. "first season", "first leaf trees") describe year conditional -# rates and get treated as separate years. -WITHIN_YEAR_STAGES <- c( - "preplant", "starter", "starter ", "sidedress", - "topdress", "foliar", "in-season" -) - -PEcAn.logger::logger.info("Reading raw fertilization TSV: ", raw_path) -raw <- readr::read_tsv(raw_path, show_col_types = FALSE) |> - dplyr::select( - pft_group = "PFT Group", - crop = "Crop", - stage = "PlantStage", - min_n = "MINN", - max_n = "MAXN", - unit = "Unit", - source = "Source" - ) - -# drop rows where both min and max are NA. onions and potato in the -# current raw fall into this case and end up flagged below. -usable <- raw |> - dplyr::filter(!is.na(.data$min_n) | !is.na(.data$max_n)) |> - dplyr::mutate( - min_n = dplyr::coalesce(.data$min_n, 0), - max_n = dplyr::coalesce(.data$max_n, .data$min_n) - ) - -# all rows in the current raw TSV are in lbs N per acre. classify by -# stage so per-stage rows can be aggregated to an annual total when no -# total-season row is available. -all_lb <- usable |> - dplyr::filter(.data$unit == "lbs N/acre") |> - dplyr::mutate( - row_kind = dplyr::case_when( - is.na(.data$stage) | .data$stage == "" ~ "total", - tolower(.data$stage) %in% .env$WITHIN_YEAR_STAGES ~ "within_year", - TRUE ~ "year_conditional" - ) - ) - -## pick an aggregation strategy per crop. if a total season row exists, -## use it (envelope across total rows). otherwise sum within year stages -## to get an annual total, or envelope across year conditional rows. this -## is the fix that recovers crops the old script silently dropped. -strategy <- all_lb |> - dplyr::summarize( - strategy = dplyr::case_when( - any(.data$row_kind == "total") ~ "envelope_total", - any(.data$row_kind == "within_year") ~ "sum_stages", - any(.data$row_kind == "year_conditional") ~ "envelope_year", - TRUE ~ "drop" - ), - .by = c(pft_group, crop) - ) - -envelope_total <- all_lb |> - dplyr::semi_join( - strategy |> dplyr::filter(.data$strategy == "envelope_total"), - by = c("pft_group", "crop") - ) |> - dplyr::filter(.data$row_kind == "total") |> - dplyr::summarize( - min_n_lbs_acre = min(.data$min_n), - max_n_lbs_acre = max(.data$max_n), - source = paste(unique(.data$source), collapse = "; "), - .by = c(pft_group, crop) - ) - -sum_stages <- all_lb |> - dplyr::semi_join( - strategy |> dplyr::filter(.data$strategy == "sum_stages"), - by = c("pft_group", "crop") - ) |> - dplyr::filter(.data$row_kind == "within_year") |> - dplyr::summarize( - min_n_lbs_acre = sum(.data$min_n), - max_n_lbs_acre = sum(.data$max_n), - source = paste(unique(.data$source), collapse = "; "), - .by = c(pft_group, crop) - ) - -envelope_year <- all_lb |> - dplyr::semi_join( - strategy |> dplyr::filter(.data$strategy == "envelope_year"), - by = c("pft_group", "crop") - ) |> - dplyr::filter(.data$row_kind == "year_conditional") |> - dplyr::summarize( - min_n_lbs_acre = min(.data$min_n), - max_n_lbs_acre = max(.data$max_n), - source = paste(unique(.data$source), collapse = "; "), - .by = c(pft_group, crop) - ) - -ca_n_application_rate <- dplyr::bind_rows(envelope_total, sum_stages, envelope_year) |> - dplyr::mutate( - min_n_g_m2 = round( - PEcAn.utils::ud_convert(.data$min_n_lbs_acre, "lb/acre", "g/m^2"), 3), - max_n_g_m2 = round( - PEcAn.utils::ud_convert(.data$max_n_lbs_acre, "lb/acre", "g/m^2"), 3) - ) |> - dplyr::arrange(.data$pft_group, .data$crop) - -PEcAn.logger::logger.info(sprintf( - "Harmonized %d crops", nrow(ca_n_application_rate))) - -# flag crops whose raw rows had NA for both MINN and MAXN. -raw_crops <- unique(raw$crop) -out_crops <- unique(ca_n_application_rate$crop) -dropped <- setdiff(raw_crops, out_crops) -if (length(dropped) > 0) { - PEcAn.logger::logger.warn( - "Crops dropped (no usable rate data in raw spreadsheet): ", - paste(dropped, collapse = ", "), - ". Their raw rows have NA for both MINN and MAXN." - ) -} - -usethis::use_data(ca_n_application_rate, overwrite = TRUE) From 84cda6f360225c74a03773c1cf32b1357c343609 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 95/97] drop ca_compost_amendment rda replaced by split tables --- modules/data.land/data/ca_compost_amendment.rda | Bin 2052 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 modules/data.land/data/ca_compost_amendment.rda diff --git a/modules/data.land/data/ca_compost_amendment.rda b/modules/data.land/data/ca_compost_amendment.rda deleted file mode 100644 index 7c4c483203c1153c58a513692df0bc4a065c6af0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2052 zcmZ9Fdpy$(8^(V#W@a;|#zwQ*a*T#0c?g4atKkD=DWBDvg#gw72>>t!0MHN|05AY104c{n zC?x)BGF-gsKR8Tgqw9d7RShtiYxDoXk^k$g_OBH(w7CGNV6_y(V4{KE)eEqT7XZkw z#%m0%{R7|`ssLaKkO8n~J{YIHngdMns!#OgyQIladb&U*RG%R)uQwNl>*rH)4!hP@ z&4byjsv17FCc_I&mcd<%>}&Gata-A8ZOOzI4`UE@3&m`#fYmz6Br}ijVfH?*pEb88 z;qrDl7+A!a+35OZM}bc#|;A00BrS2my_oouruK`dA%4Xffklb?-)q{0V?Z^sw8{#L2-& zP`^sPAI9TR*IPzyslZdx zn|7pdnNxcyv04K&j*h1iDazc@@&le(3G3B%eoX(MaV(nWOnSX&6I*Vn;6DFM-)X5U zHTsDA@=!-vfecIkjl6?dr<)=rrqn;&6?gK!f+F!BL@sS`%bQq>*85~>_$xwa!BBpq zYm3xLr>F6mpN=6^*#0KoIxystGyEtsrokpcr;;;QF$sFS`NL8`rzu1)FVP6PV?HCQ zaOA8rv}l`~{NEcNNV3PC>78Dl6=o8nt}p$>j^Je{t|@(}&$`hS;X#5y@@JulYg2?D zMz8#M`r!daR~+6OhQQ^^d`rNKhK_U9i8w8eVG-JTozx`CWRqKY*Sb z;^tuY~uGd!fRPmPJ|#9?uhmBGJLOMrlt;9RV^6PC!bevkpLg3{)&Uqw0muMhpn&E;aWy~*t0waAL~ z-%3f{8*WoKaaA}kWhjHB+o0~5c+>v9=&$|wq1g~g`)i;)FYK>TrDuUr3y>UWbKyxnY zfltwq4yzl<=HE_;ZS0iqITv;8iP0g^vnI#b7fgfjma?a3n`h`TvE-a6H(s6cKc-<5 zgJYW+V;X(L;5s0QsKG!E26{(U?oxAmy!`? zQ=Stxgz4h#rtTj~aM2j(D+674V56bm@Ku!Jp(WPDUe}{KLk~ozG-?rdu?!#9xEmAb zDc3f9ZerD|OdZ5E8b%c=mEG@5cS~${pVLp*%s<^iz5;9b?%@+&NCZ)^nI#)hO%0)4 z>YtikGJw9ZYh_!6^DMfnSA;iQvYRCeBBWWN_8KS9dLA)6b!&p(ohcrl`y^Js>`@CyQiKh6F^cT({tOc z^lOuj=N*FOPz|0D6kXZwC1%~A6hT1jmx0lESdNzUV7hcu_t3}!;(YLu39nYB`<|2NmM_#Fi6%?z3|zT0rH%>WD! z?=I@-sb){u^I~Y7shsDMJDbA~UitoaYQFTG&B;B~$zzBs#+U6+!UyZ-IlSBg-4#WE z<065!$Uj=XC~!&6_9af+4hM;0L$yrT@9QW+NvUKQ+?Ob4c736XhuR#evltVEG{UR> z+g*&1<*D_;_%UaCI)x7U3i2oz`AL)m(WkgFrxf1M-9Rz*Q;$^wwU);J`?5{Mq~!Xx zxKHn8?6!NawH>X%WjT2)LStx-3|y0krv6W>8HF76UZ;={WZCCTCl3N6Q~)K0#XDT? e%`(T+E6jk)%81@@xvm! Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 96/97] drop doc for ca_compost_amendment --- modules/data.land/man/ca_compost_amendment.Rd | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 modules/data.land/man/ca_compost_amendment.Rd diff --git a/modules/data.land/man/ca_compost_amendment.Rd b/modules/data.land/man/ca_compost_amendment.Rd deleted file mode 100644 index ed0d7b546c..0000000000 --- a/modules/data.land/man/ca_compost_amendment.Rd +++ /dev/null @@ -1,56 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/data.R -\docType{data} -\name{ca_compost_amendment} -\alias{ca_compost_amendment} -\title{California organic amendment (compost) properties} -\format{ -A tibble with 32 rows and the following columns: -\describe{ - \item{material}{\code{character}. Amendment material name.} - \item{material_class}{\code{character}. CalRecycle taxonomy - (14 CCR section 17852): one of green, food, wood, yard, ag, - biosolids.} - \item{cn_min, cn_max, cn_avg}{\code{numeric}. Carbon-to-nitrogen ratio - range and average.} - \item{n_pct}{\code{numeric}. Total nitrogen content (percent).} - \item{pan_pct}{\code{numeric}. Plant-available nitrogen after 4 weeks - (percent). Negative values indicate N immobilization.} - \item{n_class}{\code{character}. "LOWER" or "HIGHER" N content class.} - \item{app_rate_min, app_rate_max}{\code{numeric}. Application rate range - (lbs/acre).} - \item{total_n_min_lbs_acre, total_n_max_lbs_acre}{\code{numeric}. - Total nitrogen applied (lbs N/acre).} - \item{total_n_min_g_m2, total_n_max_g_m2}{\code{numeric}. - Total nitrogen in SI units (g N/m\eqn{^2}).} - \item{source}{\code{character}. Short citation for the data source.} -} -} -\source{ -Eghball, B. Composting Manure and Other Organic Residues. - University of Nebraska-Lincoln Extension, Publication G2222. - \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} - -Rynk, R. (ed.) Compost Production and Use in Sustainable - Farming Systems. NC State Extension. - \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} -} -\usage{ -ca_compost_amendment -} -\description{ -Properties of organic amendment materials used in California agriculture, -including C:N ratios, nitrogen content, plant-available nitrogen (PAN), -and application rates. Each material is also tagged with the CalRecycle -material_class taxonomy (14 CCR section 17852). Some materials appear -in multiple rows when values are reported by different sources -(e.g. Corn stalks, Cow manure, Vegetable waste). The \code{source} -column disambiguates these. -} -\seealso{ -\code{\link{look_up_ca_compost_amendment}} for looking up - amendments by material name. - \code{\link{look_up_fertilizer_components}} for fertilizer nutrient - composition (N/C fractions) from the SWAT/DayCent database. -} -\keyword{datasets} From a9e4e10ff6bd571199c54f6a3599f1cffe071504 Mon Sep 17 00:00:00 2001 From: divne7022 Date: Tue, 9 Jun 2026 17:20:44 -0400 Subject: [PATCH 97/97] drop doc for look_up_ca_compost_amendment --- .../man/look_up_ca_compost_amendment.Rd | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 modules/data.land/man/look_up_ca_compost_amendment.Rd diff --git a/modules/data.land/man/look_up_ca_compost_amendment.Rd b/modules/data.land/man/look_up_ca_compost_amendment.Rd deleted file mode 100644 index aa940af064..0000000000 --- a/modules/data.land/man/look_up_ca_compost_amendment.Rd +++ /dev/null @@ -1,58 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/look_up_ca_n_rate.R -\name{look_up_ca_compost_amendment} -\alias{look_up_ca_compost_amendment} -\title{Look up California compost amendment properties} -\source{ -Eghball, B. Composting Manure and Other Organic Residues. - University of Nebraska-Lincoln Extension, Publication G2222. - \url{https://extensionpubs.unl.edu/publication/g2222/na/html/view} - -Rynk, R. (ed.) Compost Production and Use in Sustainable - Farming Systems. NC State Extension. - \url{https://content.ces.ncsu.edu/compost-production-and-use-in-sustainable-farming-systems} -} -\usage{ -look_up_ca_compost_amendment( - material, - n_class = NULL, - aggregate = c("none", "mean") -) -} -\arguments{ -\item{material}{Character string. Amendment material to look up.} - -\item{n_class}{Optional, one of "LOWER" or "HIGHER". Filter by N class.} - -\item{aggregate}{Character, one of "none" (default) or "mean". -If "mean", rows for the same material are averaged into a single row.} -} -\value{ -A tibble with columns: `material`, `material_class`, - `cn_min`, `cn_max`, `cn_avg`, `n_pct`, `pan_pct`, `n_class`, - `total_n_min_g_m2`, `total_n_max_g_m2`, `source`. - Returns an empty tibble (with a warning) if no match is found. -} -\description{ -Returns properties of organic amendment materials including carbon and -nitrogen content, C:N ratio, and plant-available nitrogen (PAN). -} -\details{ -Matching is case-insensitive. Exact matches are returned directly. -If no exact match is found, partial matching suggests possible materials. - -Some materials have multiple rows from different sources (e.g. Cow manure, -Vegetable waste). Set `aggregate = "mean"` to collapse these into a -single row per material using the mean of numeric columns. -} -\examples{ -look_up_ca_compost_amendment("Cow manure") -look_up_ca_compost_amendment("Cow manure", aggregate = "mean") -look_up_ca_compost_amendment("Poultry litter", n_class = "LOWER") - -} -\seealso{ -[look_up_fertilizer_components()] for fertilizer nutrient - composition (N/C fractions) from the SWAT/DayCent database. - [ca_compost_amendment] for the underlying dataset. -}