Varunayan
Python package for downloading and processing climate data from ERA5, IMD, HadEX3, and CRU TS. Includes heat stress index calculations (UTCI, WBGT, Heat Index, Humidex) and country-level temperature aggregation.
Also available in R: varunayan for R
Data sources
| Source | Variables | Resolution | Coverage |
|---|---|---|---|
| ERA5 | 100+ (temperature, precipitation, wind, radiation, etc.) | 0.25 deg, hourly to monthly | 1940-present, global |
| IMD | Rainfall, Tmax, Tmin | 0.25/1.0 deg, daily | 1901-present, India |
| HadEX3 | 29 ETCCDI climate extremes | 1.25x1.875 deg, annual/monthly | 1901-2018, global |
| CRU TS v4.07 | tmp, tmx, tmn, pre, vap, cld, wet, frs, dtr, pet | 0.5 deg, monthly | 1901-2022, land |
Installation
pip install varunayan
For development:
pip install -e ".[dev]"
Quick start
ERA5 (requires CDS account)
import varunayan
# Bounding box: one row for each grid cell, time step and variable
df = varunayan.era5ify_bbox(
request_id="mumbai",
variables=["2m_temperature", "total_precipitation"],
start_date="2024-01-01",
end_date="2024-01-31",
north=19.2,
south=18.9,
east=72.9,
west=72.8,
frequency="daily",
)
# Columns: datetime, latitude, longitude, variable, value
# Units: temperature in °C, precipitation in mm (convert_units=True)
# Regional mean for each day, weighted by cos(latitude)
daily = varunayan.spatial_mean(df, "value", by=["variable", "datetime"])
# Single point: the nearest grid cell
df = varunayan.era5ify_point(
"shimla",
["2m_temperature"],
"2024-01-01",
"2024-01-07",
lat=31.1,
lon=77.2,
)
IMD gridded data (no credentials needed)
# Rainfall for a bounding box
rain = varunayan.imd_rainfall_bbox(
"maharashtra",
start_year=2020,
end_year=2023,
north=22,
south=16,
east=80,
west=73,
resolution=0.25,
frequency="monthly",
)
# Temperature with GeoJSON filter
tmax = varunayan.imd_temperature_geojson(
"karnataka",
start_year=2022,
end_year=2023,
geojson_file="karnataka.geojson",
var_type="tmax",
)
# IMD station lookup
stations = varunayan.get_imd_stations()
HadEX3 climate extremes
# Hottest-day trend over India
txx = varunayan.hadex3_bbox(
"TXx", start_year=1951, end_year=2018, north=38, south=6, east=98, west=68
)
# All 29 ETCCDI indices
varunayan.list_hadex3_indices()
CRU TS monthly climate grids
# Mean temperature for a bounding box
tmp = varunayan.cru_ts_bbox(
"tmp", start_year=2000, end_year=2020, north=38, south=6, east=98, west=68
)
# All 10 variables with ERA5/HadEX3 equivalents
varunayan.list_cru_ts_variables()
Country-level temperature
# Cosine-latitude weighted national average
df = varunayan.get_era5_country_temperature(
"India", "2000-01-01", "2023-12-31", variables=["mean", "max", "min"]
)
Heat stress indices
# Individual indices
utci = varunayan.utci(temp_c=35, wind_speed=2, dewpoint_c=25, tmrt=50)
hi = varunayan.heat_index(temp_c=35, rh=60)
wbgt = varunayan.wbgt_simple(temp_c=35, dewpoint_c=25)
# RH, wet bulb, Heat Index, WBGT and Humidex as one DataFrame
indices = varunayan.calc_heat_indices(temp_c=35, dewpoint_c=25)
# UTCI sparse Legendre polynomial (Roman et al. 2025, wider wind range)
utci_s = varunayan.utci_sparse(temp_c=35, tmrt=50, wind_speed=2, rh=60)
# Risk categories
varunayan.heat_index_risk_category(hi)
varunayan.utci_category(utci)
Analysis and plots
rain = varunayan.era5ify_bbox(
"kerala_rain",
["total_precipitation"],
"1991-01-01",
"2020-12-31",
north=12.8,
south=8.2,
east=77.4,
west=74.9,
frequency="monthly",
)
monthly = varunayan.spatial_mean(rain, "value", by=["year", "month"])
monthly["anomaly"] = varunayan.anomaly(monthly, "value", baseline=(1991, 2020))
varunayan.plot_series(monthly, x="date", y="anomaly")
See the API reference for compare, cross_correlation, seasonal_cycle, peak_month, regrid, plot_map and the other functions.
CLI
varunayan bbox --request-id "test" --variables "temperature,relative_humidity" \
--start "2024-01-01" --end "2024-01-15" \
--north 30 --south 20 --east 80 --west 70 \
--dataset-type pressure --pressure-levels "1000,900" \
--freq daily --res 0.25
Use varunayan geojson --geojson FILE [--level union|feature] for a GeoJSON region and varunayan point --lat LAT --lon LON for a point. Output goes to {request_id}_output/.
Documentation
Contributing
Contributions welcome via pull request.
License
MIT License. See LICENSE.
Metadata
Release files for varunayan 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| varunayan-0.4.0.tar.gz | 81.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| varunayan-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 174.9 kB
Release files / varunayan-0.4.0.tar.gz
| Download URL | varunayan-0.4.0.tar.gz |
|---|---|
| Size | 81.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0fc71deb7a58feb820a986ef784f1b64166cd02dda8579949bd9923e84a69ed2
|
|
BLAKE2b-256 checksum How to use checksums |
dc16da3e73e9c278fb0f952f1671bad6ef51bff0153ac2a206f76a9789df172a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logRelease files / varunayan-0.4.0-py3-none-any.whl
| Download URL | varunayan-0.4.0-py3-none-any.whl |
|---|---|
| Size | 93.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7abcd8f86077476d587fc9e758cd59922e69ccf0e697291afac5d4875e9538e
|
|
BLAKE2b-256 checksum How to use checksums |
b6df247fb44d2cf2887b2eb2c7e3ece306484835d3590c7504c8a81fbbbe5601
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logSecurity for varunayan 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for varunayan-0.4.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.