Bucharest Solar Study Back to evidence and source records

docs/model-method.md Original Markdown

Irradiation model

The model estimates incident shortwave energy in kWh/m² for a fixed inventory. The horizontal baseline uses the Bucharest center SARAH3 hourly series for 2005–2023. weather.py validates the source, horizontal plane, disabled horizon, each hourly timestamp, units and monthly closure. It uses the recorded UTC sample minutes and geometric sun position from pvlib. The waveform contributes one hour of irradiation per observation. Solar azimuth is clockwise from true north.

Surfaces, obstacles and energy

Receiver locations use an area-weighted sample in each projected roof grid cell intersected by the footprint. If the intersection centroid is outside the shape, its representative point is used. Linked parts are clipped to the parent receiver. Where parts overlap, the highest supported upper surface owns the projected area. The rest of the parent receives its own height. The buffered obstacle scene rasterizes the highest top at each pixel center, with a fixed grid origin in EPSG:3844. The primary case uses locally level ground. The terrain sensitivity adds the same footprint-filtered ground raster to receiver and obstacle heights.

Each sample has a 360° view of the obstacle horizon with predeclared azimuth and distance limits. A grid traversal finds the largest positive rise-to-distance ratio on each azimuth. The first cell is left out of traversal and the crossing distance is bounded below by half a cell. These choices limit subpixel wall and shadow artifacts. Each output records the roof area sampled and the fraction of samples that start in a higher raster cell. The city-center north correction converts true rays into projected bearings consistently across tiles. Raster roof tops represent vertical obstructions down to local ground, so rays through the space below an elevated part are beyond the model’s resolution.

The hourly horizontal beam is assigned to its closest azimuth ray and accumulated by year, month and 0.25° elevation threshold. The normals average those annual monthly values, then sum months for seasons and annual totals. The direct component on tilted planes uses sun incidence and caps inferred direct normal irradiance at 1,400 W/m², with a denominator floor at 3° solar elevation. Flat surfaces use the observed horizontal beam directly. A near-horizon positive horizontal beam observation can contribute to an unobstructed ray. Each flat sample’s diffuse coefficient is the average of the squared cosine of its horizon angles. The tilted diffuse coefficient integrates the visible isotropic sky against incidence cosine. Reflected irradiation uses the unobstructed tilted-plane ground-view factor with albedo 0.20. Reflection from individual buildings is outside the calculation.

The published monthly, seasonal and annual normals use the complete 19-year monthly basis. Representative pilot-point time series retain the underlying yearly monthly total. December is attributed to the following winter when comparing complete individual DJF seasons.

Roof shape and canopy

Skillions use the mapped downslope direction. Gable and hip ridge orientation comes from a mapped slope direction or along/across relation to a sufficiently elongated oriented bounding rectangle. Pyramidal roofs use a centered apex over a near-rectangular plan with mapped roof rise. Facet pitches on unequal sides follow from that rise and each run. Size, shape, roof-rise consistency and part stacking checks produce explicit rejection reasons.

The tagged part or complete receiver is removed from the block scene for the matched comparison. The analytic roof is a continuous minimum of planes. Its other faces fall below each face’s tangent plane, so positive incident rays escape the reconstructed roof. Adjacent mapped volumes remain in the scene, including other parts of a partially modelled building. As-built changes in roof details are unobserved. Part examples compare exposure over the tagged exposed portion only. Whole-roof promotion requires continuous tagged coverage and a stable block height scenario. Ambiguous comparisons vary two physically credible pitches and two ridge orientations at fixed building top. The spread is a scenario range.

Canopy tests use positive canopy heights above the declared threshold on valid source pixels beyond mapped building cells. The mapped-tree fallback uses crown and height tags with explicit default dimensions where absent. The experiment holds its tree-adjacent cohort fixed across a bare-building case, an opaque-canopy case and a seasonal mixture of those two using the fractions in the experiment configuration. These fractions are sensitivity assumptions, and the source reflects a particular imagery vintage. Citywide building shadows omit canopy; near-tree exposure elsewhere remains uncertain.

Production selection and output

Pilot thresholds, candidate locations, groupings, roof scenarios and holdout references are in config/solar_experiments.json. The pilot selects any finer numerical settings required by its predeclared comparisons. Tei tests the selected settings against finer azimuth/range and tests finer spacing and pixels one at a time. If aggregate transfer fails, only previously defined classes with sufficient holdout cases passing the required comparisons qualify for block promotion. The other estimates fall back to horizontal.

The city applies the input height interval on each tile. Substantial pilot frequency or rank changes add complementary, deterministic imputed-height assignments and the 7.30m GloBFP-only reduction to the city envelope. The GloBFP perturbation reflects the matched source discrepancy in the inventory audit. Each tile holds geometry, sampling, weather and evaluation settings constant while changing its heights. The output falls back to the horizontal reference when the building’s scenario span breaches its declared annual or seasonal threshold. The central block estimate and scenario values remain available.

The release stage checks the receiver start cells after tile aggregation. If at least half of the area-weighted samples start in a higher roof cell, the receiver geometry is unresolved at production resolution and the release promotes its horizontal reference. Localized conflicts carry a flag. Release evidence records the previous model and exact projected overlap with higher other-parent footprint geometry for material conflicts.

Selected irradiation is in irradiation_{period}_kwh_m2. The incident energy field multiplies that value by the estimated roof area in estimated_roof_area_m2. Shade fractions use the same plane and roof area in their denominator. Values without a usable reference are null. block_{period}_kwh_m2 provides the central scenario, baseline_{period}_kwh_m2 provides a common comparison, and estimate_model and fallback_reason indicate which result is promoted.

Paired estimates report their used roof count and projected area, signed and absolute changes and rank agreement. Relative changes require at least 1 kWh/m² in the comparison period. A constant unshaded baseline yields an undefined rank. The exact ray check intersects individual Shapely segments with vector footprints and evaluates each beam observation independently. Short-range mismatches can reflect obstacles sitting in the same raster cell, plan overlap and narrow footing geometry. Validation against rooftop exposure measurements would require field observations.

Commands

Run from the repository root with the dependencies and inputs in the project runbook.

.venv/bin/python scripts/weather.py
.venv/bin/python scripts/solar.py self-test
.venv/bin/python scripts/solar.py baseline
.venv/bin/python scripts/solar.py pilot --canopy data/processed/canopy/canopy_height_3m.tif
.venv/bin/python scripts/solar.py holdout
.venv/bin/python scripts/solar.py city --canopy data/processed/canopy/canopy_height_3m.tif
.venv/bin/python scripts/solar.py boundary
.venv/bin/python scripts/solar.py terrain --terrain data/processed/terrain/terrain_sensitivity_30m.tif
.venv/bin/python scripts/solar_ray_qa.py

The optional raster flags take model-ready rasters and can be repeated for adjoining files. Use --output for an isolated run. Give a first city call --max-tiles N to write the first N tiles, then drop that flag to resume. Use --tile-id 490_272 to replay the documented dense-center tile in isolation. Completed tiles have a GeoParquet and a JSON record under a fingerprint of settings, model code and input bytes. The final city command checks identifier reconciliation, annual and seasonal closure and the unshaded horizontal limit. It stages the assembled file and publishes the official GeoParquet after the geometric release checks. The boundary check compares real exterior casters and re-runs the same roofs in shifted tile groups.