Metadata-Version: 2.4
Name: urbirrad
Version: 0.2.0
Summary: Annual solar-radiation calculations on sensor meshes
License: MIT License
        
        Copyright (c) 2026 urbirrad contributors
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: THIRD_PARTY_NOTICES.md
Requires-Dist: numpy>=2.0
Requires-Dist: pandas>=2.2
Requires-Dist: h5py>=3.11
Requires-Dist: pyradiance>=1.3
Requires-Dist: pyvista>=0.46
Requires-Dist: PyYAML>=6.0
Requires-Dist: tqdm>=4.66
Provides-Extra: test
Requires-Dist: pytest>=8; extra == "test"
Dynamic: license-file

<p align="center">
  <img src="https://arep-dev.gitlab.io/urbirrad/assets/urbirrad-logo-horizontal.png" width="520"
       alt="UrbIrrad — solar irradiance calculation">
</p>

<p align="center">
  <a href="https://gitlab.com/arep-dev/urbirrad/-/releases"><img src="https://gitlab.com/arep-dev/urbirrad/-/badges/release.svg" alt="Latest release"></a>
  <a href="https://gitlab.com/arep-dev/urbirrad/-/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/Python-3.12%2B-0a6b88" alt="Python 3.12 or newer"></a>
  <a href="https://gitlab.com/arep-dev/urbirrad/-/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-008160" alt="License: MIT"></a>
  <a href="https://gitlab.com/arep-dev/urbirrad/-/blob/main/roadmap.md"><img src="https://img.shields.io/badge/Status-active%20development-fbdb12" alt="Status: active development"></a>
</p>

# UrbIrrad

Source code: [arep-dev/urbirrad on GitLab](https://gitlab.com/arep-dev/urbirrad).

Documentation: [UrbIrrad user guide](https://arep-dev.gitlab.io/urbirrad/).

_Have you wrestled with [Radiance](https://www.radiance-online.org/) command-line options, or explored [Honeybee](https://www.ladybug.tools/honeybee-radiance/docs/),
and wished for a focused way to calculate solar exposure in a building or urban scene?_

**UrbIrrad** offers a `Python`/`YAML` workflow:

* Provide geometry and weather,
* Choose the analysis,
* Run a case and open the result in ParaView.

You do not need to assemble the Radiance command pipeline yourself. UrbIrrad
drives [Radiance](https://www.radiance-online.org/) through
[PyRadiance](https://lbnl-eta.github.io/pyradiance/) and computes, on a
triangular sensor mesh:

| Analysis | Result | Example |
| --- | --- | --- |
| Solar irradiance: direct sun, diffuse sky, optional reflected sunlight | W/m², hour by hour | `examples/template_case/case.yaml` |
| Potential sunshine hours | hours of direct sun | `examples/template_case/case_potential_sunshine.yaml` |
| Daylight factor (DF), standard overcast sky | % | `examples/daylight_factor/case.yaml` |
| Daylight autonomy, from a weather file | % of occupied hours | `examples/daylight_factor/case_daylight_autonomy.yaml` |

Not sure which one you need? See [choosing an analysis](https://arep-dev.gitlab.io/urbirrad/choosing-an-analysis/).

**Not just outdoors.** The "Urb" in UrbIrrad reflects its urban-study
context, not a restriction to exterior sensors: streets, courtyards and public
spaces, rooms behind modelled glazing, or semi-open spaces such as covered
walkways, terraces and atria. Where you place the sensors and which geometry
you model determine the exposure; there is no indoor/outdoor switch.

## Installation

### Install a released version from PyPI

Python 3.12 or newer is required. With
[Miniforge](https://github.com/conda-forge/miniforge) or another Conda distribution:

```powershell
conda create -n rad python=3.12 -y
conda activate rad
python -m pip install urbirrad
```

If you already have a suitable Python environment, just run
`python -m pip install urbirrad`. PyRadiance provides the Radiance programs;
no separate Radiance installation is required.

The package does not include the example geometry or weather files. To run
the examples, install [Git](https://git-scm.com/) and download the repository,
or download and extract the repository archive from GitLab:

```powershell
git clone https://gitlab.com/arep-dev/urbirrad.git
cd urbirrad
```

To view results, install [ParaView](https://www.paraview.org/download/) (6.1 tested).

### Install from source for development

```powershell
git clone https://gitlab.com/arep-dev/urbirrad.git
cd urbirrad
conda create -n rad python=3.12 -y
conda activate rad
python -m pip install -e .
```

## Quick start: the Montauban example

The [Montauban example](https://gitlab.com/arep-dev/urbirrad/-/blob/main/examples/template_case/README.md)
contains a weather file, a sensor surface **inside a modelled building**, walls,
two glazing types, ground and the surrounding urban blocks. It covers
**1–15 July**. From the repository root:

```powershell
conda activate rad
python -m urbirrad.cli check examples/template_case/case.yaml
python -m urbirrad.cli run examples/template_case/case.yaml --nproc 4
```

`check` validates the case without calculating. `run` computes the **direct
sun and the diffuse sky on an upward-facing horizontal plane**, without
sunlight reflected by surfaces. It takes about 30 seconds with `--nproc 4`
the first time; reruns reuse cached sky matrices and are faster.

<p align="center">
  <img src="https://arep-dev.gitlab.io/urbirrad/assets/montauban-site-overview.png" width="720"
       alt="Montauban example site and surrounding geometry">
</p>

**View the result.** Open `examples/template_case/results/annual_solar.xmf` in
ParaView, choose **XDMF Reader** (not Xdmf3 Reader), click **Apply**, colour
by `solar_direct` or `solar_diffuse` [W/m²] and move through time with the
time controls. See [results and ParaView](https://arep-dev.gitlab.io/urbirrad/results/)
if only "Solid Color" is offered.

To rerun, add `--force`, or clean the outputs first (caches are kept):

```powershell
python -m urbirrad.cli clean examples/template_case/case.yaml
```

## Other analyses and variants

Each line is a complete YAML file: run it with the same `check` / `run`
commands.

| Goal | YAML | Guide |
| --- | --- | --- |
| Direct sun only, fastest shadow check | `examples/template_case/case_01_direct_only.yaml` | [getting started](https://arep-dev.gitlab.io/urbirrad/getting-started/) |
| Six receiving faces per point (E, W, N, S, up, down), for comfort studies | `examples/template_case/case_02_six_directions.yaml` | [methods](https://arep-dev.gitlab.io/urbirrad/methods/#six-receiving-directions) |
| Add sunlight reflected by walls and ground (slower) | `examples/template_case/case_03_reflected_direct.yaml` | [methods](https://arep-dev.gitlab.io/urbirrad/methods/#reflected-direct-diffuse-reflections-of-sunlight) |
| Potential sunshine hours, clear-sky geometry only | `examples/template_case/case_potential_sunshine.yaml` | [potential sunshine](https://arep-dev.gitlab.io/urbirrad/potential-sunshine/) |
| Direct irradiance plus a sunshine-hours field | `examples/template_case/case_direct_sunshine.yaml` | [potential sunshine](https://arep-dev.gitlab.io/urbirrad/potential-sunshine/) |
| Daylight factor in a room, no weather file | `examples/daylight_factor/case.yaml` | [daylight factor](https://arep-dev.gitlab.io/urbirrad/daylight-factor/) |
| Daylight autonomy in the same room | `examples/daylight_factor/case_daylight_autonomy.yaml` | [daylight autonomy](https://arep-dev.gitlab.io/urbirrad/daylight-autonomy/) |
| Effect of a solar-control film on existing windows (compare with `case.yaml`) | `examples/template_case/case_window_film.yaml` | [glazing properties](https://arep-dev.gitlab.io/urbirrad/glazing-properties/#worked-example-bare-versus-filmed-glazing) |
| Terrace under a polycarbonate canopy (opal or clear) | `examples/polycarbonate_canopy/case.yaml` | [diffusing materials](https://arep-dev.gitlab.io/urbirrad/diffusing-materials/) |

Material data helpers:

- **Glazing and films**: prepare the solar transmittance from manufacturer data,
  or estimate it from the U-value and solar factor g:
  `python -m urbirrad.glazing --ug 1.0 --g 0.35 --tl 0.70`. See
  [glazing properties](https://arep-dev.gitlab.io/urbirrad/glazing-properties/),
  including how to assess a film added to an existing window.
- **Translucent sheets** (opal or multiwall polycarbonate, shade sails) use
  `materials.diffusing`; see
  [diffusing materials](https://arep-dev.gitlab.io/urbirrad/diffusing-materials/).

## Your own project

Copy an example folder, replace its geometry and weather file, and edit the
YAML. The [getting-started guide](https://arep-dev.gitlab.io/urbirrad/getting-started/)
explains how to prepare geometry from CAD, where to find weather files and
how to adapt a case. Key conventions:

- coordinates **X = East, Y = North, Z = Up**, in **metres**;
- surfaces and sensors as triangular `STL`, `VTP`, `VTK`, `OBJ` or `PLY` meshes,
  one file per material;
- optical properties are given in the YAML, not taken from file colours;
- results in `W/m²` (solar), lux or % (daylight), hours (sunshine).

**Scope.** UrbIrrad covers shortwave solar radiation and visible daylight. It
does not calculate longwave thermal radiation or overall mean radiant
temperature (MRT), glare, or regulatory compliance.

## Documentation

Read the [online documentation](https://arep-dev.gitlab.io/urbirrad/), or browse
the [Markdown files](https://gitlab.com/arep-dev/urbirrad/-/blob/main/docs/index.md) in GitLab.

- Start: [getting started](https://arep-dev.gitlab.io/urbirrad/getting-started/),
  [choosing an analysis](https://arep-dev.gitlab.io/urbirrad/choosing-an-analysis/),
  [results and ParaView](https://arep-dev.gitlab.io/urbirrad/results/).
- Analyses: [methods (solar irradiance)](https://arep-dev.gitlab.io/urbirrad/methods/),
  [potential sunshine](https://arep-dev.gitlab.io/urbirrad/potential-sunshine/),
  [daylight factor](https://arep-dev.gitlab.io/urbirrad/daylight-factor/),
  [daylight autonomy](https://arep-dev.gitlab.io/urbirrad/daylight-autonomy/).
- Inputs: [YAML configuration](https://arep-dev.gitlab.io/urbirrad/configuration/),
  [glazing properties](https://arep-dev.gitlab.io/urbirrad/glazing-properties/),
  [diffusing materials](https://arep-dev.gitlab.io/urbirrad/diffusing-materials/).
- Background and reference: [how Radiance calculations work](https://arep-dev.gitlab.io/urbirrad/radiance-workflow/),
  [Python API](https://arep-dev.gitlab.io/urbirrad/python-api/),
  [HDF5 reference](https://arep-dev.gitlab.io/urbirrad/HDF5_SCHEMA/),
  [validation](https://arep-dev.gitlab.io/urbirrad/validation/),
  [documentation maintenance](https://arep-dev.gitlab.io/urbirrad/documentation/).

To preview the documentation locally:

```powershell
python -m pip install -r requirements-docs.txt
python -m mkdocs serve
```

## Development status

UrbIrrad is under active development. Configuration, APIs and result formats
may evolve as new options are developed and validated. See the
[roadmap](https://gitlab.com/arep-dev/urbirrad/-/blob/main/roadmap.md) for proposals and the
[changelog](https://gitlab.com/arep-dev/urbirrad/-/blob/main/CHANGELOG.md) for what changed in each release.

Tests are optional for normal use:

```powershell
python -m pip install -e ".[test]"
python -m pytest -q
```

Official resources: Radiance [website](https://www.radiance-online.org/) and
[source code](https://github.com/LBNL-ETA/Radiance); PyRadiance
[documentation](https://lbnl-eta.github.io/pyradiance/) and
[source code](https://github.com/LBNL-ETA/pyradiance).

## License

This project is distributed under the [MIT License](https://gitlab.com/arep-dev/urbirrad/-/blob/main/LICENSE).
Dependencies retain their own licenses; see [third-party notices](https://gitlab.com/arep-dev/urbirrad/-/blob/main/THIRD_PARTY_NOTICES.md).

## Repository layout

```text
urbirrad/                 Python package
tests/                    automated tests
examples/template_case/   Montauban solar and sunshine examples (copyable project structure)
examples/daylight_factor/ daylight factor and daylight autonomy room examples
examples/polycarbonate_canopy/ terrace under a translucent canopy (diffusing materials)
docs/                     user guides, reference, validation and image assets
scripts/                  example geometry generators and documentation charts
benchmarks/               validation reports, benchmark scripts and diagnostic experiments
mkdocs.yml                documentation navigation and build configuration
.gitlab-ci.yml            documentation checks and GitLab Pages deployment
requirements-docs.txt     optional documentation builder
roadmap.md                development priorities and future proposals
```
