Skip to content

add ca fertilization harmonization and ncc compost support#4002

Open
divine7022 wants to merge 36 commits into
PecanProject:developfrom
divine7022:ncc-compost
Open

add ca fertilization harmonization and ncc compost support#4002
divine7022 wants to merge 36 commits into
PecanProject:developfrom
divine7022:ncc-compost

Conversation

@divine7022
Copy link
Copy Markdown
Member

@divine7022 divine7022 commented May 18, 2026

Description

folds standalone N fertilization harmonization (was living at /projectnb/dietzelab/ccmmf/management/fertilization/harmonization.R) into data.land data-raw pipeline, then layers ncc (compost) sampling support on top and extends the events schema with an ncc event type

events_schema_v0.1.2.json picks up ncc as an allowed event_type with material, ncc_subtype, fert_subtype, and pft properties

separate workflow PR will consume these samplers from workflows/fertilization-statewide and workflows/ncc-statewide to emit ensemble events

cc @sarahkanee @mdietze @infotroph @dlebauer

Motivation and Context

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Copy Markdown
Member

@dlebauer dlebauer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Posting a few comments as a partial review.

#' @format A tibble with one row:
#' \describe{
#' \item{a, b}{Lower and upper truncation bounds.}
#' \item{mean, sd}{Untruncated mean and standard deviation.}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#' \item{mean, sd}{Untruncated mean and standard deviation.}
#' \item{mean, sd}{Mean and standard deviation of the underlying normal
#' distribution.}

# 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where are the full citations? at a minimum, please include [author, year, DOI] where available or [author, year, title, url] if no DOI.

A few questions come up:

  1. Using truncnorm for compost %C and %N distributions? The truncated normal imposes hard discontinuities at a and b. For %C and %N, a Beta might be easier to justify because it is supported in the range [0,1]. Then, for the C:N ratios, one option is to sample from the Betas and calculate the ratio. Another is to directly set a Gamma prior on C:N.
  2. Should these opinionated priors be bundled into the data.land package? I don't have a strong opinion but note that these are distinct from the reference datasets that we usually include to support specific functions. Other options include keeping these in a CCMMF repository, putting these in betydb priors table, or computing these distributions on the fly from the actual numbers in the underlying datasets so that all assumptions are clear.

Comment on lines +13 to +14
"/projectnb/dietzelab/ccmmf/usr/akash/management/fertilization",
"CCMMF Fertilization - Compost.tsv"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid

  • hard coded paths
  • file names with spaces

#' 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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤯 plz use PEcAn.utils::ud_convert for such transformations! Hard coded conversions are error prone.

Also, I would suggest quarantining imperial units and not supporting them in PEcAn; i.e. the conversion can be done within the data ingest functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants