# Heating & Cooling Degree Days for Any Address - No API Key (`that_red_bird/degree-days-by-location`) Actor

Energy bills track the weather. Give addresses or lat/lng and a base temperature, get heating and cooling degree days for any period from NASA POWER (worldwide, no key), plus an optional kWh-vs-HDD regression for M\&V and energy reports.

- **URL**: https://apify.com/that_red_bird/degree-days-by-location.md
- **Developed by:** [mohamed alaya](https://apify.com/that_red_bird) (community)
- **Categories:** Other, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 location periods

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Heating & Cooling Degree Days for Any Address - No API Key

Give it addresses (or lat/lng) and a base temperature, and it returns heating degree days (HDD) and cooling degree days (CDD) for any period back to 1981, month by month, from NASA POWER. No API key, worldwide.
Built for energy managers, M\&V and ESG consultants, facility teams and anyone normalising energy bills for weather. Optionally fits kWh against degree days for you.

### Example inputs

**1. One address, US convention (65 F base), full year**

```json
{ "locations": ["350 5th Ave, New York, NY"], "startDate": "2024-01-01", "endDate": "2024-12-31", "unit": "F", "baseTemperature": 65, "coolingBaseTemperature": 65 }
```

**2. Several sites in Celsius, UK/EU style bases (15.5 C heating, 22 C cooling, whole numbers)**

```json
{ "locations": ["51.5074,-0.1278", "48.8566,2.3522", "Berlin, Germany"], "unit": "C", "baseTemperature": 16, "coolingBaseTemperature": 22, "startDate": "2023-01-01", "endDate": "2023-12-31" }
```

**3. Weather-normalise a building: regression of monthly kWh against HDD**

```json
{ "locations": ["40.7128,-74.0060"], "startDate": "2024-01-01", "endDate": "2024-12-31",
  "consumption": [ {"period":"2024-01","kwh":18200}, {"period":"2024-02","kwh":16900}, {"period":"2024-03","kwh":14100}, {"period":"2024-04","kwh":11800}, {"period":"2024-05","kwh":9800}, {"period":"2024-06","kwh":10400} ] }
```

### Input guide

| Field | What it does |
|---|---|
| `locations` | Addresses, place names, or `"lat,lng"`. Coordinates skip geocoding. |
| `startDate`, `endDate` | `YYYY-MM-DD`. Days not yet published by NASA (the last few days) show up as `daysMissing`. |
| `unit` | `F` or `C`. Degree days come out in that unit. |
| `baseTemperature` | Heating balance point (whole number). `coolingBaseTemperature` is the cooling one. |
| `includeMonthly` / `includeDaily` | Add a month-by-month array / the daily values to each row. |
| `consumption` | Monthly kWh to regress (needs 4+ complete months). Add `"location"` to target a site when you list several. |
| `regressionUseCooling` | Fit baseload + a x HDD + b x CDD (needs 6+ months). |

### Output

One `location-period` row per location (one `regression-fit` row per fitted model, and `error` rows that are never charged).

| Field | Meaning |
|---|---|
| `resolvedAs`, `lat`, `lng`, `geocoder` | What the address turned into |
| `hdd`, `cdd` | Totals for the whole period, in the chosen unit |
| `monthly[]` | `month`, `hdd`, `cdd`, `meanTemp`, `daysWithData`, `daysMissing` |
| `daysWithData`, `daysMissing` | Completeness of the period |
| regression row | `baseloadKwhPerMonth`, `kwhPerHdd`, `kwhPerCdd`, `r2`, `cvRmsePct`, `nmbePct`, `meetsAshrae14Monthly`, `fitted[]` |

Sample row (trimmed): `{"type":"location-period","location":"40.7128,-74.0060","unit":"F","baseHeating":65,"baseCooling":65,"hdd":4301,"cdd":890.4,"daysWithData":366,"daysMissing":0}`

### Use it with

- Google Maps scraper or a CRM export of building addresses -> this Actor -> weather-normalised energy benchmarking.
- Utility-bill extractors -> `consumption` -> this Actor's regression -> baseload and weather sensitivity per site.

### FAQ

**Where does the weather come from?** NASA POWER (MERRA-2 reanalysis), the daily mean 2 m air temperature of the grid cell around your point (about 50 km wide). It is free, key-less and NASA open data. It is not a weather station.
**How close is it to degreedays.net or a station?** Usually within a few percent for annual totals, but a grid cell smooths out urban heat and hills, and a daily-mean method differs slightly from min/max or hourly methods. Use it for screening and portfolios, and verify with station data where an audit requires it.
**Why not Open-Meteo?** Its free tier is non-commercial, so this Actor does not use it.
**Geocoding?** OpenStreetMap Nominatim at 1 request per second with Photon as a fallback; (c) OpenStreetMap contributors, ODbL. Pass `lat,lng` to avoid it.
**Is the regression M\&V-grade?** It is a monthly least-squares screening fit and reports ASHRAE Guideline 14 style CV(RMSE) and NMBE, but a formal M\&V report needs your own validation.

### Limits

Grid-cell temperature, not station data. Daily mean method only. Up to 15 years per location per run. Latest days may be missing. Monthly regression only.

### Price

Pay per event: `location-period` $0.002 per location, `regression-fit` $0.01 per fitted model. Example: 50 sites for a year = $0.10, plus $0.01 for each site you regress. Failed locations are free.

# Actor input Schema

## `locations` (type: `array`):

Street addresses, place names, or coordinates written as "lat,lng" (for example "40.7128,-74.0060"). Addresses are geocoded with OpenStreetMap Nominatim at 1 request per second; coordinates skip geocoding entirely.

## `startDate` (type: `string`):

First day of the period, YYYY-MM-DD. NASA POWER daily data starts in 1981.

## `endDate` (type: `string`):

Last day of the period, YYYY-MM-DD. Dates in the future or in the last few days (not yet published by NASA) are reported as missing days.

## `unit` (type: `string`):

F gives degree-days in Fahrenheit (US convention, base 65 F). C gives degree-days in Celsius (base 15.5 or 18 C are common in Europe).

## `baseTemperature` (type: `integer`):

Balance-point temperature for heating degree days, in the unit chosen above. A day colder than this adds (base - daily mean) to the HDD total.

## `coolingBaseTemperature` (type: `integer`):

Balance-point temperature for cooling degree days, in the unit chosen above. A day warmer than this adds (daily mean - base) to the CDD total.

## `includeMonthly` (type: `boolean`):

Add a month-by-month HDD/CDD array to every location row. Needed for the regression.

## `includeDaily` (type: `boolean`):

Add the daily mean temperature, HDD and CDD for every day to the location row. Makes rows larger; the price per location does not change.

## `consumption` (type: `array`):

Monthly energy use to regress against degree days, as a list like \[{"period":"2024-01","kwh":18200},...]. Add "location" (same text as in Locations) when you have several sites; without it the data is applied to the first location. Needs at least 4 months. Each fitted model is billed as one regression-fit event.

## `regressionUseCooling` (type: `boolean`):

Fit consumption = baseload + a x HDD + b x CDD instead of HDD only. Use for buildings with electric cooling. Needs at least 6 months.

## `contactEmail` (type: `string`):

Sent in the User-Agent to Nominatim as its usage policy asks. Leave empty to use the Actor's default contact.

## Actor input object example

```json
{
  "locations": [
    "40.7128,-74.0060",
    "51.5074,-0.1278"
  ],
  "startDate": "2024-01-01",
  "endDate": "2024-12-31",
  "unit": "F",
  "baseTemperature": 65,
  "coolingBaseTemperature": 65,
  "includeMonthly": true,
  "includeDaily": false,
  "consumption": [],
  "regressionUseCooling": false,
  "contactEmail": ""
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `downloadCsv` (type: `string`):

No description

## `summary` (type: `string`):

No description

## `count` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "locations": [
        "40.7128,-74.0060",
        "51.5074,-0.1278"
    ],
    "startDate": "2024-01-01",
    "endDate": "2024-12-31",
    "unit": "F",
    "baseTemperature": 65,
    "coolingBaseTemperature": 65,
    "includeMonthly": true,
    "includeDaily": false,
    "consumption": [],
    "regressionUseCooling": false,
    "contactEmail": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("that_red_bird/degree-days-by-location").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "locations": [
        "40.7128,-74.0060",
        "51.5074,-0.1278",
    ],
    "startDate": "2024-01-01",
    "endDate": "2024-12-31",
    "unit": "F",
    "baseTemperature": 65,
    "coolingBaseTemperature": 65,
    "includeMonthly": True,
    "includeDaily": False,
    "consumption": [],
    "regressionUseCooling": False,
    "contactEmail": "",
}

# Run the Actor and wait for it to finish
run = client.actor("that_red_bird/degree-days-by-location").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "locations": [
    "40.7128,-74.0060",
    "51.5074,-0.1278"
  ],
  "startDate": "2024-01-01",
  "endDate": "2024-12-31",
  "unit": "F",
  "baseTemperature": 65,
  "coolingBaseTemperature": 65,
  "includeMonthly": true,
  "includeDaily": false,
  "consumption": [],
  "regressionUseCooling": false,
  "contactEmail": ""
}' |
apify call that_red_bird/degree-days-by-location --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,that_red_bird/degree-days-by-location"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/L2k85aRofnfY8osxI/builds/K2bVbVJZVbrZmRhRQ/openapi.json
