Skip to contents

Reads a (JSON) management events file and finds the planting events at which the site changes from from one crop to another, ignoring repeat plantings of the same crop. These are the dates when single-PFT models will need to restart to update their crop parameterization.

Usage

events_to_crop_cycle_starts(event_json)

Arguments

event_json

path to an `events.json` file

Value

data frame with columns `site_id`, `date`, `crop`, with one row per detected crop cycle.

Details

TODO: For now this function requires each planting event to specify a `crop` attribute, but note that this is not enforced by v0.1 of the PEcAn events schema. The schema instead allows each site object to specify a site-level `PFT` attribute that is implied constant over time. As I write this I think the schema may need to change to require a crop or PFT identifier be specified for every planting event.

Author

Chris Black

Examples

# Not currently runnable because file does not list crop in planting events.
# Revisit after deciding if schema update is warranted.
if (FALSE) { # \dontrun{
evts <- system.file(
  "events_fixtures/events_site1_site2.json",
  package = "PEcAn.data.land"
)
events_to_crop_cycle_starts(evts)
} # }