Package {TrackTrap}


Title: Model Cumulative Growing Degree-Days for Pest Monitoring
Version: 1.0.1
Description: Pest monitoring is crucial, especially during the early season, to understand the distribution and the proliferation of the target pest. Raw count data from pest monitoring/traps can be coupled with derived environmental variables such as growing degree-day ('GDD') to get useful insights about the pest phenology. This package pulls temperature data from the 'Daymet' application programming interface ('API', https://daymet.ornl.gov), or 'Open-Meteo' ('API', https://open-meteo.com/) or manual user-supplied CSV file from the California Irrigation Management Information System ('CIMIS', https://cimis.water.ca.gov), for a user-specified time period and calculates cumulative growing degree-days. Users provide intended date range, pest of concern, and the geographic coordinates of the trap location to track pest emergence and phenology throughout the growing season.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 3.5)
LazyData: true
Imports: daymetr, dplyr, degday, ggplot2, httr, magrittr, utils, rlang
Config/roxygen2/version: 8.1.0
Suggests: testthat (≥ 3.0.0), knitr, rmarkdown
VignetteBuilder: knitr
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-08-19 21:45:28 UTC; r3113219
Author: Santosh Bhandari [aut, cre], Lalit Kharel [aut], Mahesh Ghimire [aut]
Maintainer: Santosh Bhandari <santoshbhandari4556@gmail.com>
Repository: CRAN
Date/Publication: 2026-08-20 06:42:04 UTC

TrackTrap: Model Cumulative Growing Degree-Days for Pest Monitoring

Description

Pest monitoring is crucial, especially during the early season, to understand the distribution and the proliferation of the target pest. Raw count data from pest monitoring/traps can be coupled with derived environmental variables such as growing degree-day ('GDD') to get useful insights about the pest phenology. This package pulls temperature data from the 'Daymet' application programming interface ('API', https://daymet.ornl.gov), or 'Open-Meteo' ('API', https://open-meteo.com/) or manual user-supplied CSV file from the California Irrigation Management Information System ('CIMIS', https://cimis.water.ca.gov), for a user-specified time period and calculates cumulative growing degree-days. Users provide intended date range, pest of concern, and the geographic coordinates of the trap location to track pest emergence and phenology throughout the growing season.

Author(s)

Maintainer: Santosh Bhandari santoshbhandari4556@gmail.com

Authors:


Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Value

The result of calling rhs(lhs).


Calculate pest phenology from trap and weather data

Description

Calculate pest phenology from trap and weather data

Usage

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_flight_interval = NULL,
  custom_pest_label = NULL
)

Arguments

trap_data

Data frame with date and trap_counts columns.

pest

Pest code (e.g. "FAW"). Optional if custom_lower/custom_upper given.

lat

Latitude (required for open_meteo/daymet).

lon

Longitude (required for open_meteo/daymet).

weather_source

"open_meteo", "daymet", or "cimis_csv".

cimis_csv_path

Path to CIMIS CSV (required if weather_source = "cimis_csv").

custom_lower

Optional override for lower threshold (°F).

custom_upper

Optional override for upper threshold (°F).

custom_flight_interval

Optional override for flight interval (DD).

custom_pest_label

Optional label display if pest is not listed in the database.

Value

Data frame with cumulative DD columns and lat/lon/year/flight_interval_dd/pest_label attributes.


Fetch Open-Meteo Data

Description

Fetch Open-Meteo Data

Usage

fetch_open_meteo(lat, lon, start_date, end_date = as.character(Sys.Date()))

Arguments

lat

Latitude.

lon

Longitude.

start_date

Start date, "YYYY-MM-DD".

end_date

End date, "YYYY-MM-DD". Defaults to today.

Value

A data frame with Date, tmax, tmin (Fahrenheit).


Pest Developmental Thresholds

Description

Pest Developmental Thresholds

Usage

pest_thresholds

Format

A data frame with 90 rows and 5 columns:

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

flight_interval_dd

Cumulative degree-days between successive flight peaks, used by calc_pest_phenology() to project subsequent flight generations.


Plot trap phenology against accumulated degree-days

Description

Plot trap phenology against accumulated degree-days

Usage

plot_trap_phenology(
  pheno_data,
  pest = NULL,
  year = NULL,
  lat = NULL,
  lon = NULL,
  custom_flight_interval = NULL,
  custom_pest_label = NULL
)

Arguments

pheno_data

Output of calc_pest_phenology().

pest

Optional pest code for database lookup (title, flight interval).

year

Optional year label; defaults to pheno_data's "year" attribute.

lat

Optional latitude for subtitle; defaults to pheno_data's "lat" attribute.

lon

Optional longitude for subtitle; defaults to pheno_data's "lon" attribute.

custom_flight_interval

Optional override for flight-line spacing (DD).

custom_pest_label

Optional title label if pest is not listed in the database.

Value

A ggplot object.