File size: 7,199 Bytes
1a11227
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
---
license: cc-by-4.0
task_categories:
  - tabular-regression
  - image-to-image
tags:
  - meteorology
  - weather
  - ERA5
  - ECMWF
  - reanalysis
  - gridded-data
  - patches
size_categories:
  - 100K<n<1M
---

# ERA5 Patchified Dataset

Patches extracted from ECMWF ERA5 reanalysis on a 0.25° global grid, tiled into 128×128 non-overlapping patches with float16 normalized channels. Designed for ML training — use alongside [IFS HRES open data](https://huggingface.co/datasets/meteolibre-dev/weather_ifs_hres_128_0dot025) at inference time for a train-on-reanalysis / infer-on-forecast workflow.

## Data Structure

Files are stored as Parquet, named:

```
era5_{first_snapshot}_{region}_patches_{group_idx:04d}_{file_idx:04d}.parquet
```

### Columns

| Column | Type | Description |
|---|---|---|
| `ifs_data` | bytes | Raw float16 bytes of the (T, C, H, W) patch tensor |
| `ifs_shape` | list[int] | Shape tuple, e.g. `[3, 77, 128, 128]` |
| `ifs_dtype` | str | `"e"` (numpy half / float16) |
| `channel_names` | list[str] | Ordered channel names (see below) |
| `channel_offsets` | list[float] | Per-channel normalization offset |
| `channel_scales` | list[float] | Per-channel normalization scale |
| `elevation_data` | bytes | Float16 elevation patch (128, 128) |
| `elevation_shape` | list[int] | `(128, 128)` |
| `elevation_dtype` | str | `"e"` (float16) |
| `epsg` | int | CRS, always `4326` |
| `lon` | float | Center longitude of patch |
| `lat` | float | Center latitude of patch |
| `patch_x_idx` | int | X index in the regional grid |
| `patch_y_idx` | int | Y index in the regional grid |
| `region` | str | Region name (e.g. `europe`, `global`) |
| `snapshot_labels` | list[str] | ISO labels of the T snapshots |
| `time_spacing_hours` | int | Hours between snapshots (`6`) |
| `resolution` | float | Grid resolution in degrees (`0.25`) |
| `patch_size` | int | Spatial patch size (`128`) |
| `source` | str | Always `"era5"` |

### Recovering the Tensor

```python
import numpy as np
import pyarrow.parquet as pq

table = pq.read_table("era5_2024-06-01T0000Z_europe_patches_0000_0000.parquet")
row = table.slice(0, 1).to_pydict()

# Reconstruct tensor
tensor = np.frombuffer(row["ifs_data"][0], dtype=row["ifs_dtype"][0]).reshape(row["ifs_shape"][0])
# tensor shape: (T, C, 128, 128), float16

# De-normalize
for ci, (offset, scale) in enumerate(zip(row["channel_offsets"][0], row["channel_scales"][0])):
    if scale != 0:
        tensor[:, ci, :, :] = tensor[:, ci, :, :].astype(np.float32) * scale + offset
```

## Channels (77 total)

### Surface (13 channels)

| # | Name | Description | Unit | Offset | Scale |
|---|---|---|---|---|---|
| 1 | `mucape` | Convective available potential energy (surface-based) | J kg⁻¹ | 0 | 500 |
| 2 | `2t` | 2m temperature | K | 273.15 | 40 |
| 3 | `2d` | 2m dewpoint temperature | K | 273.15 | 30 |
| 4 | `10u` | 10m U wind component | m s⁻¹ | 0 | 30 |
| 5 | `10v` | 10m V wind component | m s⁻¹ | 0 | 30 |
| 6 | `100u` | 100m U wind component | m s⁻¹ | 0 | 40 |
| 7 | `100v` | 100m V wind component | m s⁻¹ | 0 | 40 |
| 8 | `tp` | Total precipitation | m | 0 | 0.05 |
| 9 | `sp` | Surface pressure | Pa | 101325 | 5000 |
| 10 | `msl` | Mean sea level pressure | Pa | 101325 | 5000 |
| 11 | `tcwv` | Total column water vapour | kg m⁻² | 0 | 50 |
| 12 | `tcc` | Total cloud cover | (0–1) | 0 | 1 |
| 13 | `lsm` | Land-sea mask | (0–1) | 0 | 1 |

### Pressure Levels × 8 variables = 64 channels

Levels: **1000, 925, 850, 700, 500, 300, 250, 200 hPa**

| # | Prefix | Description | Unit | Offset | Scale |
|---|---|---|---|---|---|
| 14–21 | `t_{level}` | Temperature | K | 273.15 | 50 |
| 22–29 | `u_{level}` | U wind component | m s⁻¹ | 0 | 60 |
| 30–37 | `v_{level}` | V wind component | m s⁻¹ | 0 | 60 |
| 38–45 | `q_{level}` | Specific humidity | kg kg⁻¹ | 0 | 0.02 |
| 46–53 | `w_{level}` | Vertical velocity | Pa s⁻¹ | 0 | 5 |
| 54–61 | `gh_{level}` | Geopotential height | m | 5000 | 30000 |
| 62–69 | `vo_{level}` | Relative vorticity | s⁻¹ | 0 | 5×10⁻⁴ |
| 70–77 | `r_{level}` | Relative humidity | % | 50 | 50 |

Full channel name example: `t_850` = temperature at 850 hPa.

## Normalization

Values are stored normalized as float16:

```
normalized = (raw_value - offset) / scale
```

Recover raw values with:

```
raw_value = normalized * scale + offset
```

Normalization constants are **identical to the IFS HRES dataset**, enabling seamless cross-training (train on ERA5, infer on IFS HRES) without re-normalization.

## Temporal Structure

Each patch contains **T consecutive analysis snapshots** spaced **6 hours** apart (cycles 00, 06, 12, 18 UTC). The default is T=3 (18h window).

Consecutive patch groups stride by T×6 hours for continuous temporal coverage with no gaps:

```
Group 1: 00z → 06z → 12z
Group 2: 18z → 00z(+1d) → 06z(+1d)
Group 3: 12z(+1d) → 18z(+1d) → 00z(+2d)
...
```

## Spatial Coverage

| Region | Bounding Box (lon_min, lat_min, lon_max, lat_max) |
|---|---|
| `global` | (-180, -90, 180, 90) |
| `europe` | (-30, 30, 45, 75) |
| `north_atlantic` | (-80, 20, 0, 70) |
| `north_america` | (-140, 15, -50, 75) |
| `asia` | (50, 0, 160, 75) |

Grid: 0.25° × 0.25° regular lat-lon (EPSG:4326). Patches are non-overlapping 128×128 grid cells (≈32° × 32° at 0.25° resolution).

## Comparison with IFS HRES Patchified Dataset

| | ERA5 (this dataset) | IFS HRES |
|---|---|---|
| **Type** | Reanalysis (best-estimate historical) | Operational analysis (near-real-time) |
| **Temporal range** | 1940 → present | Rolling 2–3 days only |
| **Latency** | ~5 days (ERA5T) / ~2 months (final) | Near real-time |
| **Resolution** | 0.25° | 0.25° (open data) / 0.08° (licensed) |
| **Consistency** | Reanalysis = physically consistent | Model upgrades cause breaks |
| **CAPE** | Surface-based CAPE | Most-unstable CAPE |
| **Channels** | 77 (no `tprate`) | 78 (includes `tprate`) |
| **Geopotential** | Height (m) after ÷9.80665 | Height (m) |
| **Normalization** | Same offsets/scales | Same offsets/scales |

**Recommended workflow**: Train on ERA5 (years of consistent data), infer on IFS HRES (real-time availability). The shared normalization and channel naming makes this a drop-in switch.

## Elevation

Each patch includes a 128×128 float16 elevation map derived from a global DEM, reprojected to the same 0.25° grid. Elevation is stored raw (meters above sea level), not normalized.

## Source

Data downloaded from the [Copernicus Climate Data Store (CDS)](https://cds.climate.copernicus.eu) via the `cdsapi` Python client.

- Surface: [`reanalysis-era5-single-levels`](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels)
- Pressure levels: [`reanalysis-era5-pressure-levels`](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-pressure-levels)

## License

CC-BY-4.0 — please attribute ECMWF / Copernicus Climate Change Service as the data source. See the [CDS terms of use](https://cds.climate.copernicus.eu/api/v2/terms/static/licence-to-use-copernicus-products.pdf) and [ERA5 licence](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels/licence).