Skip to main content

A python package to enable simple and easy gathering of climate model data and morphing of EPW files

Project description

pyepwmorph

License: MIT Python 3.9+ Version

A Python package for morphing EnergyPlus Weather (EPW) files with climate model data. Supports CMIP6 projections from Google Cloud and custom CSV-based model data for both future and historical scenarios.

Overview

pyepwmorph enables building performance analysts and researchers to create morphed weather files by applying scientifically validated procedures (Belcher et al. 2005, Jentsch et al. 2013) to existing EPW files. The package can morph EPWs using:

  • CMIP6 data fetched automatically from Google Cloud (Pangeo)
  • Custom CSV data from any climate model, including historical reconstructions

Installation

With uv (recommended)

uv add pyepwmorph

Development setup

git clone https://github.com/justinfmccarty/pyepwmorph.git
cd pyepwmorph
uv sync --extra dev

With pip

pip install pyepwmorph

Quick start

CMIP6 workflow (future projections)

import pyepwmorph.tools.workflow as workflow

results = workflow.morphing_workflow(
    project_name="MyBuilding_Future",
    epw_file="weather.epw",
    user_variables=["Temperature", "Humidity", "Clouds and Radiation"],
    user_pathways=["Middle of the Road"],   # ssp245
    percentiles=[50],
    target_years=[2050],
    output_directory="output/",
)

Custom CSV workflow (historical or any model)

import pyepwmorph.tools.workflow as workflow

custom_data = {
    "reference": {
        "tas": "data/reference_tas.csv",
        "tasmax": "data/reference_tasmax.csv",
        "tasmin": "data/reference_tasmin.csv",
    },
    "target_1990s": {
        "tas": "data/target_tas.csv",
        "tasmax": "data/target_tasmax.csv",
        "tasmin": "data/target_tasmin.csv",
    },
}

results = workflow.morphing_workflow(
    project_name="Historical_Morph",
    epw_file="weather.epw",
    user_variables=["Temperature"],
    user_pathways=["target_1990s"],
    percentiles=[50],
    target_years=[1990],
    output_directory="output/",
    data_source="custom",
    custom_data=custom_data,
    reference_scenario="reference",
)

Custom CSVs should have a date column (parseable by pandas) and a column named after the CMIP6 variable (e.g. tas, tasmax). Rows should be monthly.

Climate scenarios

Scenario SSP Description Expected warming
Best Case Scenario ssp126 Strong mitigation, renewable transition ~1.8 C by 2100
Middle of the Road ssp245 Moderate mitigation efforts ~2.7 C by 2100
Upper Middle Scenario ssp370 Regional rivalry, slow convergence ~3.6 C by 2100
Worst Case Scenario ssp585 Fossil-fueled development ~4.4 C by 2100

Morphing variables

  • Temperature -- dry bulb temperature (shift + stretch)
  • Humidity -- relative humidity via specific humidity (stretch)
  • Pressure -- atmospheric pressure (shift)
  • Wind -- wind speed (stretch)
  • Clouds and Radiation -- global/diffuse/direct radiation and sky cover
  • Dew Point -- recalculated from morphed temperature and humidity

Variable dependencies

Some variables are automatically added when needed:

  • Humidity requires Temperature and Pressure
  • Dew Point requires Temperature, Humidity, and Pressure

Caching

Climate model data is cached locally after the first download to speed up repeated analyses.

import pyepwmorph.models.access as access

stats = access.get_cmip6_cache_stats()
access.clear_cmip6_cache()

Available climate models

from pyepwmorph.tools.utilities import available_models

models = available_models()

Development

git clone https://github.com/justinfmccarty/pyepwmorph.git
cd pyepwmorph
uv sync --extra dev

# Run tests
pytest

# Run with coverage
pytest --cov=pyepwmorph

Breaking changes in v2.0.0

  • License changed from GPL-3.0 to MIT.
  • future_years parameter renamed to target_years across the API. The old name is still accepted with a deprecation warning.
  • MorphConfig accepts new parameters: data_source, custom_data, reference_scenario, and target_years.
  • EPW I/O (pyepwmorph.tools.io) rewritten with stricter validation. Files that are not exactly 8760 data rows will now raise ValueError. The lat/lon parsing bug in the standalone epw_location() function has been fixed.
  • coordinate_cmip6_data now accepts an optional time_slices dict for custom temporal bounds instead of hardcoded 1960-2014 / 2015-2100.
  • Removed requirements.txt, environment.yml, .bumpversion.cfg. Use uv sync or pip install . instead.
  • Per-module __version__ strings removed. Use pyepwmorph.__version__ or importlib.metadata.version("pyepwmorph").

Requirements

  • Python >= 3.9
  • Internet connection (for CMIP6 data download)

License

MIT License. See LICENSE.

Citation

McCarty, J. (2026). pyepwmorph: A Python package for climate-informed
EPW file morphing. Version 2.0.0.
https://github.com/justinfmccarty/pyepwmorph

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

pyepwmorph-2.0.0.tar.gz (35.2 kB view details)

Uploaded Source

Built Distribution

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

pyepwmorph-2.0.0-py3-none-any.whl (40.7 kB view details)

Uploaded Python 3

File details

Details for the file pyepwmorph-2.0.0.tar.gz.

File metadata

  • Download URL: pyepwmorph-2.0.0.tar.gz
  • Upload date:
  • Size: 35.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyepwmorph-2.0.0.tar.gz
Algorithm Hash digest
SHA256 c134c868157e6e489440042cb7558b595b6f6b8ccfefefa25e500bd49f1c33ab
MD5 b6aaac353b26686cb4b9cb77d233f258
BLAKE2b-256 dc11c524bf8598d7463402768510d8e88d6eff2794ae3a9dde48db69b7e071de

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyepwmorph-2.0.0.tar.gz:

Publisher: publish.yml on justinfmccarty/pyepwmorph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyepwmorph-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyepwmorph-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 40.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyepwmorph-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bd871a4237a51502ca5dbdbf45c235ba3f0d9f80371075164e109502b6d5ed00
MD5 ec6fc0964dbb0184b3dfb2ebdb10e4f9
BLAKE2b-256 fe9eb9d94c9d2602a68c959e975b886b20f7ea8911d270d85ebe6f3c9cde57ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyepwmorph-2.0.0-py3-none-any.whl:

Publisher: publish.yml on justinfmccarty/pyepwmorph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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