Skip to content

Latest commit

Β 

History

History
101 lines (73 loc) Β· 2.29 KB

File metadata and controls

101 lines (73 loc) Β· 2.29 KB

🌍 era5py

Download, post-process and analyse ERA-5 reanalysis data via the CDS API.


πŸš€ Usage

python run_era5.py -o download -c settings_name.yml
Flag Values Description
-o download, process, visualize, stats Operation to run
-c e.g. settings_bolivia.yml Settings file inside etc/

πŸ“ Files are saved as era5_raw_<year>_<variable>_<name>.nc inside output_dir.


🌑️ Variables supported

Short name ERA-5 variable
t2m 2 m temperature
d2m 2 m dewpoint temperature
tp Total precipitation
u10 / v10 10 m U/V wind components
u100 / v100 100 m U/V wind components
wind at target heights Reconstructed via log-wind profile

✨ Derived outputs: temperature in °C, precipitation in mm, specific humidity (g kg⁻¹), wind speed at 10 / 30 / 50 m.


πŸ“‚ Project layout

era5py/
β”œβ”€β”€ run_era5.py              # πŸ”‘ Entry point
β”œβ”€β”€ etc/
β”‚   └── settings_name.yml   # βš™οΈ  User configuration files
β”œβ”€β”€ data/
β”‚   └── name/               # πŸ“₯ Downloaded NetCDF files
β”œβ”€β”€ results/
β”‚   └── name/               # πŸ“Š Processed CSVs and figures
β”œβ”€β”€ requirements.txt
└── src/era5py/
    β”œβ”€β”€ __init__.py
    β”œβ”€β”€ download_era5.py     # ⬇️  Download functions
    β”œβ”€β”€ post_processing.py   # πŸ“ˆ Statistics
    └── process_era5.py      # πŸ”„ Processing and visualisation

βš™οΈ Requirements

Python 3.12 and:

pip install -r requirements.txt

πŸ”‘ CDS API key

  1. Register at https://cds.climate.copernicus.eu
  2. Follow the how-to-api guide to create ~/.cdsapirc:
url: https://cds.climate.copernicus.eu/api
key: <YOUR_API_KEY>

πŸ—‚οΈ Configuration

Create a settings file inside etc/ (use etc/settings_example.yml as a template):

year_start: 2020
year_end:   2021
name:       bolivia

variables:
  - 2m_temperature
  - total_precipitation

mode: area            # "point" or "area"

lat:  -16.5           # used when mode = point
lon:  -68.15

area:                 # used when mode = area
  north:  -8.0
  west:  -70.0
  south: -24.0
  east:  -57.0