varunayan.convenience module¶
Convenience wrapper functions for common climate data workflows.
These functions combine data download with derived metric calculations, reducing user code from ~30 lines to a single function call.
- varunayan.convenience.get_era5_daily_temperature(request_id: str, start_date: str, end_date: str, north: float, south: float, east: float, west: float, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily temperature data with automatic unit conversion.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
north – Northern latitude bound
south – Southern latitude bound
east – Eastern longitude bound
west – Western longitude bound
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
latitude, longitude, date, temp_c
- Return type:
DataFrame with columns
- varunayan.convenience.get_era5_daily_humidity(request_id: str, start_date: str, end_date: str, north: float, south: float, east: float, west: float, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily humidity data with automatic RH calculation.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
north – Northern latitude bound
south – Southern latitude bound
east – Eastern longitude bound
west – Western longitude bound
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
latitude, longitude, date, temp_c, dewpoint_c, rh
- Return type:
DataFrame with columns
- varunayan.convenience.get_era5_daily_wind(request_id: str, start_date: str, end_date: str, north: float, south: float, east: float, west: float, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily wind data with automatic wind speed calculation.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
north – Northern latitude bound
south – Southern latitude bound
east – Eastern longitude bound
west – Western longitude bound
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
latitude, longitude, date, u10, v10, wind_speed
- Return type:
DataFrame with columns
- varunayan.convenience.get_era5_daily_heat_index_data(request_id: str, start_date: str, end_date: str, north: float, south: float, east: float, west: float, solar_load: bool = False, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily data and calculate comprehensive heat stress indices.
This convenience function downloads temperature, humidity, and wind data, then calculates all common heat stress indices in one call.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
north – Northern latitude bound
south – Southern latitude bound
east – Eastern longitude bound
west – Western longitude bound
solar_load – If True, also download solar radiation for outdoor UTCI
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
latitude, longitude, date (or year, month, day depending on aggregation)
temp_c: Temperature in Celsius
dewpoint_c: Dewpoint temperature in Celsius
rh: Relative humidity (%)
wind_speed: Wind speed in m/s
wet_bulb: Wet bulb temperature (°C)
heat_index: Heat index (°C)
wbgt: Wet Bulb Globe Temperature (°C)
humidex: Humidex value
utci: Universal Thermal Climate Index (°C)
heat_index_risk: NWS risk category
wbgt_risk: Occupational risk category
utci_stress: Thermal stress category
If solar_load=True: ssrd (solar radiation) and mrt (mean radiant temp)
- Return type:
DataFrame with columns
- varunayan.convenience.get_era5_monthly_heat_index_data(request_id: str, start_date: str, end_date: str, north: float, south: float, east: float, west: float, solar_load: bool = False, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 monthly data and calculate comprehensive heat stress indices.
Same as get_era5_daily_heat_index_data but aggregated to monthly frequency.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
north – Northern latitude bound
south – Southern latitude bound
east – Eastern longitude bound
west – Western longitude bound
solar_load – If True, also download solar radiation for outdoor UTCI
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
DataFrame with same columns as get_era5_daily_heat_index_data, aggregated to monthly means.
- varunayan.convenience.get_era5_daily_heat_index_geojson(request_id: str, start_date: str, end_date: str, geojson_file: str, dist_features: List[str] | None = None, solar_load: bool = False, resolution: float = 0.25, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily data for a GeoJSON region and calculate heat stress indices.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
geojson_file – Path to GeoJSON file defining the region
dist_features – List of GeoJSON properties to distinguish features
solar_load – If True, also download solar radiation for outdoor UTCI
resolution – Spatial resolution in degrees (default 0.25)
verbosity – Logging verbosity level (0-2)
- Returns:
DataFrame with heat stress indices for points within the GeoJSON region
- varunayan.convenience.get_era5_daily_heat_index_point(request_id: str, start_date: str, end_date: str, latitude: float, longitude: float, solar_load: bool = False, verbosity: int = 0) DataFrame[source]¶
Download ERA5 daily data for a single point and calculate heat stress indices.
- Parameters:
request_id – Unique identifier for the request
start_date – Start date in ‘YYYY-MM-DD’ format
end_date – End date in ‘YYYY-MM-DD’ format
latitude – Latitude of the point
longitude – Longitude of the point
solar_load – If True, also download solar radiation for outdoor UTCI
verbosity – Logging verbosity level (0-2)
- Returns:
DataFrame with heat stress indices for the specified point