Solutions Projects Parameters GitHub ↗
← Back to AidBio Open source · Beta
AidBio open tools · AidWeather

Weather and solar data, already cleaned up.

AidWeather is a small Python library and command-line tool that pulls agroclimatic and solar-radiation data straight from NASA's POWER API — and hands it back as tidy, analysis-ready tables. You ask for a place and a date range; it deals with the requests, retries, caching, and units so you don't have to.

15 Weather & solar parameters, unit-validated
3 shapes Point, transect, and regional sampling
SQLite Built-in caching, no repeat downloads
Python + CLI Use it in a notebook or the terminal
What it does

The awkward parts of NASA POWER, handled for you.

NASA POWER is a wonderful free dataset, but talking to it directly means building request URLs, babysitting timeouts, checking payload shapes, and reconciling units and grids. AidWeather quietly takes care of all of that, so what you get back is data you can actually start analyzing.

Seamless NASA POWER access

Acts as a clean bridge to NASA POWER — hiding request construction, timeout handling, and payload checks behind a couple of simple calls.

Point, path, or region

Fetch a single coordinate, sample along a 1D transect, or pull a 2D bounding box — with internal tuning so the spatial sampling stays accurate and consistent.

Caching & API compliance

A built-in SQLite cache means the same query is never downloaded twice — saving bandwidth and respecting NASA POWER's rate limits and usage policy.

Python API + full CLI

Two ways in: an intuitive Python API that fits data-science workflows, and a full command-line tool for quick, scriptable extractions.

Clear errors & logging

Comprehensive activity logging and intelligent error catching give you readable insight into what a query did — instead of a raw stack trace.

Weather & solar together

Temperature, humidity, wind, precipitation, pressure, and solar irradiance / PAR — the meteorological and energy variables agritech work usually needs, side by side.

Three ways to sample space

Match the query to the question.

The same client fetches a single site, a line across a landscape, or a filled-in region — each respecting the native grid spacing of the parameters you ask for.

get_point_data

A single point

One latitude/longitude and a date range returns a clean daily or hourly series for that site — the everyday case for a field, a station, or a trial plot.

get_transect_data

Along a transect

Give a start and end coordinate and a spacing in kilometres; AidWeather samples evenly along the line, respecting each parameter's real grid resolution.

fetch-regional

Across a region

Define a bounding box (up to 4.5° × 4.5°) and pull a gridded field over the whole area — one parameter per request, cached like everything else.

Quick start

A few lines to your first dataset.

Whether you live in notebooks or the terminal, getting a table of weather and solar data is a short trip.

Python
from aidweather import PowerClient, GeoCoordinate

# Daily temporal resolution
client = PowerClient(temporal_api="daily")

# 1 · single-point weather + solar
df = client.get_point_data(
    lat=-23.55, lon=-46.63,
    start="2023-01-01", end="2023-01-31",
    params=["T2M", "ALLSKY_SFC_SW_DWN", "PRECTOTCORR"],
)
print(df.head())

# 2 · sample along a 1D transect
a = GeoCoordinate.from_decimal(-25.0, -48.0)
b = GeoCoordinate.from_decimal(-20.0, -48.0)

df_t = client.get_transect_data(
    start_coord=a, end_coord=b,
    start="2023-01-01", end="2023-01-07",
    params=["T2M"], spacing_km=100.0,
)
Command line
# single-point data → CSV
aidweather fetch --lat -23.55 --lon -46.63 \
    --start 2023-01-01 --end 2023-01-31 \
    --params T2M,PRECTOTCORR --output point.csv

# sample along a 1D transect
aidweather fetch-transect \
    --lat-start -25.0 --lon-start -48.0 \
    --lat-end   -20.0 --lon-end   -48.0 \
    --start 2023-01-01 --end 2023-01-31 \
    --spacing-km 100.0

# regional box (max 4.5° × 4.5°, 1 param)
aidweather fetch-regional --lat-min -23.5 --lat-max -20.0 \
    --lon-min -47.0 --lon-max -44.0 \
    --start 2023-01-01 --end 2023-01-31 \
    --params T2M --output regional.csv

# inspect metadata & local cache
aidweather params list --group all
aidweather params describe T2M
aidweather cache info
Installation

One command to get going.

Pick the line for your platform. The uv tool route works everywhere Python does.

Unix / macOS
# install script
curl -fsSL https://raw.githubusercontent.com/\
matiollipt/aidweather/main/install.sh | bash

# …or via uv tool (any platform)
uv tool install \
  git+https://github.com/matiollipt/aidweather.git
Windows · PowerShell
& ([scriptblock]::Create((irm https://raw\
.githubusercontent.com/matiollipt/aidweather/\
main/install.ps1))) -Yes
Parameter catalogue

15 core parameters, with the grid facts built in.

Each parameter ships with metadata, unit validation, and its native NASA source-grid resolution — so you always know what a value means and where it came from.

Code Parameter Group Source product Native grid Daily unit
T2MTemperature at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
T2M_MAXMaximum temperature at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
T2M_MINMinimum temperature at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
T2M_RANGEDiurnal temperature range at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
T2MWETWet-bulb temperature at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
T2MDEWDew-point temperature at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
TSSurface skin temperatureMeteoMERRA-2 / GEOS-IT0.50° × 0.625°°C
RH2MRelative humidity at 2 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°%
PRECTOTCORRCorrected total precipitationMeteoMERRA-2 / GEOS-IT0.50° × 0.625°mm/day
ALLSKY_SFC_SW_DWNSurface shortwave downward irradianceSolarCERES SYN1deg / SRB1.00° × 1.00°kWh/m²/day
ALLSKY_SFC_PAR_TOTSurface PAR totalSolarCERES SYN1deg / SRB1.00° × 1.00°MJ/m²/day
WS10MWind speed at 10 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°m/s
WS10M_MAXMaximum wind speed at 10 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°m/s
WD10MWind direction at 10 mMeteoMERRA-2 / GEOS-IT0.50° × 0.625°degrees
PSSurface pressureMeteoMERRA-2 / GEOS-IT0.50° × 0.625°kPa

A coordinate is a grid cell, not a pinpoint

A coordinate you submit resolves to a source-product grid cell — it isn't a point measurement at your exact latitude and longitude. Different parameters come from different source products (MERRA-2 at 0.5° × 0.625°, CERES solar radiation at 1.0° × 1.0°), so nearby coordinates that map to the same cell return identical series.

AidWeather keeps this provenance visible so your spatial interpretation stays honest.

Open access · Apache-2.0

Free data, with the attribution it deserves.

NASA POWER data are open access and free of charge. Work that uses AidWeather should cite the NASA POWER project and acknowledge the underlying MERRA-2 / GEOS-IT and CERES / FLASHFlux / SRB source products, per the NASA Earthdata Data Use and Attribution Policy.