| Title: | Model Cumulative Growing Degree-Days for Pest Monitoring |
| Version: | 0.1.0 |
| Description: | Raw data from pest monitoring/traps can be correlated with environmental factors such as temperature, growing degree day etc. to get useful insights about the pest phenology. This package pulls temperature data from the California Irrigation Management Information System ('CIMIS', https://cimis.water.ca.gov) or the 'Daymet' application programming interface ('API', https://daymet.ornl.gov) for a user-specified time period and calculates cumulative growing degree-days. Users provide pest development thresholds (lower and upper temperatures) and the geographic coordinates of the trap location to track emergence and phenology. |
| License: | MIT + file LICENSE |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| Depends: | R (≥ 3.5) |
| LazyData: | true |
| Imports: | daymetr, degday, dplyr, ggplot2, magrittr, rlang |
| NeedsCompilation: | no |
| Packaged: | 2026-05-16 03:17:56 UTC; UCCETC1 |
| Author: | Santosh Bhandari [aut, cre] |
| Maintainer: | Santosh Bhandari <santoshbhandari4556@gmail.com> |
| Repository: | CRAN |
| Date/Publication: | 2026-05-20 09:00:07 UTC |
Calculate cumulative degree-days for a pest using Daymet API or CIMIS CSV FILE
Description
Calculate cumulative degree-days for a pest using Daymet API or CIMIS CSV FILE
Usage
calc_pest_phenology(
trap_data,
pest = NULL,
lat = NULL,
lon = NULL,
custom_lower = NULL,
custom_upper = NULL,
cimis_csv = NULL
)
Arguments
trap_data |
A data frame containing |
pest |
A string representing the pest code (e.g., "OLFF", "NOW"). See |
lat |
Latitude of the trap location (numeric). |
lon |
Longitude of the trap location (numeric). |
custom_lower |
Optional. Override the database with a custom lower threshold. |
custom_upper |
Optional. Override the database with a custom upper threshold. |
cimis_csv |
Optional. File path to a manually downloaded CIMIS daily CSV file. |
Value
A data frame joining the trap data with daily temperatures and cumulative degree-days.
Examples
# Create mock trap data for testing
trap_df <- data.frame(date = as.Date(c("2024-05-01", "2024-05-08")),
trap_counts = c(2, 14))
# Calculate phenology using Daymet API
results <- calc_pest_phenology(trap_df, pest = "OLFF", lat = 38.5, lon = -121.8)
Pest Developmental Thresholds
Description
A dataset containing the lower and upper developmental temperature thresholds (in Fahrenheit) for common agricultural pests in California.
Usage
pest_thresholds
Format
A data frame with 5 rows and 4 variables:
- pest_code
Short abbreviation for the pest (e.g., OLFF, NOW)
- pest_name
Common name of the pest
- lower_thresh
Lower developmental temperature threshold (°F)
- upper_thresh
Upper developmental temperature threshold (°F)
Plot Cumulative Degree-Days against Trap Counts
Description
Plot Cumulative Degree-Days against Trap Counts
Usage
plot_phenology_trend(df, save_plot = FALSE)
Arguments
df |
The data frame outputted by |
save_plot |
Logical. If TRUE, saves the plot to your working directory. |
Value
A ggplot object.