JRC European flood hazard — API reference#
JRC European Flood Hazard Map (EFHM) backend subpackage — earthlens.jrc_flood.
Background and usage are covered under the other pages in this section
(Introduction, Usage,
Available datasets); this page is the rendered API. The EFHM is
public (anonymous HTTPS), so there is no auth module.
earthlens.jrc_flood
#
JRC European flood-hazard (EFHM) backend for earthlens.
Exposes JRCFlood, the AbstractDataSource backend that reads the JRC European
Flood Hazard Map (river-flood water depth per return period, Europe and the
Mediterranean Basin) from the open JRC HTTPS directory via lazy /vsicurl
windowed reads and crops it to the AOI via pyramids, plus its Catalog /
Dataset catalog surface.
Catalog
#
Bases: AbstractCatalog
Product catalog for the JRC European flood-hazard backend.
Reads the bundled jrc_flood_data_catalog.yaml and exposes its single row
under the inherited datasets field — which supplies the cat["efhm"] /
"efhm" in cat / len(cat) surface and the did-you-mean error for free.
Instantiate with no arguments; the base model_post_init auto-loads via
_autoload, cached by (path, mtime).
Attributes:
| Name | Type | Description |
|---|---|---|
datasets |
dict[str, Dataset]
|
Product key to its |
available_datasets |
list[str]
|
Sorted product keys. |
license_id |
str
|
SPDX-ish licence label ( |
attribution |
str
|
The citation the licence requires. |
Examples:
- List products and read the licence:
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
get(key)
#
Return the Dataset for key, with a did-you-mean hint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A product key ( |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dataset |
Dataset
|
The matching product row. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
get_catalog()
#
Return the product map (satisfies the abstract contract).
Returns:
| Type | Description |
|---|---|
dict[str, Dataset]
|
dict[str, Dataset]: Same object as |
load(catalog_path=None)
classmethod
#
Read and validate the JRC-flood catalog from disk (cached).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog_path
|
Path | None
|
Path to the catalog YAML. Defaults to the
module-level |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Catalog |
Catalog
|
A fully-populated catalog. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
Dataset
#
Bases: BaseModel
One EFHM product row.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The catalog key ( |
title |
str
|
Human-readable product title. |
band |
str
|
The single water-depth band name ( |
long_name |
str
|
Human-readable band description. |
units |
str
|
Physical units of the band ( |
dtype |
str
|
Pixel data type ( |
crs |
str
|
Native CRS as an EPSG string ( |
nodata |
float
|
The raster no-data value. |
spatial_resolution |
float | None
|
Nominal resolution in metres ( |
base_url |
str
|
The JRC directory root the return-period files live in. |
filename_template |
str
|
The per-return-period file-name template
( |
return_periods |
list[int]
|
The published return periods in years. |
source_url |
str
|
The dataset landing page. |
Examples:
- Read the return periods and band:
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
JRCFlood
#
Bases: AbstractDataSource
JRC European Flood Hazard Map backend (raster GeoTIFF output).
Fetches the EFHM water-depth grid for one or more return periods, cropped to
the request bbox, via lazy /vsicurl windowed reads. The request is a
search/fetch split: _search names one product per return period, _fetch
realises each (windowed read → crop → GeoTIFF).
Attributes:
| Name | Type | Description |
|---|---|---|
OUTPUT_KIND |
OutputKind
|
Fixed |
Examples:
-
A small AOI writes one cropped GeoTIFF per return period (marked
+SKIP— it hits the live JRC directory):
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
__init__(start='', end='', lat_lim=None, lon_lim=None, return_periods=None, temporal_resolution='static', path=None, fmt='%Y-%m-%d', *, catalog=None)
#
Initialise a JRC-flood backend instance.
The EFHM has a single water_depth band, so the backend is facet-only
(it declares no variables axis); the request axis is return_periods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
str
|
Accepted for facade parity; ignored (the EFHM is static). |
''
|
end
|
str
|
Accepted for facade parity; ignored. |
''
|
lat_lim
|
list[float] | None
|
|
None
|
lon_lim
|
list[float] | None
|
|
None
|
return_periods
|
list[int | str] | int | str | None
|
One return period, or a list, in years — as ints
( |
None
|
temporal_resolution
|
str
|
Advisory label only (the EFHM is static). |
'static'
|
path
|
Path | str | None
|
Output directory for the written GeoTIFF(s). |
None
|
fmt
|
str
|
Accepted for facade parity; unused. |
'%Y-%m-%d'
|
catalog
|
Catalog | None
|
Optional pre-built |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the bounding box is missing or a requested return period is not published. |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
download(progress_bar=True, *, force=False)
#
Fetch the EFHM subset(s) as one AOI-cropped GeoTIFF per return period.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_bar
|
bool
|
Accepted for signature parity; one read per period. |
True
|
force
|
bool
|
Re-fetch even when a complete output already exists. |
False
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
list[Path]: The written GeoTIFF path(s), one per return period. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the AOI is outside the EFHM's Europe / Mediterranean
coverage. (An antimeridian-crossing |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
earthlens.jrc_flood.backend
#
JRC European flood-hazard backend — JRCFlood(AbstractDataSource).
JRCFlood is a download-and-localise raster backend (OUTPUT_KIND="raster")
for the JRC European Flood Hazard Map (EFHM): "River flood hazard maps for
Europe and the Mediterranean Basin". Each cell value is river-flood water depth
(m) for a chosen return period.
A request is a bbox (lat_lim / lon_lim) plus one or more return_periods.
The product is static, so start / end are accepted for facade parity and
ignored, and the facade-forwarded aggregate= is rejected (return periods are
not a reducible time axis). Each return period is one whole-Europe EPSG:4326
GeoTIFF of ~23 GB uncompressed, so the backend never reads it whole: it opens
the file lazily over GDAL's /vsicurl (HTTP range requests), reads only the
AOI's pixel window through pyramids, and writes one cropped GeoTIFF per return
period. An AOI outside the Europe / Mediterranean coverage raises a clear
ValueError rather than writing an empty raster.
The product is public and CC-BY-4.0 (permissive), so there is no auth module and
no LicenseWarning. The raster read happens through pyramids (a windowed
read_array), so this is a genuine pyramids-consuming backend — no xarray.
JRCFlood
#
Bases: AbstractDataSource
JRC European Flood Hazard Map backend (raster GeoTIFF output).
Fetches the EFHM water-depth grid for one or more return periods, cropped to
the request bbox, via lazy /vsicurl windowed reads. The request is a
search/fetch split: _search names one product per return period, _fetch
realises each (windowed read → crop → GeoTIFF).
Attributes:
| Name | Type | Description |
|---|---|---|
OUTPUT_KIND |
OutputKind
|
Fixed |
Examples:
-
A small AOI writes one cropped GeoTIFF per return period (marked
+SKIP— it hits the live JRC directory):
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | |
__init__(start='', end='', lat_lim=None, lon_lim=None, return_periods=None, temporal_resolution='static', path=None, fmt='%Y-%m-%d', *, catalog=None)
#
Initialise a JRC-flood backend instance.
The EFHM has a single water_depth band, so the backend is facet-only
(it declares no variables axis); the request axis is return_periods.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
str
|
Accepted for facade parity; ignored (the EFHM is static). |
''
|
end
|
str
|
Accepted for facade parity; ignored. |
''
|
lat_lim
|
list[float] | None
|
|
None
|
lon_lim
|
list[float] | None
|
|
None
|
return_periods
|
list[int | str] | int | str | None
|
One return period, or a list, in years — as ints
( |
None
|
temporal_resolution
|
str
|
Advisory label only (the EFHM is static). |
'static'
|
path
|
Path | str | None
|
Output directory for the written GeoTIFF(s). |
None
|
fmt
|
str
|
Accepted for facade parity; unused. |
'%Y-%m-%d'
|
catalog
|
Catalog | None
|
Optional pre-built |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the bounding box is missing or a requested return period is not published. |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
download(progress_bar=True, *, force=False)
#
Fetch the EFHM subset(s) as one AOI-cropped GeoTIFF per return period.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_bar
|
bool
|
Accepted for signature parity; one read per period. |
True
|
force
|
bool
|
Re-fetch even when a complete output already exists. |
False
|
Returns:
| Type | Description |
|---|---|
list[Path]
|
list[Path]: The written GeoTIFF path(s), one per return period. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the AOI is outside the EFHM's Europe / Mediterranean
coverage. (An antimeridian-crossing |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/backend.py
earthlens.jrc_flood.catalog
#
Catalog loader for the JRC European flood-hazard (EFHM) backend.
EFHM is a single product served as one whole-Europe GeoTIFF per return period,
so the catalog is one jrc_flood_data_catalog.yaml at the package root holding
the dataset row (band, CRS, the return-period list, the URL template) plus the
CC-BY-4.0 licence / attribution. It loads through the shared strict YAML loader
and the (path, mtime) parse cache, and exposes the row via the inherited
AbstractCatalog surface (cat["efhm"], get_dataset, the did-you-mean error).
CATALOG_PATH is the bundled YAML; clear_catalog_cache empties the parse
cache (used by tests that monkey-patch CATALOG_PATH).
Catalog
#
Bases: AbstractCatalog
Product catalog for the JRC European flood-hazard backend.
Reads the bundled jrc_flood_data_catalog.yaml and exposes its single row
under the inherited datasets field — which supplies the cat["efhm"] /
"efhm" in cat / len(cat) surface and the did-you-mean error for free.
Instantiate with no arguments; the base model_post_init auto-loads via
_autoload, cached by (path, mtime).
Attributes:
| Name | Type | Description |
|---|---|---|
datasets |
dict[str, Dataset]
|
Product key to its |
available_datasets |
list[str]
|
Sorted product keys. |
license_id |
str
|
SPDX-ish licence label ( |
attribution |
str
|
The citation the licence requires. |
Examples:
- List products and read the licence:
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
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 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 | |
get(key)
#
Return the Dataset for key, with a did-you-mean hint.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
A product key ( |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Dataset |
Dataset
|
The matching product row. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
get_catalog()
#
Return the product map (satisfies the abstract contract).
Returns:
| Type | Description |
|---|---|
dict[str, Dataset]
|
dict[str, Dataset]: Same object as |
load(catalog_path=None)
classmethod
#
Read and validate the JRC-flood catalog from disk (cached).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
catalog_path
|
Path | None
|
Path to the catalog YAML. Defaults to the
module-level |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Catalog |
Catalog
|
A fully-populated catalog. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
Dataset
#
Bases: BaseModel
One EFHM product row.
Attributes:
| Name | Type | Description |
|---|---|---|
id |
str
|
The catalog key ( |
title |
str
|
Human-readable product title. |
band |
str
|
The single water-depth band name ( |
long_name |
str
|
Human-readable band description. |
units |
str
|
Physical units of the band ( |
dtype |
str
|
Pixel data type ( |
crs |
str
|
Native CRS as an EPSG string ( |
nodata |
float
|
The raster no-data value. |
spatial_resolution |
float | None
|
Nominal resolution in metres ( |
base_url |
str
|
The JRC directory root the return-period files live in. |
filename_template |
str
|
The per-return-period file-name template
( |
return_periods |
list[int]
|
The published return periods in years. |
source_url |
str
|
The dataset landing page. |
Examples:
- Read the return periods and band:
Source code in libs/providers/hazards/src/earthlens/jrc_flood/catalog.py
earthlens.jrc_flood._helpers
#
URL builder for the JRC European flood-hazard backend.
The JRC serves the European Flood Hazard Map (EFHM) over a deterministic,
anonymous HTTPS directory (verified live 2026-08-09): one whole-Europe GeoTIFF
per return period at {BASE_URL}/Europe_RP{rp}_filled_depth.tif. Each file is a
single-band EPSG:4326 Float32 grid at ~0.000833 deg (~90 m; documented 100 m),
covering Europe and the Mediterranean Basin — 110162x51992 px (~23 GB
uncompressed), so it is never read whole. The backend opens it lazily over
pyramids.dataset.Dataset.crop(bbox=), whose windowed fast path reads only the
AOI's pixel window over GDAL's /vsicurl (HTTP range requests) for an
axis-aligned box in the source CRS — the case here (an EPSG:4326 AOI against the
4326 EFHM). This module only builds the per-return-period URL; the windowed read
+ crop live in the backend, which wraps them in vsicurl_config() for the
/vsicurl readdir-suppression + retry/timeout tuning.
efhm_url(rp, *, base_url=BASE_URL, template=FILENAME_TEMPLATE)
#
Build the EFHM GeoTIFF URL for one return period.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rp
|
int
|
The integer return period in years (e.g. |
required |
base_url
|
str
|
The directory root; defaults to |
BASE_URL
|
template
|
str
|
The file-name template; defaults to |
FILENAME_TEMPLATE
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The fully-qualified |
Examples:
- The verified RP100 URL: