A python package to enable simple and easy gathering of climate model data and morphing of EPW files
Project description
pyepwmorph
A Python package for accessing global climate models and morphing EnergyPlus Weather (EPW) files with future climate projections from CMIP6 models.
🌡️ Overview
pyepwmorph enables building performance analysts and researchers to create future weather files by morphing existing EPW files with climate change projections. The package automatically downloads climate model data from Google Cloud and applies scientifically-validated morphing procedures to generate future weather files for building energy simulations.
✨ Features
- Automated Climate Data Access: Downloads CMIP6 climate model data from Google Cloud Storage
- Multiple Climate Scenarios: Supports 4 different Representative Concentration Pathways (RCPs) and Shared Socioeconomic Pathways (SSPs)
- Intelligent Caching: Built-in caching system to improve performance and reduce download times
- Morphing Procedures: Implements established morphing methodologies for temperature, humidity, wind, solar radiation, and other weather variables
- Multiple Models: Access to 50+ global climate models for robust projections
- Easy-to-Use API: Simple Python interface for weather file generation
🚀 Installation
pip install pyepwmorph
Development Installation
For development or to access the latest features:
# Clone the repository
git clone https://github.com/justinfmccarty/pyepwmorph.git
cd pyepwmorph
# Create conda environment (recommended)
conda env create -f environment.yml
conda activate pyepwmorph
# Or install in development mode
pip install -e ".[dev]"
🌍 Climate Scenarios
The package supports four main climate scenarios based on CMIP6 projections:
Available Scenarios
| Scenario | Full Name | Description | Expected Warming |
|---|---|---|---|
| ssp126 | Best Case Scenario | Strong mitigation, renewable transition | 1.8°C by 2100 |
| ssp245 | Middle of the Road | Moderate mitigation efforts | 2.7°C by 2100 |
| ssp370 | Upper Middle Scenario | Regional rivalry, slow convergence | 3.6°C by 2100 |
| ssp585 | Worst Case Scenario | Fossil-fueled development | 4.4°C by 2100 |
Percentiles
For each scenario, you can access different percentiles representing uncertainty ranges:
- 1st percentile: Lower bound of projections (cooler outcomes)
- 50th percentile: Median projection (most likely outcome)
- 99th percentile: Upper bound of projections (warmer outcomes)
📊 Morphing Variables
The package can morph the following weather variables:
- Temperature: Dry bulb temperature, daily min/max temperatures
- Humidity: Relative humidity, absolute humidity, dew point
- Pressure: Atmospheric pressure
- Wind: Wind speed and direction
- Clouds and Radiation: Cloud cover, solar radiation (direct and diffuse)
💾 Caching System
pyepwmorph includes an intelligent caching system to improve performance:
Automatic Caching
- Climate model data is automatically cached locally
- Coordinate data for specific locations is cached
- Reduces download time for repeated analyses
Cache Management Commands
import pyepwmorph.models.access as access
# Get cache statistics
stats = access.get_cmip6_cache_stats()
print(f"Cache size: {stats['total_size_mb']} MB")
print(f"Files cached: {stats['total_files']}")
# Clear cache (useful for development or disk space management)
access.clear_cmip6_cache()
Cache Configuration
- Default cache location:
~/.pyepwmorph_cache/ - Automatic cleanup when cache exceeds size limits
- Thread-safe caching for concurrent operations
🏗️ Quick Start
Basic Usage
import pyepwmorph.tools.workflow as workflow
# Define morphing parameters
project_name = "MyBuilding_Future"
epw_file = "path/to/your/weather_file.epw"
user_variables = ['Temperature', 'Humidity', 'Clouds and Radiation']
user_pathways = ['Middle of the Road'] # ssp245
percentiles = [50] # median projection
future_years = [2050]
output_directory = "path/to/output/"
# Run morphing workflow
results = workflow.morphing_workflow(
project_name=project_name,
epw_file=epw_file,
user_variables=user_variables,
user_pathways=user_pathways,
percentiles=percentiles,
future_years=future_years,
output_directory=output_directory
)
Advanced Configuration
# Use specific climate models (optional)
model_sources = ['ACCESS-CM2', 'CanESM5', 'MIROC6']
# Custom baseline period (default: 1995-2014)
baseline_range = [1990, 2019]
# Multiple scenarios and percentiles
user_pathways = ['Best Case Scenario', 'Middle of the Road', 'Worst Case Scenario']
percentiles = [1, 50, 99]
future_years = [2030, 2050, 2070]
results = workflow.morphing_workflow(
project_name="ComprehensiveAnalysis",
epw_file=epw_file,
user_variables=['Temperature', 'Humidity', 'Pressure', 'Wind', 'Clouds and Radiation'],
user_pathways=user_pathways,
percentiles=percentiles,
future_years=future_years,
output_directory=output_directory,
model_sources=model_sources,
baseline_range=baseline_range
)
🔬 Available Climate Models
The package provides access to 50+ CMIP6 models. To see available models:
from pyepwmorph.tools.utilities import available_models
# Get list of models available for all scenarios
models = available_models()
print(f"Available models: {len(models)}")
🛠️ Development & Contributing
Development Environment Setup
# Clone and setup development environment
git clone https://github.com/justinfmccarty/pyepwmorph.git
cd pyepwmorph
# Create conda environment
conda env create -f environment.yml
conda activate pyepwmorph
# Install in development mode
pip install -e ".[dev]"
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=pyepwmorph
# Run specific test file
pytest tests/test_pyepwmorph.py -v
Code Quality
# Format code
black pyepwmorph/
isort pyepwmorph/
# Lint code
flake8 pyepwmorph/
🚀 Making New Releases
For maintainers, the package uses an automated release system:
Quick Release
# Patch release (1.0.3 → 1.0.4)
./release.sh patch
# Minor release (1.0.3 → 1.1.0)
./release.sh minor
# Major release (1.0.3 → 2.0.0)
./release.sh major
What the Release Script Does
- ✅ Git Status Check: Ensures working directory is clean
- ✅ Run Tests: Validates code quality
- ✅ Version Bump: Automatically calculates and updates version numbers
- ✅ Build Package: Creates wheel and source distributions
- ✅ Git Operations: Commits changes, creates tags, pushes to GitHub
- ✅ GitHub Integration: Ready for GitHub release creation
Manual Release Process
- Update version: The release script handles this automatically
- Create GitHub Release: Visit the provided URL after running
./release.sh - PyPI Publishing: Automatic via GitHub Actions when release is created
Release Workflow
# Example: Creating a minor release
./release.sh minor
# Output will show:
# ✅ Released version 1.1.0
# Create a GitHub release at: https://github.com/justinfmccarty/pyepwmorph/releases/new?tag=v1.1.0
📚 Documentation
API Reference
The main workflow function provides comprehensive climate morphing:
workflow.morphing_workflow(
project_name, # str: Name for your project
epw_file, # str: Path to input EPW file
user_variables, # list: Variables to morph
user_pathways, # list: Climate scenarios
percentiles, # list: Percentile projections (1, 50, 99)
future_years, # list: Target years for projections
output_directory, # str: Where to save morphed files
model_sources=None, # list: Specific models (optional)
baseline_range=None, # list: Custom baseline period (optional)
write_file=True # bool: Whether to write EPW files
)
Variable Dependencies
Some variables have automatic dependencies:
- Humidity requires Temperature and Pressure
- Dew Point requires Temperature and Humidity
The package automatically adds missing dependencies and notifies you.
⚠️ Requirements
- Python: 3.10 or higher
- Operating System: Windows, macOS, Linux
- Internet Connection: Required for downloading climate data
- Disk Space: ~50MB for typical cache (varies by usage)
📄 License
This project is licensed under the GNU General Public License v3.0 or later (GPL-3.0-or-later). See the LICENSE file for details.
🤝 Support
- Issues: GitHub Issues
- Documentation: This README and inline code documentation
- Examples: See
examples/directory for Jupyter notebooks
📈 Citation
If you use this package in research, please cite:
McCarty, J. (2025). pyepwmorph: A Python package for climate-informed building performance analysis.
Version 1.0.3. https://github.com/justinfmccarty/pyepwmorph
🌟 Star this repository if you find it useful!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyepwmorph-1.1.0.tar.gz.
File metadata
- Download URL: pyepwmorph-1.1.0.tar.gz
- Upload date:
- Size: 45.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da67d3d34dc4ab9b2af8517bb5448db516b221375ff209463591af53723d8c8c
|
|
| MD5 |
0966d30e1ae0fba0c39ab789e565c9cc
|
|
| BLAKE2b-256 |
3013bc90ee5ebe872084b15569c4ec4828eb99144321e7db0608e17629723f91
|
Provenance
The following attestation bundles were made for pyepwmorph-1.1.0.tar.gz:
Publisher:
publish.yml on justinfmccarty/pyepwmorph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyepwmorph-1.1.0.tar.gz -
Subject digest:
da67d3d34dc4ab9b2af8517bb5448db516b221375ff209463591af53723d8c8c - Sigstore transparency entry: 641841860
- Sigstore integration time:
-
Permalink:
justinfmccarty/pyepwmorph@aa3b7829ce5d6d82e4eb93c18b830fcc73ef8942 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/justinfmccarty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa3b7829ce5d6d82e4eb93c18b830fcc73ef8942 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyepwmorph-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyepwmorph-1.1.0-py3-none-any.whl
- Upload date:
- Size: 51.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
026e64482d0a336b2406316ae6b6900966c95a1d1d55083627fde585fae23d33
|
|
| MD5 |
20ba6f25bdfa88f306427979e3378060
|
|
| BLAKE2b-256 |
525bcd485ecfc8fa7e09f69f273777511b63168233b6391f97c5c1022aecdda3
|
Provenance
The following attestation bundles were made for pyepwmorph-1.1.0-py3-none-any.whl:
Publisher:
publish.yml on justinfmccarty/pyepwmorph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyepwmorph-1.1.0-py3-none-any.whl -
Subject digest:
026e64482d0a336b2406316ae6b6900966c95a1d1d55083627fde585fae23d33 - Sigstore transparency entry: 641841861
- Sigstore integration time:
-
Permalink:
justinfmccarty/pyepwmorph@aa3b7829ce5d6d82e4eb93c18b830fcc73ef8942 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/justinfmccarty
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aa3b7829ce5d6d82e4eb93c18b830fcc73ef8942 -
Trigger Event:
release
-
Statement type: