Package {AgroMetIndices}


Title: Agrometeorological Indices for Daily, Monthly, and Seasonal Time Scales
Version: 0.1.0
Description: Provides methods for calculating agrometeorological indices from daily weather data at daily, monthly, and user-defined seasonal time scales. The package includes temperature, rainfall, growing degree days, heat and cold stress, wet and dry spells, extreme rainfall, and seasonal completeness indices, along with functions for meteorological data quality assessment and crop-season definition. For method details see <doi:10.1002/wcc.147> and <doi:10.1038/s41598-026-55293-3>.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Config/roxygen2/version: 8.1.0
Suggests: testthat (≥ 3.0.0)
Config/testthat/edition: 3
NeedsCompilation: no
Packaged: 2026-09-24 09:38:24 UTC; Dr. Santosh Rathod
Author: RN Singh [aut], Sonam Sah [aut, cre], Santosha Rathod [aut], Prabhat Kumar [aut], Sudhir Kumar Mishra [aut], Gaurav Chaturvedi [aut]
Maintainer: Sonam Sah <sonamnarayan.icar@gmail.com>
Depends: R (≥ 3.5.0)
RoxygenNote: 7.3.3
Repository: CRAN
Date/Publication: 2026-10-05 16:10:19 UTC

AgroMetIndices: Agrometeorological Indices for Daily, Monthly, and Seasonal Time Scales

Description

Provides methods for calculating agrometeorological indices from daily weather data at daily, monthly, and user-defined seasonal time scales. The package includes temperature, rainfall, growing degree days, heat and cold stress, wet and dry spells, extreme rainfall, and seasonal completeness indices, along with functions for meteorological data quality assessment and crop-season definition. For method details see doi:10.1002/wcc.147 and doi:10.1038/s41598-026-55293-3.

Author(s)

Maintainer: Sonam Sah sonamnarayan.icar@gmail.com

Authors:


Calculate agrometeorological indices

Description

Main user-facing function for calculating daily, monthly, or user-defined seasonal agrometeorological indices.

Usage

agromet_indices(
  data,
  frequency = "daily",
  seasons = NULL,
  date = "Date",
  location = "Location",
  rain = "Rain",
  tmax = "Tmax",
  tmin = "Tmin",
  tbase,
  heat_threshold = 35,
  cold_threshold = 15
)

Arguments

data

A daily meteorological data frame.

frequency

Calculation frequency: "daily", "monthly", or "seasonal".

seasons

A season-definition data frame created using create_seasons(). Required when frequency = "seasonal".

date

Name of the date column.

location

Name of the location column.

rain

Name of the rainfall column.

tmax

Name of the maximum temperature column.

tmin

Name of the minimum temperature column.

tbase

Base temperature for GDD calculation.

heat_threshold

Heat-stress threshold.

cold_threshold

Cold-stress threshold.

Value

Calculated agrometeorological indices.

Examples

data(weather_daily)

# Daily indices
daily <- agromet_indices(
  weather_daily,
  frequency = "daily",
  tbase = 10
)

head(daily)

# Monthly indices
monthly <- agromet_indices(
  weather_daily,
  frequency = "monthly",
  tbase = 10
)

head(monthly)

# Seasonal indices
seasons <- rbind(
  create_seasons("Kharif", "01-06", "31-10"),
  create_seasons("Rabi", "01-11", "31-03")
)

seasonal <- agromet_indices(
  weather_daily,
  frequency = "seasonal",
  seasons = seasons,
  tbase = 10
)

head(seasonal$indices)


Assign season and season year

Description

Assigns each daily observation to a user-defined crop season and determines the corresponding SeasonYear.

Usage

assign_season(data, seasons, date = "Date")

Arguments

data

A data frame containing a date column.

seasons

A data frame created using create_seasons().

date

Name of the date column.

Value

The input data frame with Season and SeasonYear columns.

Examples

data(weather_daily)

seasons <- create_seasons(
  season_name = c("Kharif", "Rabi"),
  start = c("01-06", "01-11"),
  end = c("31-10", "31-03")
)

seasonal_data <- assign_season(
  weather_daily,
  seasons = seasons
)

head(seasonal_data)

table(seasonal_data$Season)


Check daily meteorological data

Description

Checks the structure and completeness of daily meteorological data.

Usage

check_meteo_data(
  data,
  date = "Date",
  location = "Location",
  rain = "Rain",
  tmax = "Tmax",
  tmin = "Tmin"
)

Arguments

data

A data frame containing Date, Location, Rain, Tmax and Tmin.

date

Name of the date column.

location

Name of the location column.

rain

Name of the rainfall column.

tmax

Name of the maximum temperature column.

tmin

Name of the minimum temperature column.

Value

A list containing data summary and data-quality information.

Examples

data(weather_daily)

qc <- check_meteo_data(weather_daily)

qc$summary


Check completeness of crop seasons

Description

Calculates seasonal completeness while distinguishing dates that fall outside a location's available observation period from dates missing within that period.

Usage

check_season_completeness(data, seasons, date = "Date")

Arguments

data

A data frame containing Date, Season and SeasonYear.

seasons

A data frame created using create_seasons().

date

Name of the date column.

Value

A data frame containing seasonal completeness information.

Examples

data(weather_daily)

seasons <- create_seasons(
  season_name = c("Kharif", "Rabi"),
  start = c("01-06", "01-11"),
  end = c("31-10", "31-03")
)

seasonal_data <- assign_season(
  weather_daily,
  seasons = seasons
)

season_qc <- check_season_completeness(
  seasonal_data,
  seasons = seasons
)

season_qc


Create crop-season definitions

Description

Creates a standardized table of user-defined crop seasons.

Usage

create_seasons(season_name, start, end)

Arguments

season_name

Character vector of season names.

start

Character vector of season start dates in "DD-MM" format.

end

Character vector of season end dates in "DD-MM" format.

Value

A data frame containing season definitions.

Examples

seasons <- create_seasons(
  season_name = c("Kharif", "Rabi"),
  start = c("01-06", "01-11"),
  end = c("31-10", "31-03")
)

seasons


Calculate daily agrometeorological indices

Description

Calculates daily mean temperature, diurnal temperature range, growing degree days, temperature-stress indicators, and precipitation-related indices.

Usage

daily_agromet(
  data,
  date = "Date",
  location = "Location",
  tmax = "Tmax",
  tmin = "Tmin",
  tbase,
  heat_threshold = 35,
  cold_threshold = 15
)

Arguments

data

A data frame containing Date, Location, Rain, Tmax and Tmin.

date

Name of the date column.

location

Name of the location column.

tmax

Name of the maximum temperature column.

tmin

Name of the minimum temperature column.

tbase

Base temperature for GDD calculation.

heat_threshold

Temperature above which a heat-stress day is recorded.

cold_threshold

Temperature below which a cold-stress day is recorded.

Value

A data frame containing the original data and calculated indices.

Examples

data(weather_daily)

daily <- daily_agromet(
  weather_daily,
  tbase = 10
)

head(daily)


Calculate monthly agrometeorological indices

Description

Aggregates daily agrometeorological indices to monthly values. The function calculates monthly temperature, rainfall, growing degree days, precipitation extremes, consecutive dry and wet days, heat and cold stress indicators, and monthly data-quality information.

Usage

monthly_agromet(
  data,
  date = "Date",
  location = "Location",
  tmax = "Tmax",
  tmin = "Tmin"
)

Arguments

data

A data frame containing daily agrometeorological indices, typically produced by [daily_agromet()].

date

Name of the date column.

location

Name of the location column.

tmax

Name of the maximum temperature column.

tmin

Name of the minimum temperature column.

Value

A data frame containing monthly agrometeorological indices and monthly data-quality information.

Examples

data(weather_daily)

daily <- daily_agromet(
  weather_daily,
  tbase = 10
)

monthly <- monthly_agromet(
  daily
)

head(monthly)


Calculate seasonal agrometeorological indices

Description

Calculates seasonal agrometeorological indices for user-defined crop seasons. Only complete seasons are used for calculation.

Usage

seasonal_agromet(data, seasons, date = "Date", location = "Location")

Arguments

data

A data frame containing daily agrometeorological indices, typically produced by [daily_agromet()].

seasons

A data frame created using [create_seasons()].

date

Name of the date column.

location

Name of the location column.

Value

A list containing two elements: indices, a data frame containing seasonal agrometeorological indices, and qc, a data frame containing seasonal completeness information.

Examples

data(weather_daily)

daily <- daily_agromet(
  weather_daily,
  tbase = 10
)

seasons <- create_seasons(
  season_name = c("Kharif", "Rabi"),
  start = c("01-06", "01-11"),
  end = c("31-10", "31-03")
)

seasonal <- seasonal_agromet(
  daily,
  seasons = seasons
)

head(seasonal$indices)

head(seasonal$qc)


Daily weather example dataset

Description

A two-year daily weather dataset for Kashi, India, containing daily rainfall, maximum temperature, and minimum temperature.

Usage

weather_daily

Format

A data frame with 731 rows and 5 variables:

Date

Date of observation.

Location

Location name.

Rain

Daily rainfall (mm).

Tmax

Daily maximum air temperature (°C).

Tmin

Daily minimum air temperature (°C).

Details

The dataset covers 1 January 2023 to 31 December 2024, with 731 daily observations, including the leap day in 2024.

Source

Local daily weather dataset used for demonstration of the AgroMeteoIndices package.

Examples

data(weather_daily)
head(weather_daily)

mirror server hosted at Truenetwork, Russian Federation.