GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Maps, GIS and field navigation / globalgrid2050 / repd_grid_atlasv7

GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v7 Page and 2 more files

A web page that draws grid 400kV, grid 275kV, grid 220kV and grid 132kV. Published at https://globalgrid2050.com/repd_grid_atlasv7/.

602 lines of Python and HTML from globalgrid2050, in 3 files. Topic: Maps, GIS and field navigation. Section 499 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v7 Page render · globalgrid2050 / repd_grid_atlasv7/index.html lines 1–266
  2. Fetch Heavy Emitters Ukv7 storage · globalgrid2050 / repd_grid_atlasv7/scripts/fetch_heavy_emitters_ukv7.py lines 1–198
  3. Fetch NAEI Point Sources v7 storage · globalgrid2050 / repd_grid_atlasv7/scripts/fetch_naei_point_sourcesv7.py lines 1–138

GlobalGrid2050 — Renewable Energy Planning Database (REPD) Grid Atlas v7 Page

A web page that draws grid 400kV, grid 275kV, grid 220kV and grid 132kV. Published at https://globalgrid2050.com/repd_grid_atlasv7/.

renderglobalgrid2050 / repd_grid_atlasv7/index.html · lines 1–266 of 266 · Entry point

What it does
It draws grid 400kV, grid 275kV, grid 220kV and grid 132kV. Side effects: changes the web page (DOM).
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: 400kV, 275kV, 220kV, 132kV, 66kV, 11kV.
Inputs & outputs
In: GeoJSON file grid_400kv.geojson; GeoJSON file grid_275kv.geojson; GeoJSON file grid_220kv.geojson; GeoJSON file grid_132kv.geojson; GeoJSON file grid_66kv.geojson; GeoJSON file grid_11kv_ukpn.geojson; GeoJSON file grid_substations.geojson; GeoJSON file power_plants.geojson. Out: web page. Voltage levels named: 400kV, 275kV, 220kV, 132kV, 66kV, 11kV.
Downstream impact
Used directly by 8 files: GlobalGrid2050 Historical Builds (globalgrid2050, https://globalgrid2050.com/historical_builds.html); Homepage V030 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v030.html); Homepage V031 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v031.html); Homepage V032 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v032.html); and 4 more. Reached from 87 other entry points, including GlobalGrid2050 Homepage Before Four Nests (globalgrid2050, https://globalgrid2050.com/homepage-before-four-nests-20260925.html); Homepage V037 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v037.html); Homepage V038 (globalgrid2050, https://globalgrid2050.com/homepage_versions/homepage_v038.html). It is itself an entry point, published at https://globalgrid2050.com/repd_grid_atlasv7/.
What it achieves
UK Region v7 (Experimental). Its code works with 100 kW, 11 kV and 132 kV.
Why it matters
Loaded by the GlobalGrid2050 Historical Builds map page at https://globalgrid2050.com/historical_builds.html and 7 other pages.
Application
globalgrid2050 · repd_grid_atlasv7 · page
Uses
Ventus v6 (stylesheet), Ventus Corev7engine (script src), https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css, https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js
Used by
named by URL in GlobalGrid2050 Historical Builds (estate URL), named by URL in Homepage V030 (estate URL), named by URL in Homepage V031 (estate URL), named by URL in Homepage V032 (estate URL), named by URL in Homepage V033 (estate URL), named by URL in Homepage V034 (estate URL), named by URL in Homepage V035 (estate URL), named by URL in Homepage V036 (estate URL)
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv7/index.html:1-266 · blob 2c54e2744af7ace1c4373d31cf5f912f4a57193a · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
<!DOCTYPE html>

<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>GlobalGrid2050 | UK Region v7 (Experimental)</title>
    <link href="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.css" rel="stylesheet" />
    <link href="ventusv7.css" rel="stylesheet" />
</head>
<body>

<div id="fatal-banner">CRITICAL ERROR: SYSTEM DEPENDENCIES FAILED TO LOAD</div>
<button id="btn-fullscreen-exit" onclick="exitFullscreen()">✕ Exit</button>
<div id="fs-curtain-tab">⬇ Layers</div>
<div id="fs-curtain"><div id="fs-curtain-keys"></div></div>
<div id="fs-letterhead">
    <div class="ventus-main">Ventus</div>
    <div class="ventus-sub">Cables &amp; Connectivity&reg;</div>
</div>

<div class="dashboard">
    <div class="hud-header">
        <div>
            <small style="color:#888">SYSTEM TIME</small><br>
            <span class="hud-val" id="clock">--:--:--</span><br>
            <span id="date" style="font-size: 11px; color: #888;">--/--/----</span>
        </div>
        <div class="ventus-brand">
            <div class="ventus-main">Ventus</div>
            <div class="ventus-sub">Cables &amp; Connectivity&reg;</div>
        </div>
        <div style="text-align:right"><small style="color:#888">2050 TARGET</small><br><span class="hud-val" id="days" style="color:#ff9d00">-- DAYS</span></div>
    </div>

```
<div class="map-container" id="map-container">
    <div id="map"></div>
    <div class="custom-map-attrib">
        Data © <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="noopener noreferrer">OpenStreetMap contributors</a> | © CARTO | EV data © <a href="https://openchargemap.org" target="_blank" rel="noopener noreferrer">Open Charge Map</a>
    </div>
    <button id="btn-fullscreen" onclick="enterFullscreen()" title="Fullscreen">⛶</button>
    <div class="search-bar-wrapper">
        <div style="position:relative">
            <input class="search-input" id="search-input" type="text" placeholder="Search project name..." autocomplete="off" />
            <div class="search-results" id="search-results"></div>
        </div>
        <button class="search-btn" id="search-btn">GO</button>
    </div>

    <div class="map-controls">
        <button class="map-ctrl-btn" id="btn-export">⬇ Export CSV</button>
        <button class="map-ctrl-btn" id="btn-radius">◎ Radius Search</button>
        <button class="map-ctrl-btn" id="btn-radius-area">◵ Radius Area</button>
        <button class="map-ctrl-btn" id="btn-zonedraw">⬡ Poly Zone</button>
        <button class="map-ctrl-btn" id="btn-status">◑ Status Colours</button>
        <button class="map-ctrl-btn" id="btn-measure">📏 Measure</button>
    </div>

    <div class="radius-popup" id="radius-popup">
        <label>Radius from click</label>
        <div class="radius-input-row">
            <input type="number" id="radius-input" value="10" min="1" max="160" step="1" />
            <span class="radius-unit">km</span>
        </div>
        <div class="radius-hint">1 – 160 km (100 mi) · press Enter to apply</div>
    </div>

    <div class="radius-popup" id="radius-area-popup">
        <label>Measure Area from click</label>
        <div class="radius-input-row">
            <input type="number" id="radius-area-input" value="1" min="0.001" max="160" step="0.001" />
            <span class="radius-unit">km</span>
        </div>
        <div class="radius-hint">Input radius: 0.001 (1m) to 160 km</div>
    </div>

    <div class="radius-popup" id="zonedraw-display">
        <label class="polyzone-label">🔶 Poly Zone Tool</label>
        <div class="radius-input-row">
            <input type="number" id="zonedraw-radius-input" value="2" min="0.1" max="160" step="0.1" />
            <span class="radius-unit">km</span>
        </div>
        <div class="radius-hint">Set starting radius, then click map to create zone</div>
        <button id="btn-zonedraw-undo" title="Undo last vertex" style="margin-top:8px;background:#ff6600;color:#000;border:none;padding:6px 12px;border-radius:4px;cursor:pointer;font-weight:bold;font-size:12px;">↩ Undo Point</button>
    </div>

    <div id="measure-display">
        <div class="m-row" id="m-line" style="display:none">━━ <span id="m-km"></span> km | <span id="m-m"></span> m | <span id="m-mi"></span> mi</div>
        <div class="m-row" id="m-perim" style="display:none">Perimeter: <span id="m-pkm"></span> km | <span id="m-pm"></span> m</div>
        <div class="m-row" id="m-area" style="display:none">Area: <span id="m-km2"></span> km² | <span id="m-ha"></span> ha | <span id="m-ac"></span> ac</div>
        <div class="m-hint" id="m-hint">Click to add points · Double-click to close polygon</div>
        <button id="btn-measure-undo" title="Undo last point">↩ Undo Point</button>
    </div>

    <div id="polyzone-display">
        <div class="m-row" id="pz-area" style="display:none">
            <span id="pz-km2"></span> km² · <span id="pz-ha"></span> ha<br>
            <span id="pz-ac"></span> ac · <span id="pz-mi2"></span> mi²<br>
            <span id="pz-m2"></span> m²<br>
            <span style="color:#ffae00">⚽ <span id="pz-pitch"></span> pitches</span>
        </div>
        <div class="m-row" id="pz-perim" style="display:none">
            <span style="color:#555;font-size:9px">perimeter <span id="pz-pkm"></span> km</span>
        </div>
        <div class="m-hint" id="pz-hint">Click map to drop circle</div>
        <button id="btn-polyzone-undo" title="Undo last vertex">↩ Undo Vertex</button>
    </div>

    <div class="podcast-shoutout">In support of The Future of Solar Photovoltaics podcast<br>&amp; all participants to date</div>
</div>

<div class="scada-wrapper">
    <div class="scada-brand">
        <div>
            <div class="scada-brand-main">Ventus</div>
            <div class="scada-brand-sub">Cables &amp; Connectivity&reg;</div>
        </div>
        <div class="scada-brand-tag">globalgrid2050.com | open infrastructure intelligence</div>
    </div>
    <div class="status-legend">
        <div class="status-dot"><span style="background:#00ff88"></span>Operational</div>
        <div class="status-dot"><span style="background:#ffcc00"></span>Under Construction</div>
        <div class="status-dot"><span style="background:#ff8800"></span>Consented</div>
        <div class="status-dot"><span style="background:#8888ff"></span>Applied</div>
    </div>
    <div class="scada-keys" id="scada-ui-container"></div>
    <div class="disclaimer-box">
        This interface is based on publicly available and open source infrastructure data, including public energy datasets such as REPD where applicable. It is presented for analytical and visualisation purposes only and does not include live operational or other non public operational data.
    </div>
</div>
```

</div>

<script src="https://cdn.jsdelivr.net/npm/maplibre-gl@3.6.2/dist/maplibre-gl.js"></script>

<script src="ventus-corev7engine.js"></script>

<script>
    const ukConfig = [
        {
            group: "Topology (GeoJSON)",
            layers: [
                { id: "400",  label: "400kV", color: "#0054ff", type: "line", width: 2.5, url: "data/grid_400kv.geojson", snap: true, preload: true },
                { id: "275",  label: "275kV", color: "#ff0000", type: "line", width: 2.0, url: "data/grid_275kv.geojson", snap: true, preload: true },
                { id: "220",  label: "220kV", color: "#ff9900", type: "line", width: 1.8, url: "data/grid_220kv.geojson", snap: true, preload: true },
                { id: "132",  label: "132kV", color: "#00cc00", type: "line", width: 1.5, url: "data/grid_132kv.geojson", snap: true, preload: true },
                { id: "66",   label: "66kV",  color: "#b200ff", type: "line", width: 1.2, url: "data/grid_66kv.geojson", snap: true, preload: true },
                { id: "11kv", label: "11kV (UKPN)", color: "#ff00ff", type: "point", radius: ['interpolate', ['linear'], ['zoom'], 13.5, 4, 15, 8, 18, 18], url: "data/grid_11kv_ukpn.geojson", minzoom: 13.5, preload: false },
                { id: "subs", label: "Subs",  color: "#ffffff", type: "point", radius: ['interpolate', ['linear'], ['zoom'], 5, 3, 10, 5, 14, 10, 18, 22], url: "data/grid_substations.geojson", isSubs: true, preload: true }
            ]
        },
        {
            group: "Assets (GeoJSON)",
            layers: [
                { id: "nuc",  label: "Nuclear",   color: "#39ff14", type: "point", radius: 4.5, url: "data/power_plants.geojson", filter: ['==', ['get', 'source'], 'nuclear'], preload: true },
                { id: "gas",  label: "Gas",       color: "#ff4500", type: "point", radius: 4.5, url: "data/power_plants.geojson", filter: ['!=', ['get', 'source'], 'nuclear'], preload: true },
                { id: "ind",  label: "Industry",  color: "#ff6600", type: "point", radius: 4.5, url: "data/industrial_offtakers.geojson", preload: true },
                { id: "dc",   label: "Data Ctrs", color: "#00ffff", type: "point", radius: 4.5, url: "data/datacentres.geojson", preload: true },
                { id: "air",  label: "Airports",  color: "#ff00ff", type: "point", radius: 4.5, url: "data/airports.geojson", preload: true },
                { id: "rail", label: "Railways",  color: "#ffd700", type: "point", radius: 4.5, url: "data/railways.geojson", preload: true }
            ]
        },
        {
            group: "Supermarkets (GeoJSON)",
            layers: [
                { id: "tesco",      label: "Tesco",       color: "#ee1c2e", type: "point", radius: 4.5, url: "data/supermarkets_tesco.geojson", preload: false },
                { id: "sainsburys", label: "Sainsbury's", color: "#ff8200", type: "point", radius: 4.5, url: "data/supermarkets_sainsburys.geojson", preload: false },
                { id: "asda",       label: "Asda",        color: "#78be20", type: "point", radius: 4.5, url: "data/supermarkets_asda.geojson", preload: false },
                { id: "morrisons",  label: "Morrisons",   color: "#ffd700", type: "point", radius: 4.5, url: "data/supermarkets_morrisons.geojson", preload: false },
                { id: "aldi",       label: "Aldi",        color: "#003087", type: "point", radius: 4.5, url: "data/supermarkets_aldi.geojson", preload: false },
                { id: "lidl",       label: "Lidl",        color: "#0050aa", type: "point", radius: 4.5, url: "data/supermarkets_lidl.geojson", preload: false },
                { id: "waitrose",   label: "Waitrose",    color: "#7ab800", type: "point", radius: 4.5, url: "data/supermarkets_waitrose.geojson", preload: false },
                { id: "ms",         label: "M&S Food",    color: "#009b77", type: "point", radius: 4.5, url: "data/supermarkets_ms.geojson", preload: false },
                { id: "coop",       label: "Co-op",       color: "#00b1a9", type: "point", radius: 4.5, url: "data/supermarkets_coop.geojson", preload: false },
                { id: "costco",     label: "Costco",      color: "#005daa", type: "point", radius: 4.5, url: "data/supermarkets_costco.geojson", preload: false },
                { id: "booths",     label: "Booths",      color: "#6d2077", type: "point", radius: 4.5, url: "data/supermarkets_booths.geojson", preload: false }
            ]
        },
        {
            group: "Transit (GeoJSON)",
            layers: [
                { id: "elizabeth", label: "Elizabeth Line", color: "#60399E", type: "point", radius: 5, url: "data/elizabeth_line.geojson", preload: false },
                { id: "lu",    label: "London Underground", color: "#e32017", type: "point", radius: 5, url: "data/london_underground.geojson", preload: false },
                { id: "dlr",   label: "DLR", color: "#00afad", type: "point", radius: 5, url: "data/uk_metros_trams.geojson", preload: false,
                  filter: ['all', ['in', 'Docklands', ['get', 'operator']], ['!', ['in', 'London Underground', ['get', 'operator']]]] },
                { id: "metro", label: "UK Metro", color: "#f3a712", type: "point", radius: 5, url: "data/uk_metros_trams.geojson", preload: false,
                  filter: ['any', ['in', 'Tyne', ['get', 'operator']], ['in', 'Metrolink', ['get', 'operator']], ['in', 'Supertram', ['get', 'operator']], ['in', 'Nottingham', ['get', 'operator']], ['in', 'Edinburgh', ['get', 'operator']], ['in', 'Midland Metro', ['get', 'operator']]] },
                { id: "tram",  label: "Trams & Light Rail", color: "#84329b", type: "point", radius: 5, url: "data/uk_metros_trams.geojson", preload: false,
                  filter: ['all', ['==', ['get', 'type'], 'Tram / Light Rail'], ['!', ['in', 'London Underground', ['get', 'operator']]]] },
                { id: "hs2",   label: "HS2", color: "#2c6fad", type: "point", radius: 4, url: "data/hs2.geojson", preload: false },
                { id: "eurostar_route", label: "Eurostar (HS1) UK & Europe", color: "#001489", type: "line", width: 2.5, url: "data/eurostar.geojson", filter: ['==', ['get', 'type'], 'route'], preload: false },
                { id: "eurostar_station", label: "Eurostar Stations UK & Europe", color: "#ffd700", type: "point", radius: 5.5, url: "data/eurostar.geojson", filter: ['==', ['get', 'type'], 'eurostar_station'], preload: false }
            ]
        },
        {
            group: "Leisure & Sports (GeoJSON)",
            layers: [
                { id: "stadiums", label: "Major Stadiums", color: "#e5ff00", type: "point", radius: 5.5, url: "data/stadiums.geojson", preload: false }
            ]
        },
        {
            group: "Global Data Backbone",
            layers: [
                { id: "subsea_data_cables", label: "Subsea Data Cables (Fibre) (not all connections available yet)", color: "#00e5ff", type: "line", width: 1.5, url: "data/subsea_data_cables.geojson", preload: false }
            ]
        },
        {
            group: "Global Supply Chain & Chokepoints",
            layers: [
                { id: "global_ports_major", label: "Major Ports (Deep Water/Ferry)", color: "#00bfff", type: "point", radius: ['interpolate', ['linear'], ['get', 'area_ha'], 0, 8, 80, 10, 500, 16], url: "data/global_ports.geojson", filter: ['==', ['get', 'type'], 'Major Cargo/Container Port'], preload: false },
                { id: "global_ports_minor", label: "Inland / Minor Harbours", color: "#0055aa", type: "point", radius: ['interpolate', ['linear'], ['get', 'area_ha'], 0, 2.5, 50, 4.5, 200, 6], url: "data/global_ports.geojson", filter: ['==', ['get', 'type'], 'Minor/Local Harbour'], preload: false },
                { id: "global_hydrocarbons", label: "Global Hydrocarbons (Oil, Gas, LNG)", color: "#ff3300", type: "point", radius: ['interpolate', ['linear'], ['get', 'area_ha'], 0, 4, 100, 8, 1000, 15], url: "data/global_hydrocarbons.geojson", preload: false }
            ]
        },
        {
            group: "Highway Infrastructure",
            layers: [
                { id: "motorway_services", label: "Motorway Services", color: "#ff00ff", type: "point", radius: 5.5, url: "data/motorway_services.geojson", preload: false }
            ]
        },
        {
            group: "EV (GeoJSON)",
            layers: [
                { id: "ev", label: "EV Rapid (100kW+)", color: "#00ff88", type: "point", radius: 5, url: "data/ev_chargers.geojson", preload: false }
            ]
        },
        {
            group: "Heavy Industry",
            layers: [
                { id: "naei_co2", label: "Major Industrial Sites", color: "#ff4400", type: "point", url: "/heavy_emitters_uk.json", preload: false }
            ]
        },
        {
            group: "REPD (GeoJSON)",
            layers: [
                { id: "solar",      label: "Solar PV",               color: "#ffff00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'solar'],      preload: false },
                { id: "solar_operational", label: "Solar PV (Operational Only)", color: "#00ff88", type: "point", radius: ['interpolate', ['linear'], ['coalesce', ['get', 'capacity'], 0], 0, 10, 10, 14, 50, 18, 100, 22, 200, 28, 350, 35, 500, 42], url: "/dist/repd_master.json", filter: ['all', ['==', ['get', 'tech'], 'solar'], ['==', ['get', 'status'], 'operational']], preload: false },
                { id: "solar_roof", label: "Solar Roof",             color: "#ffcc00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'solar_roof'], preload: false },
                { id: "wind",       label: "Wind",                   color: "#00ffff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'wind'],       preload: false },
                { id: "wind_onshore_operational",  label: "Onshore Wind (Operational Only)",  color: "#00ffcc", type: "point", radius: ['interpolate', ['linear'], ['coalesce', ['get', 'capacity'], 0], 0, 8, 10, 12, 50, 16, 100, 20, 200, 26, 350, 32, 500, 38], url: "/dist/repd_master.json", filter: ['all', ['==', ['get', 'raw_tech'], 'Wind Onshore'], ['==', ['get', 'status'], 'operational']], prelo  … [line shortened here: 412 characters; full line on GitHub]
                { id: "wind_offshore_operational", label: "Offshore Wind (Operational Only)", color: "#0066ff", type: "point", radius: ['interpolate', ['linear'], ['coalesce', ['get', 'capacity'], 0], 0, 8, 10, 12, 50, 16, 100, 20, 200, 26, 350, 32, 500, 38], url: "/dist/repd_master.json", filter: ['all', ['==', ['get', 'raw_tech'], 'Wind Offshore'], ['==', ['get', 'status'], 'operational']], prel  … [line shortened here: 413 characters; full line on GitHub]
                { id: "bess",       label: "Battery Storage",        color: "#ffae00", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'bess'],       preload: false },
                { id: "bess_operational", label: "Battery Storage (Operational Only)", color: "#ff69b4", type: "point", radius: ['interpolate', ['linear'], ['coalesce', ['get', 'capacity'], 0], 0, 8, 10, 12, 50, 16, 100, 20, 200, 26, 350, 32, 500, 38], url: "/dist/repd_master.json", filter: ['all', ['==', ['get', 'tech'], 'bess'], ['==', ['get', 'status'], 'operational']], preload: false },
                { id: "biomass",    label: "Biomass & EfW",          color: "#39ff14", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'biomass'],    preload: false },
                { id: "tidal",      label: "Tidal & Wave",           color: "#00bfff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'tidal'],      preload: false },
                { id: "hydrogen",   label: "Hydrogen",               color: "#ffffff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'hydrogen'],   preload: false },
                { id: "hydro",      label: "Hydro & Pumped Storage", color: "#00aaff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'hydro'],      preload: false },
                { id: "flywheel",   label: "Flywheel",               color: "#ff69b4", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'flywheel'],   preload: false },
                { id: "act",        label: "Advanced Conversion",    color: "#ff6600", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'act'],        preload: false },
                { id: "geothermal", label: "Geothermal",             color: "#ff3300", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'geothermal'], preload: false },
                { id: "caes",       label: "Compressed Air Storage", color: "#88aaff", type: "point", radius: 8, url: "/dist/repd_master.json", filter: ['==', ['get', 'tech'], 'caes'],       preload: false }
            ]
        }
    ];

    window.initVentusMap({
        config: ukConfig,
        center: [-3.5, 54.0],
        zoom: 4.2
    });
</script>

</body>
</html>

Fetch Heavy Emitters Ukv7

A Python command-line tool in the scripts folder of GlobalGrid2050 that fetches naeipoints sources and transformers. It downloads excel (`download_excel`), parses sheet (`parse_sheet`) and validates schema (`validate_schema`).

storageglobalgrid2050 / repd_grid_atlasv7/scripts/fetch_heavy_emitters_ukv7.py · lines 1–198 of 198 · Entry point · pattern discover_latest_url (shared by 2 files)

What it does
It fetches naeipoints sources and transformers. Defines 11 functions or classes, including HeavyEmittersUpdater, __init__, discover_latest_url, download_excel, parse_sheet. Uses libraries pandas, json, os, requests, datetime. Side effects: reads or writes files; makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight. Domain terms in the code: transformers.
Inputs & outputs
In: JSON file heavy_emitters_uk.json; JSON file manifest_heavy_emitters.json; Excel file NAEIPointsSources.xlsx; Excel file NAEIPointsSources_2023.xlsx. Out: JSON file. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Fetch Heavy Emitters UK Workflow (globalgrid2050).
What it achieves
Mission: Identify every major UK industrial emitter.
Why it matters
Run by GlobalGrid2050 Fetch Heavy Emitters UK Workflow.
Application
globalgrid2050 · repd_grid_atlasv7/scripts · Python CLI
Uses
pandas, json, os, requests, datetime, math, pyproj, bs4
Used by
run by GlobalGrid2050 Fetch Heavy Emitters UK Workflow (workflow run)
Produces
HeavyEmittersUpdater
Defines here
HeavyEmittersUpdater, __init__, discover_latest_url, download_excel, parse_sheet, validate_schema, transform, to_co2e, build_geojson, write_outputs, run
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv7/scripts/fetch_heavy_emitters_ukv7.py:1-198 · blob 2f9aafe2782118c8d3f127460f3d2987bf351981 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import pandas as pd
import json
import os
import requests
from datetime import datetime
from math import isfinite
from pyproj import Transformer

# UK HEAVY EMITTERS UPDATER v4.0
# Mission: Identify every major UK industrial emitter. One point per site.
# True CO2-equivalent tonnes including N2O (GWP-298). No compromises.

SOURCE_PAGE_URL = "https://naei.energysecurity.gov.uk/data/maps/emissions-point-sources"
OUTPUT_PATH     = "heavy_emitters_uk.json"
MANIFEST_PATH   = "manifest_heavy_emitters.json"
RAW_PATH        = "data/NAEIPointsSources.xlsx"

SHEET_NAME = "GHGs"
HEADER_ROW = 0

COL_YEAR      = "Year"
COL_PLANTID   = "PlantID"
COL_SITE      = "Site"
COL_EASTING   = "Easting"
COL_NORTHING  = "Northing"
COL_OPERATOR  = "Operator"
COL_SECTOR    = "Sector"
COL_POLLUTANT = "Pollutant_Name"
COL_EMISSION  = "Emission"
COL_COUNTRY   = "Country"
COL_DATATYPE  = "Datatype"

CO2_CARBON_TO_CO2 = 44.0 / 12.0  
N2O_GWP           = 298.0          

UK_LON_MIN, UK_LON_MAX = -9.0,  2.5
UK_LAT_MIN, UK_LAT_MAX = 49.0, 61.0

transformer = Transformer.from_crs("epsg:27700", "epsg:4326", always_xy=True)

class HeavyEmittersUpdater:
    def __init__(self):
        print("UK HEAVY EMITTERS UPDATER v4.0 | BOOTING...")
        print(f"   Timestamp: {datetime.utcnow().isoformat()}Z")
        os.makedirs("data", exist_ok=True)

    def discover_latest_url(self):
        print("\nDiscovering latest UK emissions Excel URL...")
        try:
            from bs4 import BeautifulSoup
            r = requests.get(SOURCE_PAGE_URL, timeout=30,
                             headers={"User-Agent": "Mozilla/5.0 (compatible; VentusBot/4.0)"})
            r.raise_for_status()
            soup = BeautifulSoup(r.text, "html.parser")
            for a in soup.find_all("a", href=True):
                href = a["href"]
                if "NAEIPointsSources" in href and href.endswith(".xlsx"):
                    url = href if href.startswith("http") else f"https://naei.energysecurity.gov.uk{href}"
                    print(f"   Discovered: {url}")
                    return url
        except Exception as e:
            print(f"   Discovery failed: {e}")
        fallback = "https://naei.energysecurity.gov.uk/sites/default/files/2025-09/NAEIPointsSources_2023.xlsx"
        print(f"   Using fallback: {fallback}")
        return fallback

    def download_excel(self, url):
        print("\nDownloading UK emissions Excel (~96MB)...")
        r = requests.get(url, headers={"User-Agent": "Mozilla/5.0 (compatible; VentusBot/4.0)"},
                         timeout=180, stream=True)
        r.raise_for_status()
        with open(RAW_PATH, "wb") as f:
            for chunk in r.iter_content(chunk_size=1024 * 1024):
                f.write(chunk)
        size_mb = os.path.getsize(RAW_PATH) / 1024 / 1024
        print(f"   Downloaded: {size_mb:.1f} MB -> {RAW_PATH}")

    def parse_sheet(self):
        print(f"\nParsing sheet '{SHEET_NAME}' (header row {HEADER_ROW})...")
        df = pd.read_excel(RAW_PATH, sheet_name=SHEET_NAME, header=HEADER_ROW, engine="openpyxl")
        df.columns = [str(c).strip() for c in df.columns]
        return df

    def validate_schema(self, df):
        required = [COL_YEAR, COL_PLANTID, COL_SITE, COL_EASTING, COL_NORTHING,
                    COL_OPERATOR, COL_SECTOR, COL_POLLUTANT, COL_EMISSION,
                    COL_COUNTRY, COL_DATATYPE]
        missing = [c for c in required if c not in df.columns]
        if missing:
            raise SystemExit(1)

    def transform(self, df):
        latest_year = int(df[COL_YEAR].max())
        df = df[df[COL_YEAR] == latest_year].copy()
        
        df[COL_EMISSION] = pd.to_numeric(df[COL_EMISSION], errors="coerce")
        df = df.dropna(subset=[COL_EMISSION])

        def to_co2e(row):
            p = str(row[COL_POLLUTANT]).lower()
            e = float(row[COL_EMISSION])
            if "carbon dioxide" in p:
                return e * CO2_CARBON_TO_CO2
            elif "nitrous oxide" in p:
                return e * N2O_GWP
            else:
                return e

        df["tco2e"] = df.apply(to_co2e, axis=1)

        df_flat = df.groupby(COL_PLANTID, as_index=False).agg({
            COL_SITE:     "first",
            COL_OPERATOR: "first",
            COL_SECTOR:   "first",
            COL_EASTING:  "first",
            COL_NORTHING: "first",
            COL_COUNTRY:  "first",
            COL_DATATYPE: "first",
            "tco2e":      "sum"
        })

        df_flat["tco2e"] = df_flat["tco2e"].round(2)
        return df_flat, latest_year

    def build_geojson(self, df_flat):
        features = []
        for _, row in df_flat.iterrows():
            try:
                easting  = float(row[COL_EASTING])
                northing = float(row[COL_NORTHING])
            except (TypeError, ValueError):
                continue

            if not isfinite(easting) or not isfinite(northing) or easting == 0 or northing == 0:
                continue

            lon, lat = transformer.transform(easting, northing)

            if not (isfinite(lon) and isfinite(lat)):
                continue

            if not (UK_LON_MIN < lon < UK_LON_MAX and UK_LAT_MIN < lat < UK_LAT_MAX):
                continue

            features.append({
                "type": "Feature",
                "geometry": {
                    "type": "Point",
                    "coordinates": [round(lon, 6), round(lat, 6)]
                },
                "properties": {
                    "id":             str(int(row[COL_PLANTID])),
                    "name":           str(row[COL_SITE]).strip(),
                    "operator":       str(row[COL_OPERATOR]).strip(),
                    "sector":         str(row[COL_SECTOR]).strip(),
                    "country":        str(row[COL_COUNTRY]).strip(),
                    "datatype":       str(row[COL_DATATYPE]).strip(),
                    "emission_tco2e": row["tco2e"],
                    "type":           "naei_emitter"
                }
            })

        return {"type": "FeatureCollection", "features": features}

    def write_outputs(self, geojson, source_url, latest_year):
        with open(OUTPUT_PATH, "w", encoding="utf-8") as f:
            json.dump(geojson, f, separators=(",", ":"))

        manifest = {
            "source_url":    source_url,
            "processed_at":  datetime.utcnow().isoformat() + "Z",
            "year_filtered": latest_year,
            "feature_count": len(geojson["features"]),
            "sheet":         SHEET_NAME,
            "output":        OUTPUT_PATH,
            "physics":       "tCO2e: CO2x(44/12) + N2Ox(44/12)x298 GWP-100 AR5"
        }
        with open(MANIFEST_PATH, "w") as f:
            json.dump(manifest, f, indent=2)

    def run(self):
        url = self.discover_latest_url()
        
        # FORCED RUN: Bypassing manifest checks so GitHub Actions ALWAYS generates the file
        self.download_excel(url)
        df = self.parse_sheet()
        self.validate_schema(df)
        df_flat, year = self.transform(df)
        geojson = self.build_geojson(df_flat)

        if len(geojson["features"]) == 0:
            raise SystemExit(1)

        self.write_outputs(geojson, url, year)

if __name__ == "__main__":
    HeavyEmittersUpdater().run()

Fetch NAEI Point Sources v7

A Python command-line tool in the scripts folder of GlobalGrid2050 that fetches naeipoints sources. It downloads excel (`download_excel`), parses sheet (`parse_sheet`) and cleans str (`clean_str`).

storageglobalgrid2050 / repd_grid_atlasv7/scripts/fetch_naei_point_sourcesv7.py · lines 1–138 of 138 · Entry point · pattern download_excel (shared by 2 files)

What it does
It fetches naeipoints sources. Defines 8 functions or classes, including download_excel, discover_sheets, parse_sheet, safe_float, clean_str. Uses libraries pandas, json, os, requests, datetime. Side effects: reads or writes files; makes network requests.
Why it exists in the grid workflow
Domain stage upstream_foresight (path word 'repd'): upstream engineering foresight over GB transmission and distribution topology (TSO/DNO, 132kV and above, the REPD pipeline, data centres), which Ventus Ltd states it models for foresight.
Inputs & outputs
In: Excel file NAEIPointsSources_2023.xlsx; JSON file naei_point_sources.json; Excel file NAEIPointsSources.xlsx. Out: JSON file. Coordinate systems named: OSGB36 / EPSG:27700 (British National Grid), WGS84 / EPSG:4326.
Downstream impact
Used directly by 1 file: GlobalGrid2050 Fetch NAEI Point Sources Workflow (globalgrid2050).
What it achieves
Downloads the NAEI Point Sources Excel from energysecurity.gov.uk.
Why it matters
Run by GlobalGrid2050 Fetch NAEI Point Sources Workflow.
Application
globalgrid2050 · repd_grid_atlasv7/scripts · Python CLI
Uses
pandas, json, os, requests, datetime, math
Used by
run by GlobalGrid2050 Fetch NAEI Point Sources Workflow (workflow run)
Produces
download_excel, discover_sheets, parse_sheet, safe_float, clean_str, build_geojson, write_geojson, main
Defines here
download_excel, discover_sheets, parse_sheet, safe_float, clean_str, build_geojson, write_geojson, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
globalgrid2050@0aca5121f0795e469b6cf4fc3d3b628edba8d883 repd_grid_atlasv7/scripts/fetch_naei_point_sourcesv7.py:1-138 · blob e5d4c9682bf359310408c93ddbb85bd377810eed · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, network · domain stage: upstream_foresight · users: IPP_developer, ICP_grid_engineer · canonical: production_core
import pandas as pd
import json
import os
import requests
from datetime import datetime
from math import isfinite

# ── NAEI POINT SOURCES UPDATER v1.0 ──────────────────────────────────────────
# Downloads the NAEI Point Sources Excel from energysecurity.gov.uk
# Parses to GeoJSON with coordinates, site name, sector, and emissions.
# Outputs: dist/naei_point_sources.json
# Schedule: annual (data updates ~September each year)
# ─────────────────────────────────────────────────────────────────────────────

NAEI_URL = "https://naei.energysecurity.gov.uk/sites/default/files/2025-09/NAEIPointsSources_2023.xlsx"
OUTPUT_PATH = "dist/naei_point_sources.json"
RAW_PATH    = "data/NAEIPointsSources.xlsx"

UK_LON_MIN, UK_LON_MAX = -9.0,  2.5
UK_LAT_MIN, UK_LAT_MAX = 49.0, 61.0

def download_excel():
    os.makedirs("data", exist_ok=True)
    print(f"⬇️  Downloading NAEI Point Sources Excel (~96MB)...")
    headers = {"User-Agent": "Mozilla/5.0 (compatible; VentusBot/1.0)"}
    r = requests.get(NAEI_URL, headers=headers, timeout=120, stream=True)
    r.raise_for_status()
    with open(RAW_PATH, "wb") as f:
        for chunk in r.iter_content(chunk_size=1024 * 1024):
            f.write(chunk)
    size_mb = os.path.getsize(RAW_PATH) / 1024 / 1024
    print(f"✅ Downloaded: {size_mb:.1f} MB → {RAW_PATH}")

def discover_sheets():
    xl = pd.ExcelFile(RAW_PATH, engine="openpyxl")
    print(f"📋 Sheets found: {xl.sheet_names}")
    return xl.sheet_names

def parse_sheet(sheet_name):
    print(f"📊 Parsing sheet: {sheet_name}")
    df = pd.read_excel(RAW_PATH, sheet_name=sheet_name, engine="openpyxl")
    print(f"   Shape: {df.shape}")
    print(f"   Columns: {list(df.columns)}")
    return df

def safe_float(val):
    try:
        v = float(val)
        return v if isfinite(v) else None
    except (TypeError, ValueError):
        return None

def clean_str(val):
    s = str(val).strip() if val is not None else ""
    return "" if s.lower() in ("nan", "none", "") else s

def build_geojson(df, lat_col, lon_col, name_col, sector_col, pollutant_cols):
    features = []
    skipped = 0
    for _, row in df.iterrows():
        lat = safe_float(row.get(lat_col))
        lon = safe_float(row.get(lon_col))
        if lat is None or lon is None:
            skipped += 1
            continue
        if not (UK_LAT_MIN <= lat <= UK_LAT_MAX and UK_LON_MIN <= lon <= UK_LON_MAX):
            skipped += 1
            continue
        props = {
            "name":    clean_str(row.get(name_col, "")),
            "sector":  clean_str(row.get(sector_col, "")),
        }
        # Add each pollutant column if present
        for col in pollutant_cols:
            if col in df.columns:
                v = safe_float(row.get(col))
                if v is not None:
                    props[col.lower().replace(" ", "_").replace("(", "").replace(")", "")] = v
        features.append({
            "type": "Feature",
            "geometry": {"type": "Point", "coordinates": [round(lon, 6), round(lat, 6)]},
            "properties": props
        })
    print(f"✅ Built {len(features)} features ({skipped} skipped - no coords or outside UK)")
    return {"type": "FeatureCollection", "features": features}

def write_geojson(geojson):
    os.makedirs("dist", exist_ok=True)
    with open(OUTPUT_PATH, "w", encoding="utf-8") as f:
        json.dump(geojson, f, separators=(",", ":"))
    size_kb = os.path.getsize(OUTPUT_PATH) / 1024
    print(f"💾 Written: {OUTPUT_PATH} ({size_kb:.0f} KB, {len(geojson['features'])} features)")

def main():
    print("🏭 NAEI POINT SOURCES UPDATER v1.0 | BOOTING...")
    print(f"   Timestamp: {datetime.utcnow().isoformat()}Z")

    download_excel()
    sheets = discover_sheets()

    # Start small: parse just the first sheet to understand the structure
    df = parse_sheet(sheets[0])

    # Auto-detect coordinate columns (NAEI uses Easting/Northing or Lat/Lon)
    cols_lower = {c.lower(): c for c in df.columns}
    print(f"\n🔍 Detecting coordinate columns...")

    # Try WGS84 lat/lon first
    lat_col = next((cols_lower[k] for k in cols_lower if "lat" in k), None)
    lon_col = next((cols_lower[k] for k in cols_lower if "lon" in k or "lng" in k), None)

    if lat_col and lon_col:
        print(f"   Found WGS84 columns: lat={lat_col}, lon={lon_col}")
    else:
        print(f"   ⚠️  No WGS84 columns found - printing all columns for inspection:")
        for c in df.columns:
            print(f"      {c}")
        print("\n⚠️  Cannot build GeoJSON without coordinate columns.")
        print("   Update lat_col/lon_col in this script after inspecting output above.")
        return

    # Auto-detect name and sector columns
    name_col   = next((cols_lower[k] for k in cols_lower if "name" in k or "site" in k), df.columns[0])
    sector_col = next((cols_lower[k] for k in cols_lower if "sector" in k or "source" in k or "activity" in k), "")

    # Auto-detect emission columns (CO2, NOx, SO2, PM, CH4 etc.)
    pollutant_keywords = ["co2", "nox", "sox", "so2", "pm", "ch4", "n2o", "nh3", "nmvoc", "emission", "tonne"]
    pollutant_cols = [c for c in df.columns if any(kw in c.lower() for kw in pollutant_keywords)]
    print(f"   Name col:      {name_col}")
    print(f"   Sector col:    {sector_col}")
    print(f"   Pollutant cols found: {pollutant_cols[:10]}")

    geojson = build_geojson(df, lat_col, lon_col, name_col, sector_col, pollutant_cols)
    write_geojson(geojson)
    print("\n✅ NAEI POINT SOURCES UPDATE COMPLETE")

if __name__ == "__main__":
    main()