Skip to main content

GPU-accelerated SOLWEIG model for urban thermal comfort simulation

Project description

SOLWEIG-GPU: GPU-Accelerated Thermal Comfort Modeling Framework

SOLWEIG-GPU is a Python package and command-line interface for running the SOLWEIG (Solar and LongWave Environmental Irradiance Geometry) model on CPU or GPU (if available). It enables high-resolution urban microclimate modeling by computing key variables such as Sky View Factor (SVF), Mean Radiant Temperature (Tmrt), and the Universal Thermal Climate Index (UTCI).

SOLWEIG was originally developed by Dr. Fredrik Lindberg's group. Journal reference: Lindberg, F., Holmer, B. & Thorsson, S. SOLWEIG 1.0 – Modelling spatial variations of 3D radiant fluxes and mean radiant temperature in complex urban settings. Int J Biometeorol 52, 697–713 (2008). https://doi.org/10.1007/s00484-008-0162-7

SOLWEIG GPU code is an extention of the original SOLWEIG python model that is the part of the Urban Multi-scale Environmental Predictor (UMEP) (GitHub code reference: https://github.com/UMEP-dev/UMEP). UMEP journal reference: Lindberg, F., Grimmond, C.S.B., Gabey, A., Huang, B., Kent, C.W., Sun, T., Theeuwes, N.E., Järvi, L., Ward, H.C., Capel-Timms, I. and Chang, Y., 2018. Urban Multi-scale Environmental Predictor (UMEP): An integrated tool for city-based climate services. Environmental modelling & software, 99, pp.70-87. https://doi.org/10.1016/j.envsoft.2017.09.020


Features

  • CPU and GPU support (automatically uses GPU if available)
  • Divides larger areas into tiles based on the selected tile size
  • CPU-based computations of wall height and aspect parallelized across multiple CPUs
  • GPU-based computation of SVF, shortwave/longwave radiation, shadows, Tmrt, and UTCI
  • Compatible with meteorological data from UMEP, ERA5, and WRF (wrfout)

SOLWEIG-GPU workflow Flowchart of the SOLWEIG-GPU modeling framework


Required Input Data

  • Building DSM: Includes both buildings and terrain elevation (e.g., Building_DSM.tif)
  • DEM: Digital Elevation Model excluding buildings (e.g., DEM.tif)
  • Tree DSM: Vegetation height data only (e.g., Trees.tif)
  • Meteorological forcing:
    • Custom .txt file (from UMEP)
    • ERA5 (both instantaneous and accumulated)
    • WRF output NetCDF (wrfout)

Please refer to the sample dataset to familiarize yourself with the expected inputs. Sample data can be found at https://utexas.box.com/s/8fctqicidr5cup8kj3tk53jd444pow6z

ERA5 Variables Required

  • 2-meter air temperature
  • 2-meter dew point temperature
  • Surface pressure
  • 10-meter U and V wind components
  • Downwelling shortwave radiation (accumulated)
  • Downwelling longwave radiation (accumulated)

Output Details

  • Output directory: Outputs/
  • Structure: One folder per tile (e.g., tile_0_0/, tile_0_600/)
  • SVF: Single-band raster
  • Other outputs: Multi-band raster (e.g., 24 bands for hourly results)

UTCI for New Delhi UTCI for New Delhi, India, generated using SOLWEIG-GPU and visualized with ArcGIS Online.


Installation

conda create -n solweig python=3.10
conda activate solweig
conda install -c conda-forge gdal pytorch
git clone https://github.com/nvnsudharsan/solweig-gpu.git
cd solweig-gpu
pip install .

Python Usage

from solweig_gpu import thermal_comfort

thermal_comfort(
    base_path='/path/to/input',
    selected_date_str='2020-08-13',
    building_dsm_filename='Building_DSM.tif',
    dem_filename='DEM.tif',
    trees_filename='Trees.tif',
    tile_size=3600,
    use_own_met=True,
    own_met_file='/path/to/met.txt',
    start_time='2020-08-13 00:00:00',
    end_time='2020-08-13 23:00:00',
    data_source_type='ERA5',  # or 'WRFOUT'
    data_folder='/path/to/era5_or_wrfout',
    save_tmrt=True,
    save_svf=False,
    save_kup=False,
    save_kdown=False,
    save_lup=False,
    save_ldown=False,
    save_shadow=False
)

Command-Line Interface (CLI)

conda activate solweig
thermal_comfort --base_path /path/to/input \
                --selected_date_str 2020-08-13 \
                --building_dsm_filename Building_DSM.tif \
                --dem_filename DEM.tif \
                --trees_filename Trees.tif \
                --tile_size 3600 \
                --use_own_met True \
                --own_met_file /path/to/met.txt \
                --start_time "2020-08-13 00:00:00" \
                --end_time "2020-08-13 23:00:00" \
                --data_source_type ERA5 \
                --data_folder /path/to/era5_or_wrfout \
                --save_tmrt True \
                --save_svf False

Tip: Use --help to list all CLI options.


GUI Usage

To launch the GUI:

conda activate solweig
solweig_gpu

GUI

GUI Workflow

  1. Select the base path containing input datasets.
  2. Choose the Building DSM, DEM, and Tree DSM raster files.
  3. Set the tile size (e.g., 600 or 1200 pixels).
  4. Select a meteorological source (metfile, ERA5, or wrfout):
    • If metfile: Provide a .txt file.
    • If ERA5: Provide a folder with both instantaneous and accumulated files.
    • If wrfout: Provide a folder with WRF output NetCDF files.
  5. Set the start and end times in UTC (YYYY-MM-DD HH:MM:SS).
  6. Choose which outputs to generate (e.g., Tmrt, UTCI, radiation fluxes).
  7. Output will be saved in Outputs/, with subfolders for each tile.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

solweig_gpu-1.0.0.tar.gz (58.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

solweig_gpu-1.0.0-py3-none-any.whl (58.0 kB view details)

Uploaded Python 3

File details

Details for the file solweig_gpu-1.0.0.tar.gz.

File metadata

  • Download URL: solweig_gpu-1.0.0.tar.gz
  • Upload date:
  • Size: 58.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for solweig_gpu-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7767fb60ce1cebb36000ed5daa0f23d7000c894eefc8f4c8c015fc44556c635d
MD5 598f90911bd3acf507a0700f97ed2ef7
BLAKE2b-256 237a10e6b712e552215a90d2fb08e6415844cd73699034e3696f8b1ca7516895

See more details on using hashes here.

File details

Details for the file solweig_gpu-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: solweig_gpu-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for solweig_gpu-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20d56c31d2741d6c7abc39afa06f74560e4c1ce33081e0f8887cfa93db6bdaa0
MD5 9f593389b0ba6c1974e211c0c8c250f1
BLAKE2b-256 8c5d99793cf50b8db8acf0cbf01ae4b05637dbca2a1f800b5ec4b1e988c0059d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page