Skip to contents

Retrieves the India Meteorological Department (IMD) city-weather station list and, optionally, each station's latitude/longitude. IMD's legacy endpoints expose only station names; its responsive site serves a per-station JSON record (api/fetchCity_static.php) that includes lat/lon, which this function pairs with the station list. The returned coordinates can be fed directly to era5ify_point() or used to build maps.

Usage

IMDStations(...)

imd_stations(with_coordinates = TRUE, cores = 4)

Arguments

...

Ignored (present for alias compatibility).

with_coordinates

Logical; if TRUE (default) fetch latitude and longitude for every station (one request per station). If FALSE, return only station_id and name.

cores

Integer; number of parallel workers used to fetch coordinates (passed to parallel::mclapply()). Defaults to 4; set to 1 on Windows.

Value

A data.frame with columns station_id, name, and — when with_coordinates = TRUElatitude, longitude (NA where IMD has no coordinate for a station).

Examples

if (FALSE) { # \dontrun{
stations <- imd_stations()
shimla <- stations[grepl("Shimla", stations$name), ]
} # }