| Title: | Calculate and Visualize Degree-Days for Pest Monitoring |
|---|---|
| Description: | Combines pest trap observations with daily temperatures to calculate and visualize cumulative degree-days. Temperature inputs include 'Daymet' <https://daymet.ornl.gov>, 'Open-Meteo' <https://open-meteo.com/>, reports from the California Irrigation Management Information System ('CIMIS') <https://cimis.water.ca.gov>, and user-supplied daily weather data. Degree-days are calculated using the simple-average method with either an upper threshold applied to the daily mean or an explicitly selected calculation without an upper cutoff. The first positive trap count defines the biofix for every pest, with accumulation beginning on the following day. Negative daily degree-day values are set to zero. Users can provide temperature thresholds and optional thermal reference values. Thermal reference markers and their multiples do not independently establish flight or generation identities. Complete daily calculations and weather provenance are retained with the output to support reproducibility. |
| Authors: | Santosh Bhandari [aut, cre], Lalit Kharel [aut], Mahesh Ghimire [aut] |
| Maintainer: | Santosh Bhandari <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.1.0 |
| Built: | 2026-10-18 21:03:27 UTC |
| Source: | https://github.com/santosh4355/tracktrap |
Calculate a simple-average degree-day index for trap observations
calc_pest_phenology( trap_data, pest = NULL, lat = NULL, lon = NULL, weather_source = "open_meteo", cimis_csv_path = NULL, custom_lower = NULL, custom_upper = NULL, custom_thermal_requirement = NULL, custom_flight_interval = NULL, custom_pest_label = NULL, upper_cutoff = c("explicit", "none", "horizontal"), weather_data = NULL, weather_provenance = NULL, timezone = "auto", open_meteo_model = "era5_land", database = NULL )calc_pest_phenology( trap_data, pest = NULL, lat = NULL, lon = NULL, weather_source = "open_meteo", cimis_csv_path = NULL, custom_lower = NULL, custom_upper = NULL, custom_thermal_requirement = NULL, custom_flight_interval = NULL, custom_pest_label = NULL, upper_cutoff = c("explicit", "none", "horizontal"), weather_data = NULL, weather_provenance = NULL, timezone = "auto", open_meteo_model = "era5_land", database = NULL )
trap_data |
Data frame with date and trap_counts, one row per date. |
pest |
Optional database code. |
lat, lon
|
Weather coordinates. |
weather_source |
open_meteo, daymet, cimis_csv, or supplied. |
cimis_csv_path |
Path to CIMIS Fahrenheit daily report. |
custom_lower, custom_upper
|
Optional Fahrenheit threshold overrides. |
custom_thermal_requirement |
Optional user-defined thermal marker (Fahrenheit DD). |
custom_flight_interval |
Deprecated alias for custom_thermal_requirement. |
custom_pest_label |
Optional plot label. |
upper_cutoff |
"explicit", "none", or "horizontal". Missing database upper thresholds require an explicit "none" choice or a supplied upper. |
weather_data |
Optional daily Date, tmin, tmax data in Fahrenheit. |
weather_provenance |
Description of provided temperatures/station/time convention. |
timezone, open_meteo_model
|
Open-Meteo settings. |
database |
Optional database; defaults to TrackTrap::pest_thresholds. |
Biofix is always the first positive trap count; its DD is excluded. Daily DD is max(min(mean temperature, upper) - lower, 0), or no upper cap.
Original data frame.
Fetch daily historical Open-Meteo temperatures in Fahrenheit
fetch_open_meteo( lat, lon, start_date, end_date = as.character(Sys.Date()), timezone = "auto", model = "era5_land" )fetch_open_meteo( lat, lon, start_date, end_date = as.character(Sys.Date()), timezone = "auto", model = "era5_land" )
lat, lon
|
Coordinates. |
start_date, end_date
|
Requested dates, inclusive. |
timezone |
IANA timezone or "auto" |
model |
Explicit archive model identifier. |
Reference parameters and source information for 90 pest records. Missing parameters are stored as NA. Inclusion does not imply that a complete or independently validated phenology model is available.
pest_thresholdspest_thresholds
A data frame with 90 rows and 10 variables:
Unique pest identifier.
Common name.
Scientific name.
Lower temperature threshold in degrees Fahrenheit.
Upper temperature threshold in degrees Fahrenheit, where available.
Thermal reference value in Fahrenheit degree-days for the stated endpoint; not necessarily a flight interval.
Reference supporting the lower threshold.
Reference supporting the upper threshold.
Reference for the thermal value.
Developmental or phenological endpoint associated with the thermal value.
Parameter sources and model compatibility require assessment before application. Seasonal event thresholds and developmental requirements are not interchangeable.
Plot trap catches against the calculated DD index
plot_trap_phenology( pheno_data, pest = NULL, year = NULL, lat = NULL, lon = NULL, custom_thermal_requirement = NULL, repeat_markers = FALSE, custom_flight_interval = NULL, custom_pest_label = NULL )plot_trap_phenology( pheno_data, pest = NULL, year = NULL, lat = NULL, lon = NULL, custom_thermal_requirement = NULL, repeat_markers = FALSE, custom_flight_interval = NULL, custom_pest_label = NULL )
pheno_data |
Output of calc_pest_phenology(). |
pest |
Optional label only; never used to retrieve marker intervals. |
year, lat, lon
|
Optional title settings. |
custom_thermal_requirement |
Optional user-defined marker in Fahrenheit DD. |
repeat_markers |
If TRUE, show user-defined multiples; default FALSE. |
custom_flight_interval |
Deprecated alias for custom_thermal_requirement. |
custom_pest_label |
Optional title label. |
When a thermal marker is selected, the subtitle displays its value. A matching database reference supplies the developmental endpoint; otherwise the endpoint is reported as unspecified. The caption explains the reference and distinguishes first-capture multiples from observed generations. Database requirements are not automatically selected as markers.