A tool to convert ERA5/ECMWF data to EnergyPlus Weather (EPW) format
Project description
ERA5 to EPW Converter
A tool that fetches ERA5 data and generates a full year AMY (Actual Meteorological Year) EnergyPlus Weather file (EPW).
The tool takes care of fetching the necessary data from the Copernicus Climate Data Store (CDS) and the Copernicus Atmosphere Data Store (CAMS), processing it, and formatting it into the EPW format. It's designed for fast and efficient data retrieval.
Installation
Prerequisites
Make sure to register for an API key and validate licences at:
- https://cds.climate.copernicus.eu/ (ERA5 data)
- https://ads.atmosphere.copernicus.eu/ (Copernicus Atmosphere Data Store)
Then create the file ~/.cdsapirc with the following content:
url: https://cds.climate.copernicus.eu/api/v2
key: <your_api_key>
Note: the URL will be dynamically managed by the script depending on the data source. The API key doesn't vary, it's the same for both ERA5 and CAMS data.
Moreover, before proceeding, it is required to accept all the licenses in the section "Your profile" in the website of Copernicus.
Install the package
From PyPI
pip install era5epw
From source
Clone the current repository and install the required dependencies using Poetry:
git clone https://github.com/airboxlab/era5epw.git
poetry install
Usage
[!NOTE] When running in a Jupyter notebook, to make progress bars and interactive widgets work, make sure to install
ipywidgetsand to enable the widgets extension.
pip install ipywidgets
# optional, not needed with Jupyter Notebook 7+
jupyter nbextension enable --py widgetsnbextension
Generating EPW Files
Command line interface
Example usage:
# using poetry, execute in local repository
poetry run era5epw_download --year 2024 --latitude 49.4 --longitude 0.1 --city-name "Le Havre" --elevation 0 --time-zone 1
# using installed binary, after pypi package installation
era5epw_download --year 2024 --latitude 49.4 --longitude 0.1 --city-name "Le Havre" --elevation 0 --time-zone 1
By default, the time-zone argument is used only to populate the LOCATION header and data time is UTC. Use --apply-time-zone-to-data to apply it to the date and time fields (this will shift the UTC time by the provided time zone offset).
Use --help to have a list of available options.
Python API
Example usage:
from era5epw.main import download_and_make_epw
download_and_make_epw(
year=2025,
latitude=48.8,
longitude=2.4,
city_name="Paris",
time_zone=1,
elevation=0,
output_file="/tmp/era5epw_paris_2025.epw",
apply_time_zone_to_data=True,
)
Visualizing EPW Files
The package includes an interactive visualization tool for EPW files that supports three types of plots: 2D line charts, 3D surface plots, and radar (polar) plots.
Command line interface
# List available weather series in an EPW file
era5epw_visualize path/to/file.epw --list-series
# Create a 2D line plot (default)
era5epw_visualize path/to/file.epw --series "Dry Bulb Temperature" --type 2D
# Create a 3D surface plot
era5epw_visualize path/to/file.epw --series "Wind Speed" --type 3D
# Create a radar plot showing daily min/max values
era5epw_visualize path/to/file.epw --series "Global Horizontal Radiation" --type radar
# Save visualization to HTML file
era5epw_visualize path/to/file.epw --series "Dry Bulb Temperature" --output visualization.html
Python API
Use in Jupyter notebooks or Python scripts:
from era5epw.visualize import visualize_epw
# Create interactive 2D plot
fig = visualize_epw(
epw_file_path="path/to/file.epw",
series_name="Dry Bulb Temperature",
plot_type="2D",
show=True # Display immediately in Jupyter
)
# Create 3D surface plot
fig = visualize_epw(
epw_file_path="path/to/file.epw",
series_name="Wind Speed",
plot_type="3D",
show=True
)
# Create radar plot
fig = visualize_epw(
epw_file_path="path/to/file.epw",
series_name="Global Horizontal Radiation",
plot_type="radar",
show=True
)
# Save to HTML file
fig.write_html("visualization.html")
Documentation
Datasets home pages:
- ERA5 hourly time-series data on single levels from 1940 to present (Experimental)
- ERA5 Land hourly time-series data from 1950 to present (Experimental)
- ERA5 hourly data on single levels from 1940 to present
- CAMS solar radiation time-series
View your API requests and download responses at:
Check CDS API status at CDS Live, it provides information about congestion for each dataset.
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
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 era5epw-0.6.0.tar.gz.
File metadata
- Download URL: era5epw-0.6.0.tar.gz
- Upload date:
- Size: 21.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.8.0-101-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4b05d406fe61ba6ea8127d6c19c6789c4428ab21d1f0316edf5a3b51da32b22
|
|
| MD5 |
8095a9767ba48a508f9428a1bac34e8b
|
|
| BLAKE2b-256 |
0d71c3a8dbbdbe7c9bf45ef2e18df69ccf5b211b5836cc37e6f4d0b6f90f2171
|
File details
Details for the file era5epw-0.6.0-py3-none-any.whl.
File metadata
- Download URL: era5epw-0.6.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.8.0-101-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
714e7cebdc853e5adb5137d5a27e02e061ce88ff9a86c77b50ca102057dc881c
|
|
| MD5 |
85f7e4afa79a13b0d30aa057ea6dd8f5
|
|
| BLAKE2b-256 |
f97dbd3adeeaa88f1fce15ba7a56fa3f0a6150fcc6f5707d8e53f10d0f4c4f83
|