assets/analytics.html

Skip to contents

This function runs the Phenomenals method by passing weather data and target traits (e.g., yield, Brix, sugar) 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 settings are exposed.

Usage

runPhenomenals(
  weather_data,
  target_data,
  phenomenalsParameters,
  start_year = 2000,
  end_year = 2025,
  sites = "all",
  varieties = "all",
  timestep = "daily",
  target_traits = c("yield"),
  rolling_window = 5,
  evaluation_range = list(c(0, 200)),
  multicollinearity_threshold = 0.8,
  max_phenomenals = 4,
  bin_size = 1
)

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).

target_data

A data frame containing the target data (e.g., yield, brix, berry number, malic acid). The dataframe must include: Site, Latitude, Longitude, Variety, Year, Variable, Value, and Unit.

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 (numeric, default is 2000).

end_year

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

sites

A character vector of site names (e.g., "ColliOrientali").

varieties

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

timestep

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

target_traits

The target traits on which applying the phenomenals (default is "yield").

rolling_window

The window pane size for phenomenals smoothing (default is 5 days).

evaluation_range

A list of numeric vectors specifying the percentage range of the plant cycle to compute phenomenals (0–200; 0–100 = dormancy, 101–200 = growing season). (default is list(c(0,200)))

multicollinearity_threshold

The threshold to consider phenomenals multicorrelations on each unit of cycle percentage (default is 0.8).

max_phenomenals

The maximum number of phenomenals to retain (default is 4).

bin_size

The range of cycle percentage to aggregate phenomenals (default is 1).

Value

A named list with three components:

data

Raw and processed phenological signals

selection

Results from signal selection (correlation, multicollinearity, stepwise)

results

Model diagnostics, predictions, coefficients, and variable importance

Examples

if (FALSE) { # \dontrun{
result <- phenologyCalibration(
  weather_data = colliOrientali,
  target_data = targetSample,
  phenomenalsParameters,
  start_year = 2010,
  end_year = 2020,
  sites = "ColliOrientali",
  varieties = "Merlot",
  timestep = 'daily',
  rolling_window = 5,
  target_traits = c('yield'),
  evaluation_range = list(c(0,400)),
  multicollinearity_threshold=0.8,
  max_phenomenals=4,
  bin_size=1)
head(result$phenomenals$processed)
} # }