assets/analytics.html

Skip to contents

This function runs the Phenomenals phenology model by passing weather data and phenological observations (BBCH) directly from R to the underlying C# executable. Users do not need to manage configuration files or binaries manually. All paths and execution logic are handled internally, and only core calibration settings are exposed.

Usage

phenologyCalibration(
  weather_data,
  referenceBBCH,
  phenomenalsParameters,
  start_year = 2000,
  end_year = 2025,
  sites = "all",
  varieties = "all",
  iterations = 100,
  timestep = "daily"
)

Arguments

weather_data

A data frame containing hourly weather data. Must include the following columns: Latitude, Longitude, DateTime (as POSIXct or character), Temperature (°C), Precipitation (mm), RelativeHumidity (%), Radiation (MJ/m²), and WindSpeed (m/s).

referenceBBCH

A data frame containing BBCH phenological observations. Must include: Variety, Site, Latitude, Longitude, Date, BBCH

phenomenalsParameters

A nested list of model parameters (usually loaded from phenomenals::phenomenalsParameters), structured as list[species][[class]][[parameter]], where each parameter is a list with:

  • min: Minimum calibration value (numeric)

  • max: Maximum calibration value (numeric)

  • value: Default value used in simulation (numeric)

  • calibration: Logical; TRUE if the parameter is subject to calibration

You can start with phenomenals::phenomenalsParameters and modify it as needed. This list will be automatically converted to the CSV format required by the C# executable.

start_year

The first year of the simulation or calibration period (default is 2000).

end_year

The last year of the simulation or calibration period (default is 2025).

sites

A character vector of site names (e.g., "ColliOrientali"). Defaults to "site1" if not provided.

varieties

A character vector of variety names to include in the calibration (default: "all").

iterations

Number of iterations for each simplex (default: 100).

timestep

Time step of the input weather data; must be "hourly" (default) or "daily".

Value

A named list of data frames containing model outputs, loaded from the output CSV files generated by the Phenomenals executable. The names of the list entries correspond to the output file names (without .csv).

Examples

if (FALSE) { # \dontrun{
result <- phenologyCalibration(
  weather_data = colliOrientali,
  referenceBBCH = bbchSample,
  phenomenalsParameters,
  start_year = 2010,
  end_year = 2020,
  sites = "ColliOrientali",
  varieties = "Merlot",
  iterations = 300,
  timestep = 'daily'
)
head(result$phenology)
} # }