varunayan.country module

Country-level ERA5 temperature aggregation.

varunayan.country.get_era5_country_temperature(country: str | GeoDataFrame, start_date: str, end_date: str, variables: str | List[str] = 'mean', request_id: str | None = None, resolution: float = 0.25) DataFrame[source]

Download and aggregate ERA5 temperature for a country.

Resolves the country boundary via Natural Earth, downloads monthly ERA5 data, filters grid points to the country polygon, and returns cosine-latitude area-weighted national averages by year and month.

Parameters:
  • country – Country name, ISO-3166 code, GeoJSON file path, or GeoDataFrame.

  • start_date – Start date (YYYY-MM-DD).

  • end_date – End date (YYYY-MM-DD).

  • variables – Temperature shorthand(s): “mean”, “max”, “min”, or ERA5 variable names.

  • request_id – Cache identifier. Auto-generated from country name if omitted.

  • resolution – Spatial resolution in degrees.

Returns:

DataFrame with columns year, month, and one per variable (temperature_mean, temperature_max, temperature_min).