Weather Digital Twin (wrf-wudapt)
Imagine you can ask: "If we replace the concrete in this part of the city with grass, how much will the air temperature change?" This project answers that question by running a real weather model twice: once for the city as it is, and once with your proposed change. It then gives you maps and tables of the difference, so planners and GIS analysts can compare options before building anything.
It is a research tool, not a crystal ball. Results depend on the date, weather and the changes you choose, and every run takes time (about 1–2 hours for an 18-hour simulation on a normal laptop).
Quick start (no programming needed)
You need a Linux computer with Podman installed and this project folder checked out. The weather model itself is already prepared inside a container.
- Install the desktop app:
pip install wrf-digital-twin
- Start it with
wrf-twin-gui(or runpython -m wrf_digital_twin.guifrom this folder). - Type a latitude, longitude, radius in kilometres, a UTC start date/time and how many hours to simulate (must be 6, 12, 18...).
- Click 1. Baseline to create the "current city" simulation.
- Choose which land-use class to replace (13 = built-up area) and what to put in its place (10 = grassland), then click 2. Proposal + compare.
- The app writes maps and CSV tables into the output folder. Open
output/results/REPORT.mdto see the numbers that go with them.
If you use QGIS, install the plugin from qgis_plugin/ instead: it gives
you a brush to draw the proposal area directly on the map. See
qgis_plugin/README.md.
A pip-installed app still needs this project folder (with the prepared WRF
container and data). Set Project folder in the app to that location, or set
the environment variable WRF_TWIN_ROOT.
What you can change today: the share of built-up land in a circular area (land use class 13 → 10 by default). Other variables need a new intervention in the engine.
Please remember: the weather data is public GFS archive data from 2021 onwards; the LCZ map covers Europe only; each proposal is a full new weather simulation; and the accuracy check uses ERA5 reanalysis, not a real weather station. Keep the report next to any map you share.
Technical details
This is a rebuild of Urban Climate Modelling Using WRF and WUDAPT Model: A
Case of Milan (Panchagnula Krishna Dutt, Politecnico di Milano, 2020), fixing
the validity problems found in Chapter 4. Everything runs inside a Podman
container; the project directory is bind-mounted at /work.
Case definition (changed from the thesis)
- Thesis: 31 Jul – 1 Aug 2020, NCEP FNL 0.25°.
- Here: 25 Jul 2022, 00–18 UTC (6 h spin-up, 12 h analysis). Reason: FNL 2020
is no longer publicly downloadable without a UCAR/GDEX account; GFS 0.25°
f000files for 2022 are public on AWS S3 and contain soil fields (.anlfiles do not). shortcut: 18 h window instead of a full season; upgrade when compute allows. A two-day run here takes ~6 h of wall time at 3 km with BEP.- Domain centre: 45.4937 N, 9.16646 E (Milan). Nested 9 km / 3 km.
What changes from the thesis
| Thesis (Ch. 4) | Here |
|---|---|
| WRF with default land use; BEP selected but no urban parameters | LCZ-derived urban extent injected into geo_em via w2w (BEP active) |
| LCZ map used only as a post-hoc averaging mask | LCZ drives the urban extent in WRF and the sampling |
| — | shortcut: WRF's 41-category LCZ mode needs a source rebuild (NLUS=61) and a custom VEGPARM.TBL; until then WRF uses default urban morphology. Logged as "USING DEFAULT URBAN MORPHOLOGY" in wrf.log. |
| "Ground truth" = interpolated Dati Lombardia grid | Independent ERA5 point series (GFS vs ERA5 are different analyses); bias/RMSE reported |
| Predictors chosen by >80% correlation with the same output | Features chosen physically; circular variables excluded |
| One run, then ±20/30% LAI into a regression → "cooling" | Counterfactual WRF runs with perturbed land surface |
| "82% accuracy", undefined | RMSE/MAE/R² on LCZ-blocked folds; prediction intervals |
| Gaussian-kernel equation labelled KNN, mis-typed | Explicit, tested model with monotonic constraints and support checks |
Plugin interface (framework built; see qgis_plugin/)
A QGIS plugin will let a user enter a date/year, a lat/lon and a radius, run the
whole engine, and compare two years. The engine therefore stays headless
and importable: src/ functions take plain config/arrays and return tables.
A plugin is a thin front-end that orchestrates WRF locally or against a service;
it cannot run WRF itself.
Layout
Containerfile, run.sh container image + build/shell/run helpers
config/sources.yaml verified URLs, checksums to be filled, licenses, caveats
config/namelist.* corrected WPS/WRF settings
src/acquire.py no-credential downloads + sha256 manifest
src/emulator.py physics-constrained ML with LCZ-blocked validation
src/lcz.py, src/wrfio.py, src/pipeline.py remaining pipeline (in progress)
tests/ self-checks
data/raw|interim|processed, output/
Workflow
./run.sh build # build image (once)
./run.sh run 'python src/acquire.py' # download LCZ, geography, GFS, validation data
./run.sh shell # interactive work inside container
Weather digital-twin framework
wrf_digital_twin/engine.py turns a (lat, lon, radius, date/time) request into a WRF
case and a land-use proposal into a counterfactual run. scripts/twin.py is its
CLI; qgis_plugin/digital_twin/ is a thin QGIS front-end (brush area selection,
request/proposal forms, result layers). See qgis_plugin/README.md.
./run.sh run 'python scripts/twin.py run /work/config/twin_request.example.json \
/work/config/twin_proposal.example.json'
Hours must be a multiple of 6 (GFS boundary data is 6-hourly). Each proposal
costs one full WRF run; the engine reuses the shared src/WPS and src/WRF/run
directories, so a running experiment should be finished before starting a twin
case. Only LANDUSEF is editable today; other variables need a new intervention
in apply_scenario. Validation metrics are not yet attached to QGIS layers.
Installing and releasing the app
pip install wrf-digital-twin # from PyPI
wrf-twin-gui # desktop app
wrf-twin --help # command line
To publish: push a tag such as v0.1.0. .github/workflows/release.yml
creates the GitHub release, and .github/workflows/publish.yml then builds the
wheel/sdist and publishes it to PyPI with trusted publishing (no API token
stored). .github/workflows/test.yml runs engine checks on Python 3.10–3.12.
Before the first tag, configure a trusted publisher on PyPI for this repository
(owner krishnaduttPanchagnula, repo wrf-wudapt, workflow publish.yml).
Status
- Container image (Podman), WRF v4.6.1 + WPS v4.6.0 compiled, w2w working
- Data acquisition: LCZ, geography, 16 × GFS f000 (soil-bearing), ERA5 validation
- LCZ-derived urban extent injected via w2w; corrected WPS/WRF namelists
- Full 18 h baseline WRF run, 19 hourly frames, classic NetCDF output
- Counterfactual WRF run (80% urban land use → grassland in LCZ 1–10), LCZ-wise differencing
- Emulator with LCZ- and time-blocked validation, prediction intervals, support checks
- Digital-twin engine, desktop app, QGIS plugin and icons (GUI smoke-tested; QGIS UI untested here)
- PyPI/GitHub release workflows
- Second-year comparison — compute/time permitting
Results: output/results/REPORT.md, results.json, zonal_*.csv, compare_lu80.csv.
ERA5 point validation: bias -2.46 K, RMSE 3.12 K (n=19; held-out 12–18Z RMSE 3.44 K).
Built LCZ response to the land-use intervention: mean ΔT2 -0.093 K (5 of 6 classes cool).
Finding: perturbing LAI in wrfinput had zero effect on T2 — Noah recomputes
LAI from land cover. The effective intervention is LANDUSEF, which WRF actually uses.
See CONSTRAINTS.md for the quality bar that must not be lowered.
Metadata
Release files for wrf-digital-twin 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| wrf_digital_twin-0.1.0.tar.gz | 33.9 kB | With provenance | Details for wrf_digital_twin-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| wrf_digital_twin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for wrf_digital_twin-0.1.0-py3-none-any.whl |
Total release size: 60.2 kB
Release files / wrf_digital_twin-0.1.0.tar.gz
| Download URL | wrf_digital_twin-0.1.0.tar.gz |
|---|---|
| Size | 33.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
06746cd490b171217c3ba9cbae39b6c04de3ff3c68cc0f0676dc846f71e7c0c9
|
|
BLAKE2b-256 checksum How to use checksums |
c46f12d42273c915dc637183b3d661b20a1b1095f341e8e128482a351a2e1158
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / wrf_digital_twin-0.1.0-py3-none-any.whl
| Download URL | wrf_digital_twin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e9e62886d1443c597049f8164c8bf37d1e995bc9305be5187a38936a6597614b
|
|
BLAKE2b-256 checksum How to use checksums |
cf405e599f76a06cb4e139c06301a9d4b6a608ebb79000ec696544beaeb7da9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for wrf-digital-twin 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for wrf_digital_twin-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.