Skip to main content

PyPVRoof

Try it on Hugging Face PyPI Docs DOI

PyPVRoof extracts the characteristics of rooftop PV systems from geocoded polygons.

  • Outputs: tilt, azimuth, installed capacity (plus surface and location).
  • Inputs: the polygons, and optionally a digital surface model (DSM). Open DSMs of several European countries are queried on the fly (see Covered countries); local GeoTIFFs work too. Without a DSM, heuristics give an estimate from the polygon alone.

pypvroof pipeline: PV polygons, a service fetches the surface model under each polygon, Theil-Sen fits the roof plane(s), output characteristics with a status; without a surface model, heuristics from the polygon

It also extracts roof planes: draw one polygon over a whole roof, and split=True returns one row per roof plane, with its own outline, tilt, azimuth and surface.

A polygon drawn over the whole roof of the Halle de Crémieu (France) is multimodal; with split=True it is split into a south-facing plane (16°, 185°, 857 m²) and a north-facing plane (16°, 5°, 489 m²)

Try it online on Hugging Face Spaces: draw a polygon on a roof anywhere in the covered countries and get its characteristics on the fly, or upload a file of polygons. Locally: pip install -e ".[viz]" gradio && python app/app.py.

Methods

  • Tilt and azimuth, with a DSM: a robust Theil-Sen fit of the roof plane(s) under the polygon. Polygons covering several roof planes are flagged multimodal, or split into one row per plane (split=True). Flat roofs (tilt under 5°) have no azimuth.
  • Without a DSM (service=None): tilt imputed with a constant (30° by default), azimuth from the polygon's minimum rotated rectangle, on the side closest to south (axis only, can be wrong by 180°).
  • Installed capacity (capacity=): panel surface (projected surface / cos(tilt)) times a coefficient, constant (1/6.5 kWp/m²) or calibrated on the BDPV registry shipped with the package (linear, clustered).

Azimuths are in degrees, 0 = north, clockwise (90 = east, 180 = south). Details in the documentation.

Covered countries

Country / region Service Product Resolution CRS Protocol Licence
France fr-lidar IGN LiDAR HD 0.5 m EPSG:2154 WMS-R Etalab 2.0
France fr-correl IGN MNS Correl (from aerial images, less precise) 0.5 m EPSG:2154 WMS-R Etalab 2.0
Netherlands nl-ahn AHN 0.5 m EPSG:28992 WCS 2.0.1 CC0
Belgium (Flanders) be-flanders DHMV II (2013-2015) 1 m EPSG:31370 WCS 2.0.1 Modellicentie gratis hergebruik
United Kingdom (England) uk-england Environment Agency LiDAR composite DSM 1 m EPSG:27700 WCS 2.0.1 OGL v3
Germany (North Rhine-Westphalia) de-nw DOM1 1 m EPSG:25832 WCS 2.0.1 dl-de/zero-2-0
Germany (Mecklenburg-Vorpommern) de-mv DOM1 1 m EPSG:25833 WCS 2.0.1 CC BY 4.0
Poland pl GUGiK NMPT (slow, ~7 s per polygon) 0.5 m EPSG:2180 WCS 1.0.0 GUGiK
Norway no Nasjonal høydemodell DOM 1 m EPSG:25833 WCS 1.0.0 CC BY 4.0
Switzerland ch-swisssurface3d swisstopo swissSURFACE3D 0.5 m EPSG:2056 STAC + COG swisstopo OGD
Anywhere path to a folder your GeoTIFFs (pixel = elevation in metres) any any projected local files yours

Polygons can be given in any CRS. At 1 m, polygons under about 12 m² have too few pixels to be measured. pypvroof.available_services() returns this table.

Installation

pip install pypvroof

From source: git clone https://github.com/gabrielkasmi/pypvroof.git && cd pypvroof && pip install -e ".[dev]". Python >= 3.10.

Usage

Tilt and azimuth measured on a DSM, for a whole file:

from pypvroof import characterize_roofs

out = characterize_roofs("detections.geojson", "fr-lidar", workers=8)

The input can be a GeoDataFrame, a GeoJSON, a parquet file, a list of shapely polygons... The output is a GeoDataFrame with tilt, azimuth, surface, a status (ok, flat, multimodal, no_coverage, too_few_points...) and the service metadata (meta_*, e.g. the LiDAR acquisition date). No fallback is applied: when a value cannot be measured, status says why and you choose what to do (another service, the heuristics...).

With the installed capacity (column installed_capacity, kWp), and one row per roof plane:

out = characterize_roofs("detections.geojson", "fr-lidar", split=True, capacity="clustered")

Without a surface model, heuristics from the polygon alone (constant tilt, azimuth from the polygon's rectangle, status = "heuristic"):

out = characterize_roofs("detections.geojson", None, tilt=30, capacity="constant")

The capacity of any panel surface: installed_capacity(surface, "clustered").

Visual check of a polygon (orthophoto and DSMs, pip install "pypvroof[viz]"):

from pypvroof.viz import plot_polygon
fig = plot_polygon(polygon, services=("fr-lidar", "fr-correl"))

See the documentation for all parameters, output columns and statuses.

Contributing: add a service

Your country is not in the table? Most national LiDAR surface models are published as an OGC WCS (or STAC + Cloud-Optimized GeoTIFFs), and adding one is usually a single entry in pypvroof/catalog.py. See CONTRIBUTING.md for the step-by-step guide, then open a pull request.

Citation

@article{tremenbert2023pypvroof,
  title={PyPVRoof: a Python package for extracting the characteristics of rooftop PV installations using remote sensing data},
  author={Tr{\'e}menbert, Yann and Kasmi, Gabriel and Dubus, Laurent and Saint-Drenan, Yves-Marie and Blanc, Philippe},
  journal={arXiv preprint arXiv:2309.07143},
  year={2023}
}

PyPVRoof expands the characteristics extraction module of Kasmi et al. (2022).

License

MIT, see LICENSE. The surface models belong to their producers and are used under their licences (see the table above).

Metadata

Release files for pypvroof 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypvroof 0.3.0
File Size Uploaded Provenance Actions
pypvroof-0.3.0.tar.gz 154.5 kB Without provenance Details for pypvroof-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pypvroof 0.3.0
File Interpreter ABI Platform Actions
pypvroof-0.3.0-py3-none-any.whl Python 3 none any Details for pypvroof-0.3.0-py3-none-any.whl

Total release size: 302.8 kB

Release files / pypvroof-0.3.0.tar.gz

Download URL pypvroof-0.3.0.tar.gz
Size 154.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ff5c7fd0518b5031e52c24f4a54d2bcdfbdcfa12b436205e652edef303f6772a
BLAKE2b-256 checksum
How to use checksums
bd22d0e14a93f0e56c1be51a239b1dfd83db434eb4e2155049b01872c5873c49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / pypvroof-0.3.0-py3-none-any.whl

Download URL pypvroof-0.3.0-py3-none-any.whl
Size 148.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
50ea863429ed63e6652679bdc554825706d7d33b2a073d88c51734737c8df038
BLAKE2b-256 checksum
How to use checksums
085f6db179e666955fe453830ed020737e44e648d3caa11d49afbb591463958f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for pypvroof 0.3.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page