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. diff --git a/modules/data.land/R/data.R b/modules/data.land/R/data.R index 34f5c931c7..f4fe662378 100644 --- a/modules/data.land/R/data.R +++ b/modules/data.land/R/data.R @@ -247,29 +247,29 @@ #' 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{ #' \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{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.} 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" 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 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 85db72542b..0000000000 --- a/modules/data.land/data-raw/compost_amendments.csv +++ /dev/null @@ -1,33 +0,0 @@ -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" diff --git a/modules/data.land/data-raw/create_compost_data.R b/modules/data.land/data-raw/create_compost_data.R index 24055aa5f9..e9e004281e 100644 --- a/modules/data.land/data-raw/create_compost_data.R +++ b/modules/data.land/data-raw/create_compost_data.R @@ -1,31 +1,62 @@ #!/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). -# Build the ca_compost_amendment packaged dataset from the harmonized -# compost CSV produced by the fertilization harmonization script. +raw_path <- file.path("data-raw", "compost.tsv") -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() +# 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) 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..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,21 +1,130 @@ #!/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. -# 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() - ) +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) 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 f733617ab9..0000000000 --- a/modules/data.land/data-raw/n_application_rates.csv +++ /dev/null @@ -1,34 +0,0 @@ -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 -row,"Bean, dry",86,116,"Rosenstock et al., 2013",9.639,13.002 -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,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 (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 -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 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 diff --git a/modules/data.land/data/ca_compost_amendment.rda b/modules/data.land/data/ca_compost_amendment.rda index 9cf0091038..7c4c483203 100644 Binary files a/modules/data.land/data/ca_compost_amendment.rda and b/modules/data.land/data/ca_compost_amendment.rda differ diff --git a/modules/data.land/data/ca_n_application_rate.rda b/modules/data.land/data/ca_n_application_rate.rda index 9f93108526..5f8c831da1 100644 Binary files a/modules/data.land/data/ca_n_application_rate.rda and b/modules/data.land/data/ca_n_application_rate.rda differ diff --git a/modules/data.land/man/ca_compost_amendment.Rd b/modules/data.land/man/ca_compost_amendment.Rd index d9e8fda9ff..ed0d7b546c 100644 --- a/modules/data.land/man/ca_compost_amendment.Rd +++ b/modules/data.land/man/ca_compost_amendment.Rd @@ -8,21 +8,19 @@ 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{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.} @@ -42,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 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. } 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))) })