Roof sunlight and shade are sampled from
georeferenced PNG rasters (PNG + PGW world file). Each pixel
in these rasters stores a value between
0 (dark) and
255 (bright). To compute real
sunlight values in physical units, we linearly scale the pixel between a
predefined minimum and maximum sunlight: when the pixel is
0 you get the minimum, when it is
255 you get the maximum, and intermediate values fall proportionally in-between (for example,
a pixel value of
128 will be roughly halfway between the minimum and maximum). Shade values are
interpreted similarly: dividing the pixel by 255 yields a fraction from 0 (
no shade) to
1 (
fully shaded). If a raster stores shade as the opposite of sunlight, this fraction is
inverted by subtracting it from 1.
Sunlight scaling example
Sunlight (kWh/m²) ≈ Min + (Max − Min) × (pixel / 255)
Shade fraction example
Shade ≈ pixel / 255 (or 1 − pixel / 255 if inverted)