An average day on the grid

Average hour of the day over the last 90 days. Batteries charge on midday solar (below zero) and discharge into the evening.

the green bars dip below zero around noon (batteries soaking up solar) and jump up after the orange solar line falls at sunset. That evening bump is batteries covering the crunch.

Key takeaways

    What is this? Are batteries keeping the lights on after sunset?

    show

    U.S. grids, led by California and Texas, now get a huge share of their electricity from solar panels. That creates a daily problem, and giant batteries are becoming the fix. This project automatically collects the U.S. government’s hourly power-grid data every morning, checks it, stores it, and measures how much batteries are actually helping.

    The problem: the evening crunch

    Solar floods the grid at midday, then vanishes at sunset, right when people get home and switch everything on. That leaves a steep evening gap that other power plants (mostly natural gas) have to fill fast.

    The fix: store the sun for later

    Grid-scale batteries (like Tesla Megapacks) charge at noon on surplus solar and discharge in the evening, shifting clean energy into the hours when it’s needed most.

    This project: an automated data pipeline

    Every morning, with no human involved, it downloads yesterday’s hourly data from the U.S. Energy Information Administration (EIA), runs quality checks, loads it into a SQL database, analyzes it and republishes this page.

    How to read this page: pick one of the seven grids below. The takeaways and headline numbers summarize the latest data; hover any i for a definition. The tabs go deeper: Compare grids (every stat side by side, plus weather and imports), EV charging (when an electric car is cleanest to charge, with a calculator), Batteries (how the fleet behaves), Carbon & mix (how clean the grid is), Anomalies (unusual readings the pipeline flagged) and Data quality (proof every load was checked). Terms are explained in the glossary at the bottom.

    How much of the evening crunch do batteries cover?

    Share of each day's net-peak hour (demand minus solar and wind) supplied by batteries, 7-day rolling average. Batteries target the net peak, the hardest hour after sunset, not the gross demand peak.

    a line climbing over the year means batteries are covering a bigger share of the hardest hour of the day. Higher is better. Grids under 3% start hidden; click a name in the legend to show or hide it. Grids with no line don’t report battery data.

    Records

    All-time highs (and lows) in the database for the selected grid.

    How well did the grid predict demand?

    How far EIA's day-ahead demand forecast missed actual demand (7-day rolling MAPE).

    spikes are days the forecast missed badly, often heat waves or storms. Those are exactly the days batteries and spare capacity matter most.

    Seven grids, side by side

    One row per grid, computed from the full year of data. Click a column header to sort; click a row to switch the whole page to that grid. A dash means the grid doesn’t report that data to EIA. For example, PJM and New York have no separate battery category, and New York’s solar is mostly rooftop panels that the grid feed doesn’t count. A dash means “not reported,” never zero.

    compare California’s battery share of the net peak with grids that barely have batteries yet, or which grids lean on their neighbors for power (import hours). Bold = the leader in each column.

    Hotter days, higher demand

    Each dot is one day: that day’s peak electricity demand vs. the high temperature in the grid’s main city (weather from Open-Meteo, joined to grid data by hour).

    the “V” shape: demand climbs on cold days (heating) and climbs faster on hot days (air conditioning). The line’s slope on hot days is how many extra megawatts each degree costs.

    Buying from the neighbors

    Average net power flow with neighboring grids by hour of day, last 90 days. Above zero = exporting, below zero = importing.

    many grids export their midday solar surplus and import in the evening. Batteries let a grid keep more of its own solar for the evening instead of buying power then.

    Who’s leading on batteries?

    Share of each day’s evening net peak covered by batteries, average of the last 30 days, by grid.

    When should you charge an EV?

    CO₂ per mile driven, depending on the hour the car was charged. Because the grid’s mix changes through the day, the same EV can be much cleaner or dirtier depending on when it plugs in. The dashed line is an average gas car.

    the dip in the middle of the day is solar. Charging then is the cleanest. The higher the line in the evening, the more that hour leans on gas plants. Every point below the dashed line beats a gasoline car.

    Your EV vs. a gas car: a calculator

    Plug in your driving and when you usually charge. Results use the last 90 days of real grid data for the selected region.

    Cleanest hours to charge this week

    Based on the last 7 days of grid data. Shift charging toward these hours if you can.

    How this is calculated

    EV g CO₂/mile = grid intensity (g CO₂ per kWh, which equals kg per MWh) × the car’s kWh per mile. EPA window-sticker efficiency is measured at the wall, so charging losses are included. Gas car: EPA’s 8,887 g CO₂ per gallon ÷ 22.2 mpg ≈ 400 g/mile. Both figures exclude upstream emissions (oil refining, fuel and plant supply chains), and grid intensity is an hourly average, not the marginal plant.

    When batteries charge and discharge, all year

    Average battery output by week (rows) and local hour (columns). Blue = charging, red = discharging. Watch the midday charging band and the evening discharge band, and how both grow over the year.

    each row is one week, each column an hour of the day. A blue band at midday (charging) and a red band in the evening (discharging) that get stronger over the year mean a bigger, busier battery fleet.

    How much energy comes back out? (round-trip efficiency)

    Energy delivered ÷ energy stored, by month. Lithium-ion fleets typically return about 80–90%.

    values inside the shaded 80–90% band are normal for lithium-ion batteries; the rest is lost as heat. A jump far outside it usually means a data problem, not physics.

    How hard is the fleet working? (full-power hours)

    Daily discharge ÷ the fleet's recent peak output: how many hours of flat-out discharge each day represents (7-day average).

    about 4 hours means the fleet does roughly one full charge-and-discharge cycle a day (most grid batteries are built to run 4 hours at full power).

    Battery energy delivered each month

    Energy sent to the grid by battery storage, per month.

    taller bars over time mean more battery energy reaching the grid each month. Faded bars are partial months (the current one, or the first month of data), so they’re not a real decline.

    Top-10 demand days

    Battery output at each day's gross demand peak, usually small, because that peak comes before sunset.

    How dirty is the grid at each hour?

    Average kg of CO₂ per MWh generated, by local hour. Dots mark when batteries charge (blue) and discharge (red).

    blue dots (charging) sit low, when the grid is clean; red dots (discharging) sit higher, when it’s dirtier. Batteries move clean midday energy into dirtier evening hours.

    Where the electricity comes from

    Monthly share of generation by fuel. Batteries are excluded because they store energy rather than generate it.

    how much of each month’s electricity came from each source. Watch solar (yellow) grow into summer and gas fill the gaps.

    How carbon is estimated

    Each hour's intensity is the generation-weighted average of EIA emission rates (coal ≈ 2,257 lb/MWh, natural gas ≈ 976 lb/MWh; renewables and nuclear 0). Batteries are left out of the mix because their emissions belong to whatever charged them. The battery CO₂ figure compares average grid intensity when batteries charge vs. when they discharge. It's an average-intensity estimate; the rigorous measure, marginal intensity, needs plant dispatch data that EIA's hourly feed doesn't include.

    Unusual readings the pipeline flagged

    Last 30 days, hourly. Points are flagged by a robust z-score against the same local hour on the prior 28 days (|z| ≥ 4), or as flatlines (a non-zero value stuck for 8+ hours, which usually means a frozen sensor or a stale feed).

    red diamonds are hours that looked very different from the same hour on recent days. Some are real events (heat waves, cloudy days), some are data glitches. Either way, the pipeline flags them automatically.

    Every load was checked: data-quality results, run by run

    Every batch is checked before it's loaded. Errors stop the load; warnings are logged. Each column is one pipeline run (newest on the right). Hover a cell for details.

    ✓ passed ! warning ✕ failed (blocks the load)

    a column of green checks means that run’s data passed every test before it was saved. A red ✕ means the pipeline refused to load bad data, which is the point.

    Spark cross-check

    Every morning the data is also exported to a Parquet “data lake” (partitioned by grid and month) and the net-peak analysis is re-run in Apache Spark. The Spark answer must match the SQL answer day for day, or the run fails.

    Quarantined values

    Individual readings that were physically impossible (for example, demand below zero or far above a grid’s all-time record). They’re set aside here with the reason, so they don’t block the rest of the day’s data, and they’re never silently loaded or dropped.

    Pipeline runs

    Every run is logged with its window, rows loaded and status. A failed scheduled run opens a GitHub issue automatically.

    How it works

    ExtractEIA API v2, paginated, retries
    →
    Raw JSONreplayable snapshots
    →
    Transformpandas, UTC, code mapping
    →
    Quality gatecompleteness, nulls, ranges
    →
    LoadSQL, idempotent upserts
    →
    Analyticsanomalies, carbon, batteries
    →
    This pagedaily via GitHub Actions, Airflow DAG

    Stack: Python, pandas, SQLite, SQL window functions, Airflow, GitHub Actions, pytest, Plotly.js

    Glossary

    Megawatt-hour (MWh) / gigawatt (GW)
    Units of electricity. One MWh is roughly what 30 U.S. homes use in a day. A GW is 1,000 megawatts of power at one moment.
    CAISO & ERCOT
    The grid operators for most of California (California Independent System Operator) and most of Texas (Electric Reliability Council of Texas).
    Duck curve
    The shape of “demand minus solar” over a day: a deep midday dip (the duck’s belly) and a steep evening ramp (its neck) as solar fades.
    Net peak
    The hour when demand minus solar and wind is highest: the hardest hour for the rest of the grid. Batteries aim at it.
    Round-trip efficiency
    Energy a battery gives back ÷ energy put in. 85% means 15% is lost to heat and electronics.
    Carbon intensity
    kg of CO₂ emitted per MWh generated. Lower is cleaner. Solar, wind, hydro and nuclear count as zero; coal and gas don’t.
    Data pipeline (ETL)
    Software that automatically Extracts data from a source, Transforms (cleans) it and Loads it into a database, on a schedule.
    Data-quality check
    An automatic test data must pass before it’s saved, like “no missing hours” or “demand can’t be negative.” Failing data is rejected, not stored.
    Anomaly
    A reading far outside its normal range for that hour. Real events (heat waves, outages) and data glitches both show up.
    ISO / RTO (the seven grids)
    Independent organizations that run the power grid and wholesale market for a region: CAISO (California), ERCOT (Texas), PJM (13 Mid-Atlantic and Midwest states plus DC), MISO (the Midwest and parts of the South), SPP (the Great Plains), NYISO (New York) and ISO-NE (New England).
    Interchange (imports / exports)
    Power flowing between neighboring grids. A grid “imports” when it buys more than it sells in an hour.
    Spark & Parquet
    Apache Spark processes data in parallel across many machines; Parquet is a columnar file format it reads efficiently. Partitioning files by grid and month lets Spark skip folders a query doesn’t need (“partition pruning”).
    Quarantine
    Where impossible individual values are set aside, with the reason, instead of being loaded or silently deleted. A batch only fails if too many values (over 1%) need quarantining.
    Energy balance check
    A data-quality test: demand should equal generation minus exports. Each grid reports all three separately, so a mismatch reveals a broken data feed.
    g CO₂ per mile
    How much carbon dioxide is released per mile driven: from the tailpipe for a gas car, from power plants for an EV. An average gas car emits about 400.
    EIA
    The U.S. Energy Information Administration, the federal agency that publishes this hourly grid data for free.