Skip to content

Degree days (heating, cooling, growing)

$0.004 per callUSDC via x402GET /api/degree-days

Heating, cooling and growing degree days for any place and date range: per day and in total, past days from the reanalysis archive...

Category: Live public dataTags: weather degree-days hdd cdd gdd energy agriculture

Try in playground →

Details

Heating, cooling and growing degree days for any place and date range: per day and in total, past days from the reanalysis archive (1940 on) and up to 16 days ahead from the forecast, each day labeled past or forecast. Bases are yours (defaults 18 °C or 65 °F, growing base 10 °C or 50 °F); the daily mean is the average of the high and low. By coordinates or place name. Cached for up to 60 minutes. ?place=Chicago&start=2025-01-01&end=2025-01-31. Weather data by Open-Meteo.com (CC BY 4.0). Contains modified Copernicus Climate Change Service information. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

Parameters

NameTypeRequiredDescription
latnumbernoLatitude, -90 to 90 (with lon; wins over place) The example sends 41.8781.
lonnumbernoLongitude, -180 to 180 (with lat) The example sends -87.6298.
placestringnoA city, town or region name instead of lat/lon, for example "Paris" or "Austin, TX" (not a street address); the answer echoes the place it resolved to Up to 100 characters.
startstringnoFirst day, YYYY-MM-DD (default 30 days ago) The example sends 2025-01-01.
endstringnoLast day, YYYY-MM-DD, up to 15 days ahead (default yesterday); at most 366 days in all The example sends 2025-01-31.
basenumbernoHeating and cooling base temperature (default 18 °C or 65 °F)
gddBasenumbernoGrowing degree day base temperature (default 10 °C or 50 °F)
unitsstringnocelsius (default) or fahrenheit; bases are in the same unit

Example request

curl -i "https://agent402.tools/api/degree-days?lat=41.8781&lon=-87.6298&start=2025-01-01&end=2025-01-31"

Watch a call get paid

RequestGET /api/degree-days
402$0.004 USDC
SignPAYMENT-SIGNATURE
Settleon 14 chains
Answer200 OK
ReceiptAgent402-ReceiptEd25519

Example response

{
  "lat": 41.8781,
  "lon": -87.6298,
  "start": "2025-01-01",
  "end": "2025-01-31",
  "units": "°C",
  "base": 18,
  "gddBase": 10,
  "totals": {
    "hdd": 728.8,
    "cdd": 0,
    "gdd": 0,
    "days": 31,
    "pastDays": 31,
    "forecastDays": 0
  },
  "days": [
    {
      "date": "2025-01-01",
      "kind": "past",
      "tMax": 0.8,
      "tMin": -3.6,
      "tMean": -1.4,
      "hdd": 19.4,
      "cdd": 0,
      "gdd": 0
    }
  ],
  "method": "Daily mean = (high + low) / 2; HDD = max(0, base - mean), CDD = max(0, mean - base), GDD = max(0, mean - gddBase).",
  "source": "archive-api.open-meteo.com and api.open-meteo.com (CC BY 4.0)",
  "credit": "Contains modified Copernicus Climate Change Service information. Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.",
  "attributionText": "Weather data by Open-Meteo.com (CC BY 4.0).",
  "sourceUrl": "https://open-meteo.com/",
  "licenseUrl": "https://creativecommons.org/licenses/by/4.0/"
}
FieldTypeAlways presentIn the example
latnumberyes41.8781
lonnumberyes-87.6298
startstringyes2025-01-01
endstringyes2025-01-31
unitsstringyes°C
basenumberyes18
gddBasenumberyes10
totalsobjectyes6 fields: hdd, cdd, gdd, days, pastDays and 1 more
daysarray of objectsyes1 item in the example
methodstringyesDaily mean = (high + low) / 2; HDD = max(0, base - mean), CDD = max(0, mean -...
sourcestringyesarchive-api.open-meteo.com and api.open-meteo.com (CC BY 4.0)
creditstringyesContains modified Copernicus Climate Change Service information. Neither the ...
attributionTextstringyesWeather data by Open-Meteo.com (CC BY 4.0).
sourceUrlstringyeshttps://open-meteo.com/
licenseUrlstringyeshttps://creativecommons.org/licenses/by/4.0/

From an MCP client

catalog.call {
  "slug": "degree-days",
  "params": {
    "lat": 41.8781,
    "lon": -87.6298,
    "start": "2025-01-01",
    "end": "2025-01-31"
  }
}

Hosted connector (https://agent402.tools/mcp): paid in the call. Stdio package (npx -y agent402-mcp@0.19.2): pays from a wallet or AGENT402_CREDITS_KEY.

Errors and behavior

Paid call (JavaScript agent)

import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
client.setSpendControls?.({ maxAmountPerPayment: "$0.004" }); // refuse any quote above this tool's price
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agent402.tools/api/degree-days?lat=41.8781&lon=-87.6298&start=2025-01-01&end=2025-01-31");

Get a wallet or run npx -y agent402-mcp@0.19.2 wallet new.

The quote (Python)

import base64, json, urllib.error, urllib.request

req = urllib.request.Request("https://agent402.tools/api/degree-days?lat=41.8781&lon=-87.6298&start=2025-01-01&end=2025-01-31", method="GET", headers={})
try:
    urllib.request.urlopen(req)
except urllib.error.HTTPError as e:
    quote = json.loads(base64.b64decode(e.headers["PAYMENT-REQUIRED"]))
    print(e.code, [(a["network"], a["amount"]) for a in quote["accepts"]])  # the price, per chain, in base units

Part of these workflows

Guides that use this tool

Related tools