Skip to contents

Unlike imd_temperature_geojson(), which returns grid points clipped to the GeoJSON boundary, this returns one row per feature (e.g. per state) per time period, with the region-mean temperature.

Usage

imd_temperature_by_region(
  request_id,
  start_year,
  end_year,
  geojson_file,
  feature_col = NULL,
  var_type = "tmean",
  frequency = "monthly",
  use_cache = TRUE
)

Arguments

request_id

Unique identifier for the request.

start_year

Start year (>= 1951).

end_year

End year (<= 2024).

geojson_file

Path to a GeoJSON whose features are the regions.

feature_col

Name of the GeoJSON property to group by (e.g. "state_name"). If NULL, the first non-geometry column is used.

var_type

"tmax", "tmin", or "tmean" (mean of tmax & tmin). Default "tmean".

frequency

"monthly" (default), "yearly", or "daily".

use_cache

Use cached IMD downloads if available (default TRUE).

Value

A data.frame: region, year, month (if monthly), temperature.

Examples

if (FALSE) { # \dontrun{
temp <- imd_temperature_by_region(
  request_id = "india_states",
  start_year = 2009, end_year = 2024,
  geojson_file = "india_states.geojson",
  feature_col = "state_name", var_type = "tmean", frequency = "monthly"
)
} # }