Extract the first planting date of each crop cycle
Source:R/events_to_crop_cycle_starts.R
events_to_crop_cycle_starts.RdReads 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.
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.
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)
} # }