Package {TrackTrap}


Title: Model Cumulative Growing Degree-Days for Pest Monitoring
Version: 1.0.0
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 environmental variables such as temperature, growing degree-day ('GDD') 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), the 'Daymet' application programming interface ('API', https://daymet.ornl.gov), or 'Open Meteo' ('API', https://open-meteo.com/) sequentially for a user-specified time period and calculates cumulative growing degree-days. Users provide pest development thresholds (lower and upper temperatures), pest of concern, and the geographic coordinates of the trap location to track emergence and phenology.
License: MIT + file LICENSE
Encoding: UTF-8
Depends: R (≥ 3.5)
LazyData: true
Imports: curl, daymetr, degday, dplyr, ggplot2, httr, jsonlite, magrittr, rlang, xml2
Config/roxygen2/version: 8.0.0
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
RoxygenNote: 8.0.0
NeedsCompilation: no
Packaged: 2026-06-13 17:24:05 UTC; santo
Author: Santosh Bhandari [aut, cre], Lalit Kharel [aut], Mahesh Ghimire [aut]
Maintainer: Santosh Bhandari <santoshbhandari4556@gmail.com>
Repository: CRAN
Date/Publication: 2026-06-13 17:40:02 UTC

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

Description

Calculate Pest Phenology

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
)

Arguments

trap_data

A data frame containing trap counts

pest

Name of the pest

lat

Latitude

lon

Longitude

weather_source

Weather data source

cimis_csv_path

Path to the CIMIS csv file

custom_lower

Lower developmental threshold

custom_upper

Upper developmental threshold


Fetch Open-Meteo Data

Description

Retrieves weather data from the Open-Meteo API.

Usage

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

Arguments

lat

Latitude

lon

Longitude

start_date

Start date format (YYYY-MM-DD)

end_date

End date format (YYYY-MM-DD)

Value

A dataframe with Date, tmax (F), and tmin (F)


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

An object of class data.frame with 104 rows and 7 columns.

Details

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 Trap Phenology with Flight Markers

Description

Plot Trap Phenology with Flight Markers

Usage

plot_trap_phenology(pheno_data, pest = NULL)

Arguments

pheno_data

Phenology data frame

pest

Name of the pest