Skip to content

API Reference

Complete reference for the SOLWEIG public API.

Core Functions

Function Description
calculate() Single or multi-timestep Tmrt calculation (tiling is applied for large rasters)
validate_inputs() Pre-flight input validation

Data Classes

Class Description
SurfaceData Terrain data (DSM, CDSM, walls, SVF)
Location Geographic coordinates
Weather Meteorological conditions
HumanParams Human body parameters
SolweigResult Calculation output
TimeseriesSummary Aggregated timeseries output
Timeseries Per-timestep scalar timeseries
ModelConfig Model configuration

I/O Functions

Function Description
load_raster() Load a GeoTIFF with optional bbox cropping
save_raster() Save array as Cloud-Optimized GeoTIFF
rasterise_gdf() Rasterise vector data to a height grid
download_epw() Download EPW weather from PVGIS
read_epw() Parse an EPW file to weather records

GPU Utilities

Function Description
is_gpu_available() Check whether GPU acceleration is available
get_compute_backend() Returns "gpu" or "cpu"
disable_gpu() Disable GPU, fall back to CPU

Import Pattern

import solweig

# All public API is available at the top level
surface = solweig.SurfaceData(dsm=my_dsm, pixel_size=1.0)
result = solweig.calculate(surface, location, weather, output_dir="output/")

Type Annotations

SOLWEIG is fully typed. Type checking can be enabled in any IDE:

from solweig import SurfaceData, Location, Weather, SolweigResult

def process_area(dsm: np.ndarray) -> SolweigResult:
    surface: SurfaceData = SurfaceData(dsm=dsm, pixel_size=1.0)
    location: Location = Location(latitude=57.7, longitude=12.0, utc_offset=1)
    weather: Weather = Weather(...)
    return solweig.calculate(surface, location, weather, output_dir="output/")