Skip to main content

smhi2epw

CI PyPI Python versions MIT license Documentation

Build complete-year EnergyPlus weather files (.epw) from Swedish weather data. smhi2epw combines SMHI station observations and STRÅNG solar data, fills gaps, and can use nearby stations or same-year ERA5 when needed. Each automatic run writes a JSON receipt describing its sources and recovery steps.

Install

Python 3.11 or newer is required:

python -m pip install smhi2epw

Creating a weather file needs internet access to SMHI and may use Open-Meteo for ERA5 recovery. Reading an existing EPW works offline.

Use

smhi2epw 2023 gothenburg.epw --station 71420 --city Gothenburg

Or use the Python API:

from smhi2epw import EPWConfig, compile_epw

result = compile_epw(EPWConfig(
    year=2023,
    output_path="gothenburg.epw",
    station_id=71420,
    city="Gothenburg",
))
print(result.report.warnings)

Automatic recovery is the default. Use --weather-policy strict to stop when required source data are missing. See the quick start and CLI guide for options, and the method limitations before using reconstructed weather in calibration or event analysis.

Docs and examples

The online documentation covers the API, methods, and limitations. The notebook course covers EPW inspection, comparisons, heat waves, gap filling, solar components, batch runs, and EnergyPlus. To run the notebooks from a source checkout:

git clone https://github.com/SB-Chalmers/smhi2epw.git
cd smhi2epw
python -m pip install -e ".[tutorials]"
jupyter lab examples/

Completeness evidence

The archived EPSM runs covered jobs from 2017–2024. Their recorded results were:

Run Recovery policy Completed
v1 Temporal filling 32 / 85
v2 Opt-in station donors 124 / 128
v3 Assessed donors and ERA5 128 / 128

All 128 v3 files were rechecked for calendar, row, field, range, and dew-point validity. They all used some reconstruction; completeness does not establish local weather accuracy. The archived results predate the pvlib solar refactor. See the run summary and notebook 08 for details and limitations.

Thanks to the maintainers of smhi-open-data, smhi-weather, smhi-pkg, and ifk-smhi. These projects provide SMHI API clients and forecast access; smhi2epw focuses on complete-year weather files for EnergyPlus.

Development

python -m pip install -e ".[dev,docs,tutorials]"
pytest -m "not network and not energyplus"
ruff check src tests examples docs
python -m sphinx -W --keep-going -b html docs docs/_build/html

The CI workflow also checks minimum dependencies, installed wheels, notebooks, and required EnergyPlus cases. Live provider tests run separately on the weekly schedule.

License

MIT

Operation logging

Library calls use Python's standard logging module and install no console or file output. Instrumented operations accept optional keyword-only log_context with small identifier mappings; nested events carry operation and parent IDs. INFO describes major stages; DEBUG exposes selections, conversions and caches. Logging context does not change physical models or scientific cache inputs.

For an application using EPSM's coordinated logging setup:

from epsm import configure_logging, reset_logging

configure_logging(directory="outputs/example")  # INFO stderr, DEBUG JSONL
# Run operations here.
configure_logging(enabled=False)  # Stop console and file logging.
reset_logging()  # Restore the host application's settings.

EPSM is needed only for this combined configuration, not for ordinary library logging. Existing scripts can keep using logging.basicConfig(level=logging.INFO).

Migration: compile_epw() no longer configures a handler automatically. Select output in the calling application. The standalone CLI still configures stderr; use --log-level OFF to silence status.

Metadata

Release files for smhi2epw 1.2.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 smhi2epw 1.2.0
File Size Uploaded Provenance Actions
smhi2epw-1.2.0.tar.gz 181.9 kB With provenance Details for smhi2epw-1.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 253.8 kB

Release files / smhi2epw-1.2.0.tar.gz

Download URL smhi2epw-1.2.0.tar.gz
Size 181.9 kB
Tags Source
SHA-256 checksum
How to use checksums
410a744c8fe1a9bcdae98ff0bb254b455f0bdc05585f4fcfb7bdd124f9b25618
BLAKE2b-256 checksum
How to use checksums
588428292ed420346c6c470f407c847e735e7e1d1ec833a1ad2e4e45a325356f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / smhi2epw-1.2.0-py3-none-any.whl

Download URL smhi2epw-1.2.0-py3-none-any.whl
Size 72.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abe253494e064d82e218cf31b7d3f1cf537b2d86af608802b51cd01e1e238db0
BLAKE2b-256 checksum
How to use checksums
a762d1d14d183c46e973596023b3da14215d6308176cb7a53784a97dc43d6862
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for smhi2epw 1.2.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for smhi2epw-1.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

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