FireIgnition: custom DEFAIR readers, lightning and new fires
A Destination Earth / DEFAIR use case: three new readers for LSA SAF and H SAF products, and a study of lightning ignition over the Iberian Peninsula from an AI ready cube
Overview¶
What this notebook does¶
Every summer, some of the fires in the Iberian Peninsula are started by lightning. Two instruments on the same Meteosat Third Generation satellite now see both sides of that story: the Lightning Imager records every flash, and the Flexible Combined Imager detects the fires that appear afterwards. This notebook brings them together with three more pieces of the picture: how dry the vegetation was, how much rain fell with the storm, and how much water the air held before it. DEFAIR turns these six products from four different sources into one AI ready data cube. The cube is then used to answer two questions: is lightning followed by more new fires, and does dry weather make that effect stronger.
The notebook has two main sections:
Readers. Three of the six products have no built-in reader in DEFAIR. The process of writing and register a reader is explained step by step in detail using the reader of the Fire Risk Map, to be used like a native built-in reader. The other two readers follow the same process.
Analysis. The finished cube is opened from the project bucket with one call and used to answer two research questions.
The cube is built in the companion notebook Fire ignition cube preparation. It reads the raw products with the readers shown here, puts them on one regular grid, defines the case study settings and data preparation, defines the fire label and saves the result (cube) in the project’s bucket. You do not need to run it before this notebook!, it works only as support of the process and transparency.
Scientific background¶
In the Mediterranean Basin, lightning causes about 5 % of forest fires (Soler et al., 2021). Lightning fires often start in remote areas, where they can spread before anyone detects and suppresses them, and some become the largest fires of the summer. Dry thunderstorms, which bring lightning with little rain, are considered an important cause of these fires (Pérez-Invernón et al., 2021). In Catalonia, roughly one in 1,000 cloud-to-ground flashes starts a flaming wildfire (Soler et al., 2021). The question here is under which conditions a lightning strike leads to a fire.
This analysis builds on earlier studies of lightning ignition in the Iberian Peninsula. Vecín-Arias et al. (2016) combined lightning, vegetation, topography and weather data with logistic regression and random forests over central Spain. Rodrigues et al. (2023) used more than 17 million lightning strikes to train a machine learning model of the daily probability of lightning ignition across the peninsula, from fuel, vegetation and lightning characteristics. Pineda and Rigo (2017) examined the role of rain during thunderstorms. The delay between the strike and the detection of the fire is called the holdover time (window), and it is usually short: in the Swiss Alps, most fires were detected within 24 hours of the igniting strike (Moris et al., 2020). Moris et al. (2023) give a global overview of holdover times.
This use case applies the same approach with a new observing system. The MTG Lightning Imager is the first geostationary optical lightning detector over Europe (Enno et al., 2026). It observes all lightning, day and night, over the whole peninsula, and measures the duration and extent of each flash, which are tested here as possible predictors of ignition.
The Flexible Combined Imager on the same satellite detects fires every ten minutes, so lightning and fires are observed from one platform on the same time scale. Fire data from space are consistent across national borders and do not depend on national records of fire causes. Satellite products also describe the air before the storm and the rain during it, both important for the dry thunderstorms behind large fires (Pineda and Rigo, 2017; Pérez-Invernón et al., 2021).
All inputs are available operationally and come from EUMETSAT and its Satellite Application Facilities, so the same analysis can be repeated for each new fire season.
The study covers the 37 convective episodes between 1 July and 9 September 2026 over the Iberian Peninsula, on wildland cover used as mask for the aoi: needle-leaved trees, broadleaved deciduous and evergreen trees, shrubs and permanent herbaceous vegetation.
Research questions¶
RQ1. Do wildland cells hit by lightning have a higher probability of a new fire in the 48 hours after the first flash than the same cells without lightning under similar rain?
RQ2. Does that excess risk depend on how dry the fuel is and how much water the air held before the storm?
Hypotheses¶
- RQ1 is answered using the relative risk (RR)
- the probability of a new fire in cells with lightning divided by the probability in cells without it.
H0, the null hypothesis: RR = 1. Cells with and without lightning have the same probability of a new fire.
H1, the alternative hypothesis: RR > 1. A new fire is more likely where lightning struck.
H0 is rejected when the whole 95 % interval of the RR lies above 1.
RQ2 compares that relative risk between dry and wet conditions. If dry thunderstorms are the ones that start fires, the relative risk should be larger where the fuel is drier and where the air held less water: RR(dry) > RR(wet). RQ2 is exploratory: it measures the size and direction of the effect, does dryness change what a flash does?. Here a logistic regression and XGboost algorithms are used to answer the second question.
Data sources¶
| Product | Instrument / platform | Source | Format | Variables (units) | Role in the analysis |
|---|---|---|---|---|---|
| LI LFL (Lightning Flashes, Level 2) | Lightning Imager, MTG-I1 | EUMETSAT, DestinE HDA | NetCDF4, one file per 10 minute slot, a list of flashes | flash_time (UTC), latitude, longitude (°), flash_duration (ms), flash_footprint (number of LI pixels), number_of_events (count) | Exposure (was the cell hit?) and storm descriptors |
| FCI GII (Global Instability Indices, Level 2) | Flexible Combined Imager, MTG-I1 | EUMETSAT, DestinE HDA | NetCDF4, one file per 10 minute slot, full disc grid of about 6 km, clear sky only | k_index (K), lifted_index (K), prec_water_total (kg m⁻², equivalent to mm) | Air before the storm |
| LSA-509 FRP-Pixel | Flexible Combined Imager, MTG-I1 | LSA SAF (IPMA) data service | NetCDF4, one file per 10 minute slot with a fire list and a 1 km quality image, archived as daily Iberian crops | ACQTIME (UTC), LATITUDE_PARALLAX, LONGITUDE_PARALLAX (°), ABS_LINE, ABS_SAMP (FCI pixel), FRP (MW), qualityflag (class) | Label (new fire) and visibility |
| LSA FRM (Fire Risk Map, 24 h forecast) | SEVIRI, MSG | EUMETSAT, DestinE HDA | HDF5, one file per day, 3 km | FWI, FFMC, DMC, DC (dimensionless codes) | State of the fuel |
| H SAF H61B | SEVIRI, MSG | H SAF, official FTP | Gzipped NetCDF, one file per day, full disc at 3 km | acc_rr (mm) | Rain that fell with the lightning |
| CLC+ Backbone 2023 | Derived from Sentinel-2 MSI time series | Copernicus Land Monitoring Service, WEkEO | GeoTIFF tiles, 10 m, EPSG:3035 | Eleven land cover classes | Study area and fuel type |
The raw products were copied once into the project bucket, unchanged except for two of them: the LSA-509 full disc files were cut to a fixed Iberian window of rows and columns, and CLC+ was aggregated to the vegetation classes and resampled to 10km cell
An episode, or storm day, is one calendar (July-September) day of the 2026 season (00:00 to 24:00 UTC) with significant lightning over the study area. To screen the season cheaply, only three of the 144 daily flash files were read for each day, at 13:00, 17:00 and 21:00 UTC (highest convective time in a summer day), and the day was kept when they held at least (>=100) flashes over Iberia. A short storm that fell entirely between those slots can be missed. The season scan found 37 episodes.
Main assumptions¶
The companion notebook shows in detail how each of these is built.
One sample is one 10 km cell on one storm day. A cell is exposed when the Lightning Imager saw at least one flash in it that day. The instrument counts all lightning and cannot tell the flashes that reach the ground from those that stay in the cloud.
Each flash is moved back along the satellite’s line of sight to a cloud height of 10 km. Without this correction a flash over Iberia appears about one cell too far north (Bližňák and Sokol, 2026).
Each cell has its own 48 hour window. It starts at the first flash in the cell, or at the storm time of the day when no flash fell there. A fire first seen inside the window counts as new.
A cell is left out of a storm day when it, or one of its eight neighbours, already had a fire in the 48 hours before the window, or when the satellite could see fires in less than a quarter of its window.
Pixels with detections in three periods a week apart, or on twenty or more days, are treated as fixed heat sources such as gas flares, and removed together with their eight neighbours.
Each fire is counted once. A fire inside the windows of two storm days goes to the most recent storm.
A cell with lightning is compared with the same cell on other days without lightning and with similar rain, which keeps its terrain, vegetation and human activity fixed.(groups of cell with same conditions are compared)
The instability indices (k-index, lifted_index, prec_water_total) only exist under clear sky, so they are read between three hours and one hour before the storm time.
There is no record of what lit each fire, so the study measures association, not causation.
Prerequisites¶
The project bucket is public, so the notebook runs without credentials. The three new readers live in the
readers folder next to this notebook, as a small Python package. The cell below installs it together with
scikit-learn and XGBoost. Restart the kernel after it runs, so that DEFAIR can find the readers.
%pip install -e readers matplotlib scikit-learn xgboostfrom defair.logging import setup_logging
from defair.plugin_manager import list_readers, load_reader
from defair_data.cdm import CommonDataModel, GeostationaryParams, GriddedModel, build_point_cdm
from defair_data.core import Dataset
from defair_data.data_reader_plugin import DataReaderPlugin
import gzip
import io
import re
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
import matplotlib.colors as mcolors
from pyproj import CRS, Transformer
from IPython.display import display
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import average_precision_score, brier_score_loss
from sklearn.model_selection import LeaveOneGroupOut
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler
from xgboost import XGBClassifier
import warnings
warnings.filterwarnings("ignore", message="Consolidated metadata is currently not part") # harmless Zarr 3 notice
setup_logging(log_level="ERROR") # keeps the output readable; use "INFO" to inspect the pipeline# Use case configuration
DEMO_EPISODE = "2026-08-10" # the storm day used to show the readers
BBOX = [-10.0, 36.0, 4.0, 44.0] # study area: lon_min, lat_min, lon_max, lat_max
# The grid of the cube: EPSG:3035, cells of 10 km, 130 columns; used to give every cell an identity
X0, Y1, CELL, NX = 2_600_000, 2_500_000, 10_000, 130
# Decisions of the study design, as used to build the cube (see Main assumptions)
LABEL_HOURS = 48 # label window, from the first flash or the storm time
MIN_OBS_FRACTION = 0.25 # a cell enters the sample when visible in a quarter of its window
# Analysis
RAIN_BINS = [-np.inf, 0, 1, 5, 15, np.inf] # rain classes, in mm, used as strata together with the cell
RAIN_LABELS = ["0", "0-1", "1-5", "5-15", ">15"]
STRATA = ["cell", "rain_class"] # a cell is compared with itself under similar rain
DOSE_BINS, DOSE_LABELS = [0, 5, 20, 100, np.inf], ["1-5", "6-20", "21-100", ">100"] # flashes per cell
FEATURES_RQ2 = ["h61_precip", "frm_ffmc", "frm_dmc", "frm_dc", "lfl_flash_count", "lfl_duration_mean",
"lc_trees", "season_day", "y", "cell_base_rate"]
N_BOOT_RR, N_BOOT = 1000, 200 # bootstrap resamples of episodes: main relative risk; the rest
N_PERM = 200 # shuffles of the negative control
SEED = 0# S3 access
#=====================================================================================
# S3 object store: edit these three lines to point at a different store
S3_ENDPOINT = "https://s3.central.data.destination-earth.eu"
BUCKET = "defair-use-case"
PREFIX = "" # source prefixes and cubes/ live at the bucket root
#=====================================================================================
# The bucket is public for reading, so every read in this notebook is anonymous
S3_SOURCE_KWARGS = {"anon": True, "endpoint_url": S3_ENDPOINT}
READ = {"source": "s3", "source_kwargs": S3_SOURCE_KWARGS}
STORAGE_OPTIONS = {"anon": True, "client_kwargs": {"endpoint_url": S3_ENDPOINT}}
CUBE_KEY = "cubes/fireignition_cube.zarr/"
# Where each raw product of one day sits in the bucket
def frm_path(day):
d = pd.Timestamp(day)
return f"s3://{BUCKET}/{PREFIX}frm-orig/{d:%Y-%m-%d}/S-LSA_-HDF5_LSASAF_MSG_FRM-F024_Euro_{d:%Y%m%d}1200"
def h61_path(day):
sealed = pd.Timestamp(day) + pd.Timedelta(days=1) # the accumulation of day D is sealed at D+1 00:00
return f"s3://{BUCKET}/{PREFIX}precip-orig/h61_{sealed:%Y%m%d}_0000_24_fdk.nc.gz"
def lsa_path(day):
return f"s3://{BUCKET}/{PREFIX}lsa509-iberia/LSA509_iberia_{pd.Timestamp(day):%Y%m%d}.nc"DEFAIR reader plugins¶
What is a reader?¶
DEFAIR does not open product files directly. It uses a reader: a small plugin that knows the structure of
one file format and turns its contents into an xarray.Dataset.
A reader is a Python class that inherits from DataReaderPlugin and implements a single method, read(). The base class handles the underlying file access, including opening the raw file through self.open_file(path, source, source_kwargs), regardless of its storage location or source. The file may reside on a local disk, in an S3 bucket, or in the HDA. This abstraction means readers do not need to manage credentials, storage protocols, or file downloads. The same reader implementation can process files from any supported source without changes.
What does a reader enable?¶
Once a product has a reader, DEFAIR handles it like any other supported product. It can:
stream the data directly from S3,
read many files in one call,
crop, reproject and align it with other sources.
The product could also be converted outside DEFAIR and imported as plain arrays, but then none of these operations would be available. DEFAIR ships built-in readers for the METOP, MTG, Sentinel-3, MSG native and ERA5 families, among others. For any other product you can write your own reader and register it as a plugin, and DEFAIR then treats it exactly like a built-in one.
Which sources in this case need a reader?¶
| Source | Reader |
|---|---|
| MTG Lightning Imager flashes | mtg_li_lfl, built in |
| MTG instability indices | mtg_l2_gii, built in |
| LSA SAF Fire Risk Map | none, written in this notebook (lsa_frm) |
| LSA SAF FRP-Pixel | none, written in this notebook (lsa509_frp) |
| H SAF precipitation | none, written in this notebook (hsaf_h61) |
| CLC+ land cover | not needed: it is stored already aggregated to the cells |
Building a reader step by step: the Fire Risk Map¶
This section writes the reader for the LSA SAF Fire Risk Map one step at a time. Each step adds one feature and tests the reader on the same file, the Fire Risk Map for the demo storm day. The file has five variables, the four codes of the Canadian Fire Weather Index system (FWI, FFMC, DMC, DC) and the danger class (Risk). After each step the notebook shows FWI again, so you can see what that step changed. The last step joins all the steps into one class, which is the lsa_frm reader in the readers package.
Step 1: open the file¶
The first version of the reader only opens the file and hands its contents to xarray. The class, FRMReader,
inherits from DataReaderPlugin and has one method, read(), which receives the path of the file.
Inside read(), two lines do the work. self.open_file comes from DEFAIR and finds the file wherever it is
stored, here in the project bucket. The second line opens it with xarray, with two options this format needs:
phony_dims="sort" names the dimensions, because the HDF5 file has no names for them, and
mask_and_scale=False keeps the values exactly as stored, so the raw content is visible.
load_reader turns the class into a working reader without installing or registering anything, which is the
quickest way to test a reader while you write it. The last line shows the Fire Weather Index as read.
class FRMReader(DataReaderPlugin):
"""Fire Risk Map reader, step 1: open the file through DEFAIR's source layer."""
def read(self, path, source=None, source_kwargs=None):
f = self.open_file(path, source, source_kwargs)
return xr.open_dataset(f, engine="h5netcdf", phony_dims="sort", mask_and_scale=False)
reader = load_reader("frm_step1", plugin_class=FRMReader, fresh=True)
raw = reader.read(frm_path(DEMO_EPISODE), **READ)
raw["FWI"]The file is read, but it is not usable yet. The Fire Weather Index is stored as 16 bit integers, so a value
of 2345 means 23.45, and -8000 marks pixels without data. The dimensions have no names
(phony_dim_0, phony_dim_1) and no coordinates, so nothing says where each pixel is on Earth, and there is
no time. A model fed with this would learn from numbers a hundred times too large and from a sea of -8000, and
the field could not be combined with any other source. The next three steps fix each of these problems.
Step 2: physical values¶
The LSA SAF stores each variable as an integer X with its own attributes, and defines the physical value as
X / SCALING_FACTOR + OFFSET, with MISSING_VALUE for pixels without data (LSA SAF, Product Output Format,
SAF/LAND/IPMA/POF/1.2, in the
LSA SAF documentation repository).
These attribute names are not part of the CF conventions, the metadata standard that xarray, DEFAIR and most
EO tools understand, so no tool applies them. The reader translates them into their CF equivalents,
scale_factor = 1 / SCALING_FACTOR (CF multiplies where the LSA SAF divides), add_offset and _FillValue,
and lets the standard decoder, xr.decode_cf, compute the physical values. The LSA SAF applies the same
conversion when it publishes its own NetCDF files.
The five variables are loaded, the dimensions get their usual names, y for rows and x for columns, and
each variable is told which grid mapping describes its projection, geostationary, which is added in step 4.
VARIABLES = ["FWI", "FFMC", "DMC", "DC", "Risk"]
ds = raw[VARIABLES].load()
ds = ds.rename({"phony_dim_0": "y", "phony_dim_1": "x"})
for v in VARIABLES:
a = ds[v].attrs
ds[v].attrs = {
"scale_factor": np.float32(1 / a["SCALING_FACTOR"]),
"add_offset": np.float32(a["OFFSET"]),
"_FillValue": np.int16(a["MISSING_VALUE"]),
"long_name": a["PRODUCT"],
"units": "1",
"grid_mapping": "geostationary",
}
ds = xr.decode_cf(ds)
fwi = ds["FWI"]
print(f"FWI {fwi.dtype}: from {float(fwi.min()):.2f} to {float(fwi.max()):.2f}, "
f"{float(fwi.isnull().mean()):.1%} of the pixels without data")
dsThe values are now physical: decimal numbers on the scale of the index, and the pixels without data, the sea
and the space around the Earth, are NaN instead of -8000.
Step 3: georeference¶
The pixels still have no position on Earth. The Fire Risk Map is not the full disc of the satellite but a
window over Europe and North Africa. The file’s metadata says where that window sits, following the
navigation standard of the Coordination Group for Meteorological Satellites (CGMS): the attributes COFF and
LOFF are the column and the row of the window where the centre of the disc falls. The centre of the full
disc is always the same pixel, so the row and column where the window starts follow by subtraction. Both
numbers come from the header of the file.
With the start of the window and the size of a pixel, the centre of every column, x, and every row, y, is
a simple sum. The projection is written in GEOS_ATTRS in CF form, so any tool can compute the latitude and
longitude of a pixel from x and y.
The check below draws the Fire Weather Index on its new coordinates with the study area outlined. The outline must frame the Iberian Peninsula.
# The disc: the standard SEVIRI full disc at 3 km (area msg_seviri_fes_3km)
DISK_SIZE = 3712
DISK_EXTENT = (-5570248.686685662, -5567248.28340708, 5567248.28340708, 5570248.686685662)
GEOS_ATTRS = {
"grid_mapping_name": "geostationary",
"longitude_of_projection_origin": 0.0,
"latitude_of_projection_origin": 0.0,
"perspective_point_height": 35785831.0,
"sweep_angle_axis": "y",
"semi_major_axis": 6378169.0,
"semi_minor_axis": 6356583.8,
"false_easting": 0.0,
"false_northing": 0.0,
}
# The window: where the Fire Risk Map starts within the disc, from the CGMS attributes of the file
coff, loff = int(raw.attrs["COFF"]), int(raw.attrs["LOFF"]) # window column and row of the disc centre, counted from 1
centre = DISK_SIZE // 2 # the same disc centre in the full disc, counted from 0
col0, row0 = centre - (coff - 1), centre - (loff - 1)
print(f"COFF = {coff}, LOFF = {loff}: the window starts at column {col0} and row {row0} of the full disc")
# The coordinates: the centre of every column and row, in metres, in the view of the satellite
dx = (DISK_EXTENT[2] - DISK_EXTENT[0]) / DISK_SIZE
x = DISK_EXTENT[0] + (col0 + np.arange(ds.sizes["x"]) + 0.5) * dx
y = DISK_EXTENT[3] - (row0 + np.arange(ds.sizes["y"]) + 0.5) * dx
ds = ds.assign_coords(
x=("x", x, {"standard_name": "projection_x_coordinate", "units": "m", "axis": "X"}),
y=("y", y, {"standard_name": "projection_y_coordinate", "units": "m", "axis": "Y"}),
)
# Check: the study area, converted to the same projection, must frame the Iberian Peninsula
to_geos = Transformer.from_crs("EPSG:4326", CRS.from_cf(GEOS_ATTRS), always_xy=True)
bx, by = to_geos.transform([BBOX[0], BBOX[2], BBOX[2], BBOX[0], BBOX[0]],
[BBOX[1], BBOX[1], BBOX[3], BBOX[3], BBOX[1]])
fig, ax = plt.subplots(figsize=(12, 5))
ds["FWI"].plot(ax=ax, cmap="YlOrRd", cbar_kwargs={"label": "FWI"})
ax.plot(bx, by, color="black")
ax.set_aspect("equal")
ax.set_title(f"Fire Weather Index, {DEMO_EPISODE}, with the study area outlined")
plt.show()COFF = 308, LOFF = 1808: the window starts at column 1549 and row 49 of the full disc

Step 4: time and metadata¶
Every pixel now has a position, but the dataset does not say when it was observed. This step adds the date and completes the description of the dataset.
The date. The file stores it in the global attribute
IMAGE_ACQUISITION_TIME. The reader turns it into atimedimension with one value, which is what later lets DEFAIR stack the files of different days.The projection. In step 2 every variable was told that its projection is described by a variable called
geostationary. That variable is created now as a coordinate that holds no data, only the attributes of the projection from step 3. It has to be a coordinate because that is where the reprojection tools of DEFAIR look for the projection of each variable.The description. The global attributes record what the dataset is and where it comes from.
acquired = pd.to_datetime(str(raw.attrs["IMAGE_ACQUISITION_TIME"]), format="%Y%m%d%H%M%S")
ds = ds.expand_dims(time=[acquired])
ds = ds.assign_coords(geostationary=xr.DataArray(np.int32(0), attrs=GEOS_ATTRS))
ds.attrs = {
"Conventions": "CF-1.8",
"source": "LSA SAF Fire Risk Map, MSG SEVIRI Euro window",
"time_range": raw.attrs["TIME_RANGE"],
"nominal_product_time": str(raw.attrs["NOMINAL_PRODUCT_TIME"]),
}
dsWritten one after the other inside a single read() method, these four steps are the complete reader. It is
stored as LSAFRMReaderPlugin in readers/lsa_frm.py, under the name lsa_frm, with three small additions
that let DEFAIR drive it on its own:
can_handlerecognises Fire Risk Map files by the shape of their name, since they have no extension.The argument
variableslets the user load only the variables they need, by default the five of step 2._build_cdmdeclares what kind of data the reader returns, a grid on a geostationary projection. This tells DEFAIR that the source can be reprojected and resampled onto a target grid.
The reader returns its arrays lazily, so an archive larger than the memory of the machine can still be processed.
Step 5: registering the reader¶
Step 1 tested the class with load_reader, which builds a reader directly from a class. Real work uses Dataset.from_source instead. It reads one file, a list of files or a whole archive, and takes the reader by name. DEFAIR looks up that name in the Python entry points: installed packages publish their readers under the group defair_data.readers. The readers folder next to this notebook is one of these packages, and its pyproject.toml declares the three readers of this case. Installing it in the Prerequisites cell registered them. Python reads entry points only when the interpreter starts, which is why that cell asked for a kernel restart. The cell below lists the readers DEFAIR knows, keeping only the three of this case.
[name for name in list_readers() if name in ("lsa_frm", "lsa509_frp", "hsaf_h61")]['hsaf_h61', 'lsa509_frp', 'lsa_frm']Once registered, the reader is used like any built-in one: Dataset.from_source receives the path and the name
of the reader, and returns the Fire Risk Map with physical values, coordinates and time.
fire_risk = Dataset.from_source(frm_path(DEMO_EPISODE), reader="lsa_frm", **READ)
fire_risk.dataThe other two readers¶
H SAF H61B: daily precipitation¶
The H61B reader follows the same four steps as the Fire Risk Map, written as one class. Most of its work is in
two places. The files are gzipped NetCDF, so the reader decompresses them in memory before opening them. The
date also needs care: the file sealed at 00:00 on day D+1 holds the rain of day D. The variable, acc_rr, is
already in mm, so step 2 only renames the dimensions. H61B covers the full SEVIRI disc, the same disc as the
Fire Risk Map, so the georeference reuses DISK_SIZE, DISK_EXTENT and GEOS_ATTRS from step 3.
The cell tests the class directly with load_reader. It then reads the same file by name through the
registered reader hsaf_h61 and checks that both results are identical.
# H SAF H61B daily precipitation: the same four steps, written as one class.
# H61B covers the same SEVIRI full disc as the Fire Risk Map, so it reuses DISK_SIZE, DISK_EXTENT and GEOS_ATTRS from step 3.
class HSAFH61Reader(DataReaderPlugin):
PRIORITY = 60
FILENAME_PATTERN = re.compile(r"h61_(\d{8})_0000_24_fdk\.nc\.gz$")
@classmethod
def can_handle(cls, path):
return bool(cls.FILENAME_PATTERN.search(str(path)))
def read(self, path, source=None, source_kwargs=None):
# 1. Open: the file is gzipped NetCDF, so it is decompressed in memory first
sealed = pd.to_datetime(self.FILENAME_PATTERN.search(str(path)).group(1))
with self.open_file(path, source, source_kwargs) as f:
raw = gzip.decompress(f.read())
engine = "h5netcdf" if raw[:4] == b"\x89HDF" else "scipy"
ds = xr.open_dataset(io.BytesIO(raw), engine=engine)[["acc_rr"]].load()
# 2. Physical values: acc_rr is already in mm, so only the dimensions need their usual names
ds = ds.rename(dict(zip(ds.acc_rr.dims, ("y", "x"))))
# 3. Georeference: the file is the full disc, so every pixel centre follows from the disc extent
dx = (DISK_EXTENT[2] - DISK_EXTENT[0]) / DISK_SIZE
centres = np.arange(DISK_SIZE) + 0.5
ds = ds.assign_coords(
x=("x", DISK_EXTENT[0] + centres * dx, {"standard_name": "projection_x_coordinate", "units": "m", "axis": "X"}),
y=("y", DISK_EXTENT[3] - centres * dx, {"standard_name": "projection_y_coordinate", "units": "m", "axis": "Y"}),
)
ds["acc_rr"].attrs["grid_mapping"] = "geostationary"
# 4. Time and metadata: the file sealed on day D+1 at 00:00 holds the rain of day D
ds = ds.expand_dims(time=[sealed - pd.Timedelta(days=1)])
ds = ds.assign_coords(geostationary=xr.DataArray(np.int32(0), attrs=GEOS_ATTRS))
ds.attrs = {"Conventions": "CF-1.8", "source": "H SAF H61B daily accumulated precipitation, MSG SEVIRI full disc"}
return Dataset(ds.chunk(), cdm=self._build_cdm())
@staticmethod
def _build_cdm():
# A grid on a geostationary projection, so DEFAIR can reproject it onto any target grid
grid = GriddedModel(id="hsaf_h61_grid", variables=("acc_rr",), crs="GEOS", dims=("y", "x"),
x_dim="x", y_dim="y", x_coord="x", y_coord="y", grid_mapping="geostationary",
geostationary=GeostationaryParams(satellite_longitude=0.0, perspective_point_height=35785831.0,
sweep_axis="y", grid_mapping="geostationary"))
return CommonDataModel(reader="hsaf_h61", product_family="hsaf", spatial_groups=(grid,), temporal_groups=())
# Test the class directly, then read the same file through the registered reader, by name
test = load_reader("h61_test", plugin_class=HSAFH61Reader, fresh=True).read(h61_path(DEMO_EPISODE), **READ)
precip = Dataset.from_source(h61_path(DEMO_EPISODE), reader="hsaf_h61", **READ)
print(f"H61B {dict(precip.data.sizes)} | same result as the class above: {test.data.identical(precip.data)}")
precip.dataLSA SAF FRP-Pixel (LSA-509): fire detections¶
One LSA-509 file holds two products with different shapes, so the reader takes an extra argument, product,
to choose which one to return:
"fires"is the list of fire detections, one row per fire. Each fire is placed at its parallax corrected position (LATITUDE_PARALLAX,LONGITUDE_PARALLAX), with its detection timeACQTIME, and gets an id that is unique across days. The reader declares these as point data withbuild_point_cdm, so DEFAIR knows not to resample them like a grid."quality"is a 1 km image on the MTG geostationary projection that shows where fire detection was possible. The reader converts the rows and columns of the FCI disc into projection coordinates in metres and adds the MTG projection. The MTG projection differs from the SEVIRI projection used by the other two readers.
As with H61B, the cell tests the class with load_reader. It then reads both products by name through the
registered reader lsa509_frp and checks that the results are identical.
# LSA SAF FRP-Pixel (LSA-509): one file holds two products with different shapes, so the reader returns one
# of them, chosen with `product`: "fires", a list of fire detections (points), or "quality", an image that
# says where fire detection was possible (a grid on the MTG geostationary projection).
FCI_CENTRE, FCI_STEP = 5567.5, 1000.0 # centre and pixel size of the 1 km FCI disc [pixels, m]
MTG_GEOS_ATTRS = {
"grid_mapping_name": "geostationary",
"longitude_of_projection_origin": 0.0,
"latitude_of_projection_origin": 0.0,
"perspective_point_height": 35786400.0,
"sweep_angle_axis": "y",
"semi_major_axis": 6378137.0,
"semi_minor_axis": 6356752.31414,
"false_easting": 0.0,
"false_northing": 0.0,
}
class LSA509FRPReader(DataReaderPlugin):
PRIORITY = 60
FILENAME_PATTERN = re.compile(r"LSA509_iberia_(\d{8})\.nc$")
@classmethod
def can_handle(cls, path):
return bool(cls.FILENAME_PATTERN.search(str(path)))
def read(self, path, source=None, source_kwargs=None, product="fires"):
f = self.open_file(path, source, source_kwargs)
if product == "fires":
date = int(self.FILENAME_PATTERN.search(str(path)).group(1))
return self._read_fires(f, date)
return self._read_quality(f)
@staticmethod
def _read_fires(f, date):
# Points: one row per fire, with a unique id per day and the parallax corrected position as coordinates
ds = xr.open_dataset(f, engine="h5netcdf", group="ListProduct", chunks={})
ds = ds.assign_coords(fire=date * 100_000 + ds.fire.values)
ds = ds.set_coords(["LATITUDE_PARALLAX", "LONGITUDE_PARALLAX", "LATITUDE", "LONGITUDE", "ACQTIME"])
ds["LATITUDE_PARALLAX"].attrs.update(standard_name="latitude", units="degrees_north")
ds["LONGITUDE_PARALLAX"].attrs.update(standard_name="longitude", units="degrees_east")
ds["LATITUDE"].attrs.pop("standard_name", None)
ds["LONGITUDE"].attrs.pop("standard_name", None)
# build_point_cdm declares point data: DEFAIR then knows it cannot be resampled like a grid
cdm = build_point_cdm(reader="lsa509_frp", product_family="lsa_saf", ds=ds, sample_dim="fire",
latitude="LATITUDE_PARALLAX", longitude="LONGITUDE_PARALLAX", time_coord="ACQTIME",
time_representation="per_sample_observation")
return Dataset(ds, cdm=cdm)
@staticmethod
def _read_quality(f):
# Grid: rows and columns of the FCI disc become projection coordinates in metres
ds = xr.open_dataset(f, engine="h5netcdf", group="QualityProduct", chunks={"time": 1}, mask_and_scale=False)
ds = ds.assign_coords(
x=("samp", (ds.samp.values - FCI_CENTRE) * FCI_STEP, {"standard_name": "projection_x_coordinate", "units": "m", "axis": "X"}),
y=("line", (FCI_CENTRE - ds.line.values) * FCI_STEP, {"standard_name": "projection_y_coordinate", "units": "m", "axis": "Y"}),
).swap_dims(samp="x", line="y")
ds["qualityflag"].attrs["grid_mapping"] = "geostationary"
ds["geostationary"] = xr.DataArray(np.int32(0), attrs=MTG_GEOS_ATTRS)
grid = GriddedModel(id="lsa509_quality_grid", variables=("qualityflag",), crs="GEOS", dims=("y", "x"),
x_dim="x", y_dim="y", x_coord="x", y_coord="y", grid_mapping="geostationary",
geostationary=GeostationaryParams(satellite_longitude=0.0, perspective_point_height=35786400.0,
sweep_axis="y", grid_mapping="geostationary"))
cdm = CommonDataModel(reader="lsa509_frp", product_family="lsa_saf", spatial_groups=(grid,), temporal_groups=())
return Dataset(ds, cdm=cdm)
# Test the class directly, then read both products of the same file through the registered reader
test = load_reader("lsa509_test", plugin_class=LSA509FRPReader, fresh=True)
for product in ["fires", "quality"]:
mine = test.read(lsa_path(DEMO_EPISODE), product=product, **READ)
registered = Dataset.from_source(lsa_path(DEMO_EPISODE), reader="lsa509_frp", product=product, **READ)
print(f"LSA-509 {product:8s} {dict(registered.data.sizes)} | same result as the class above: "
f"{mine.data.identical(registered.data)}")LSA-509 fires {'fire': 4889} | same result as the class above: True
LSA-509 quality {'time': 144, 'y': 836, 'x': 1384} | same result as the class above: True
The cube¶
The cube is built in the companion notebook Fire ignition cube preparation. That notebook reads the six products with the readers above, brings them onto one 10 km grid in EPSG:3035, builds the fire label of every storm day and saves the result in the project bucket. Please walk through that notebook to understand the data preparation, assumptions and transformations used in the process to create the cube.
This notebook reads that result directly, with one call. You can open the same cube outside this notebook in the same way:
cube = xr.open_zarr("s3://defair-use-case/cubes/fireignition_cube.zarr",
storage_options={"anon": True,
"client_kwargs": {"endpoint_url": "https://s3.central.data.destination-earth.eu"}})The cell also reports how much of the study area the GII covers on each day, since it only exists under clear sky.
cube = xr.open_zarr(f"s3://{BUCKET}/{PREFIX}{CUBE_KEY}", storage_options=STORAGE_OPTIONS).load()
print(dict(cube.sizes))
print(f"{len(cube.data_vars)} variables: {', '.join(cube.data_vars)}")
coverage = cube.gii_prec_water_total.notnull().where(cube.eligible).mean(("y", "x"))
print(f"GII coverage of the study area per episode: median {float(coverage.median()):.0%}, "
f"from {float(coverage.min()):.0%} to {float(coverage.max()):.0%}"){'episode': 37, 'y': 100, 'x': 130}
33 variables: burning_before, eligible, exposed, fire_first, fire_new, fire_repeated, frm_dc, frm_dmc, frm_ffmc, frm_fwi, frp_24h, frp_max, frp_sum, gii_k_index, gii_lifted_index, gii_prec_water_total, h61_precip, in_sample, label_start, lc_broadleaved_deciduous, lc_broadleaved_evergreen, lc_low_woody, lc_needleleaved, lc_permanent_herbaceous, lc_trees, lfl_duration_mean, lfl_events_per_flash, lfl_first, lfl_flash_count, lfl_footprint_mean, n_det, obs_fraction, wildland_fraction
GII coverage of the study area per episode: median 97%, from 72% to 100%
One grid, every source¶
The chart shows that cube. It stacks the layers of the most active storm day of the season over the same 10 km cells, from bottom to top: the land cover that defines the study area, the fuel, the rain, the air before the storm, the lightning and, on top, the new fires that followed. Each layer is coloured by its own range. The eight layers come from six products and four providers, and they line up because they share the same cells.
showcase = cube.lfl_flash_count.sum(("y", "x")).idxmax("episode").values
ep = cube.sel(episode=showcase)
layers = [
("CLC+ wildland fraction", cube.wildland_fraction.where(cube.wildland_fraction > 0), "Greens"),
("FRM Drought Code", ep.frm_dc, "YlOrBr"),
("FRM Fire Weather Index", ep.frm_fwi, "YlOrRd"),
("H61B precipitation", ep.h61_precip, "Blues"),
("GII precipitable water", ep.gii_prec_water_total, "PuBu"),
("GII K index", ep.gii_k_index, "viridis"),
("LI flashes", ep.lfl_flash_count.where(ep.lfl_flash_count > 0), "plasma"),
("LSA-509 new fires", ep.fire_new.where(ep.fire_new == 1), "autumn"),
]
xs, ys = np.meshgrid(cube.x / 1000, cube.y / 1000)
fig = plt.figure(figsize=(12, 13))
ax = fig.add_subplot(projection="3d")
for z, (name, field, cmap) in enumerate(layers):
data = field.values.astype(float)
valid = data[np.isfinite(data)]
if valid.size == 0:
continue
norm = mcolors.Normalize(*np.percentile(valid, [2, 98]))
colors = plt.get_cmap(cmap)(norm(data))
colors[~np.isfinite(data)] = 0 # transparent where there is no data
ax.plot_surface(xs, ys, np.full(xs.shape, z), facecolors=colors,
rstride=1, cstride=1, shade=False, antialiased=False)
ax.set_zticks(range(len(layers)))
ax.set_zticklabels([name for name, *_ in layers])
ax.set_xlabel("x EPSG:3035 [km]")
ax.set_ylabel("y EPSG:3035 [km]")
ax.set_title(f"FireIgnition cube, episode {str(showcase)[:10]}: eight co-registered layers on one 10 km grid",
fontweight="bold")
ax.view_init(elev=22, azim=-60)
plt.show()
Analysis¶
From here on the notebook only uses the cube. The cell below turns it into a dara frame with one row per cell and storm day of the sample, and adds three columns: the identity of the cell, so that a cell can be compared with itself on other days; the rain class of that day; and the day of the season.
The first table follows all the cells of all the storm days through each condition of the sample, in order, and shows how many remain at every step, how many had lightning and how many new fires they hold.
eligible = cube.eligible.broadcast_like(cube.fire_new)
steps = {
"wildland cell of the study area": eligible,
"visible in at least a quarter of its window": cube.fire_new.notnull() & (cube.obs_fraction >= MIN_OBS_FRACTION),
"no fire nearby in the 48 h before": ~cube.burning_before,
"complete prior archive": cube.prior_complete.broadcast_like(cube.fire_new),
"fire not counted on another day": ~cube.fire_repeated,
}
mask, rows = xr.ones_like(eligible, dtype=bool), []
for step, condition in steps.items():
mask = mask & condition
rows.append({"step": step, "cell episodes": int(mask.sum()),
"with lightning": int((mask & cube.exposed).sum()),
"new fires": int((mask & (cube.fire_new == 1)).sum())})
display(pd.DataFrame(rows).set_index("step"))
assert int(mask.sum()) == int(cube.in_sample.sum())
COLUMNS = ["h61_precip", "frm_ffmc", "frm_dmc", "frm_dc", "frm_fwi", "gii_prec_water_total", "lfl_flash_count",
"lfl_duration_mean", "lc_trees", "exposed", "fire_new", "obs_fraction", "fire_first", "label_start"]
RR_COLUMNS = ["exposed", "fire_new", "h61_precip"]
def sample_table(c, sample, columns):
"""One row per cell episode of the sample, with the identity of the cell and its rain class."""
t = c[columns].where(sample).to_dataframe().dropna(subset=["fire_new"]).reset_index()
t["cell"] = ((Y1 - t.y) // CELL).astype(int) * NX + ((t.x - X0) // CELL).astype(int)
t["rain_class"] = pd.cut(t.h61_precip, RAIN_BINS, labels=RAIN_LABELS)
return t
table = sample_table(cube, cube.in_sample, COLUMNS)
table["season_day"] = (pd.to_datetime(table.episode) - pd.Timestamp(cube.episode.values[0])).dt.days
print(f"{len(table)} cell episodes in the sample, {table.episode.nunique()} episodes, "
f"{table.cell.nunique()} distinct cells")
print(f"new fires: {int(table.fire_new.sum())}, of them in cells with lightning: "
f"{int((table.fire_new * table.exposed).sum())}")A first look: cells with and without lightning¶
The table compares the two groups of the sample: how many there are, how often they had a new fire, how much rain they got and how much of their window the satellite could see. The figure shows the new fire rate of each group in each rain class, with the number of cells on each bar.
Cells with lightning get much more rain, and rain puts out fires, so a direct comparison of the two groups would mislead. That is why RQ1 compares each cell only with itself, under similar rain.
exposed_group = table.exposed.astype(bool)
groups = table.groupby(exposed_group)
summary = pd.DataFrame({
"cell episodes": groups.size(),
"new fire rate": groups.fire_new.mean(),
"median rain [mm]": groups.h61_precip.median(),
"share above 1 mm": groups.h61_precip.apply(lambda rain: (rain > 1).mean()),
"median visible share": groups.obs_fraction.median(),
})
summary.index = ["without lightning", "with lightning"]
display(summary.round(3))
names = {False: "without lightning", True: "with lightning"}
by_rain = table.groupby(["rain_class", exposed_group], observed=True).fire_new
rates, counts = by_rain.mean().unstack().rename(columns=names), by_rain.size().unstack().rename(columns=names)
ax = rates.plot.bar(figsize=(8, 4), color=["tab:grey", "tab:red"], rot=0)
for bars, column in zip(ax.containers, rates.columns):
ax.bar_label(bars, labels=[f"n={n:.0f}" if n == n else "" for n in counts[column]], fontsize=7)
ax.set_xlabel("rain accumulated during the episode day [mm]")
ax.set_ylabel("share of cells with a new fire")
ax.set_title("New fire rate by rain class, cells with and without lightning")
plt.tight_layout()RQ1: is lightning followed by more new fires?¶
The relative risk compares cells with and without lightning on the same storm day. It is the share of cells with lightning that had a new fire, divided by the share of cells without lightning that had one. A value of 1 means lightning makes no difference, and a value above 1 means cells hit by lightning burn more often.
A cell hit by lightning should be compared with a cell that is similar in every other way. The Mantel-Haenszel estimator (Mantel and Haenszel, 1959) does this by splitting the data into small groups, called strata. It computes the comparison inside each stratum and then combines them, giving more weight to the larger ones. Here each stratum is one cell under one rain class, so a cell with lightning is compared only with the same cell on days with similar rain and no lightning. A stratum counts only if it has days with lightning, days without lightning and at least one fire; the cell below reports how many do. For contrast, it also prints the crude relative risk, computed without strata.
Cells on the same day share the same storm and weather, so they are not independent of each other. The uncertainty is therefore estimated by resampling whole storm days. The 37 days are drawn at random with replacement, 1000 times, and the relative risk is recomputed each time. This is called a cluster bootstrap. The 95 % interval covers the middle 95 % of the 1000 values.
A fire can fall inside the windows of two storm days. The main rule assigns it to the storm day whose window started last. The last two lines of output repeat the estimate with two other rules. The first gives the fire to the last storm day with lightning in the cell, which can only raise the estimate. The second leaves out every fire shared by a day with lightning and a day without, which lowers it, because it also drops fires that lightning started on consecutive storm days. The main rule gives a value between the two.
def strata(df):
"""Fires and cells with and without lightning in every stratum of the study design."""
return (df.assign(n1=df.exposed, n0=1 - df.exposed, a=df.fire_new * df.exposed, c=df.fire_new * (1 - df.exposed))
.groupby(STRATA, observed=True)[["a", "c", "n1", "n0"]].sum())
def mantel_haenszel_rr(df):
"""Relative risk of the exposed cells, pooled over the strata of the study design."""
s = strata(df)
n = s.n1 + s.n0
denominator = (s.c * s.n1 / n).sum()
return (s.a * s.n0 / n).sum() / denominator if denominator > 0 else np.nan # nan: no fire without lightning
def episode_bootstrap(df, stat, n):
"""The statistic recomputed on n resamples of whole episodes, drawn with replacement."""
rng = np.random.default_rng(SEED)
parts = [g for _, g in df.groupby("episode")]
return np.array([stat(pd.concat([parts[i] for i in rng.integers(0, len(parts), len(parts))])) for _ in range(n)])
def with_interval(df, stat, n):
"""The statistic and its 95 % interval from n resamples of whole episodes."""
low, high = np.nanpercentile(episode_bootstrap(df, stat, n), [2.5, 97.5], axis=0)
return stat(df), low, high
def repeated_fires(cube, sample, prefer_exposed=False, drop_mixed=False):
"""True where the fire of the cell is left out because it falls in the windows of several episodes.
It is kept in the episode whose window started last; with prefer_exposed, in the last episode with
lightning in the cell; with drop_mixed, a fire shared by episodes with and without lightning in the
cell is left out of all of them. The cube was built with the first rule."""
t = (xr.Dataset({"fire_first": cube.fire_first.where(sample), "start": cube.label_start, "exposed": cube.exposed})
.to_dataframe().dropna(subset=["fire_first"]).reset_index())
t["key"] = t.start + (1e10 * t.exposed if prefer_exposed else 0)
owner = t.loc[t.groupby(["y", "x", "fire_first"]).key.idxmax(), ["y", "x", "fire_first", "episode"]]
dup = t.merge(owner.rename(columns={"episode": "owner"}), on=["y", "x", "fire_first"]).query("episode != owner")
if drop_mixed:
mixed = t.groupby(["y", "x", "fire_first"]).exposed.transform("nunique") > 1
dup = pd.concat([dup, t[mixed]])
mask = np.zeros(cube.fire_new.shape, bool)
mask[pd.Index(cube.episode.values).get_indexer(dup.episode),
pd.Index(cube.y.values).get_indexer(dup.y),
pd.Index(cube.x.values).get_indexer(dup.x)] = True
return xr.DataArray(mask, coords=cube.fire_new.coords, dims=cube.fire_new.dims)
def plot_intervals(ax, estimate, low, high, labels, horizontal=False):
"""Estimates with their 95 % intervals, and a dashed line at 1, the value of no effect."""
pos, err = np.arange(len(estimate)), [np.asarray(estimate - low), np.asarray(high - estimate)]
if horizontal:
ax.errorbar(estimate, pos, xerr=err, fmt="o", color="k")
ax.axvline(1, ls="--", color="grey")
ax.set_yticks(pos, labels)
else:
ax.errorbar(pos, estimate, yerr=err, fmt="o", color="k")
ax.axhline(1, ls="--", color="grey")
ax.set_xticks(pos, labels)
rr, low, high = with_interval(table, mantel_haenszel_rr, N_BOOT_RR)
s = strata(table)
informative = int(((s.n1 > 0) & (s.n0 > 0) & (s.a + s.c > 0)).sum())
n1, n0 = table.exposed.sum(), (1 - table.exposed).sum()
a, c = (table.fire_new * table.exposed).sum(), (table.fire_new * (1 - table.exposed)).sum()
print(f"exposed cells: {int(n1)}, new fire rate {a / n1:.4f}")
print(f"unexposed cells: {int(n0)}, new fire rate {c / n0:.4f}")
print(f"crude relative risk: {(a / n1) / (c / n0):.2f}")
print(f"strata: {len(s)}, informative (both groups and at least one fire): {informative}")
print(f"Mantel-Haenszel relative risk, stratified by cell and rain class: "
f"{rr:.2f}, 95 % interval {low:.2f} to {high:.2f}")
# The same estimate under two other rules for fires that fall on two days
base = cube.in_sample | cube.fire_repeated
for rule, option in [("given to the last storm with lightning in the cell", {"prefer_exposed": True}),
("left out when one day had lightning and the other not", {"drop_mixed": True})]:
alternative = sample_table(cube, base & ~repeated_fires(cube, base, **option), RR_COLUMNS)
print(f"shared fires {rule}: RR {mantel_haenszel_rr(alternative):.2f}, "
f"{int((alternative.fire_new * alternative.exposed).sum())} fires with lightning kept")exposed cells: 14575, new fire rate 0.0069
unexposed cells: 141204, new fire rate 0.0056
crude relative risk: 1.23
strata: 21330, informative (both groups and at least one fire): 183
Mantel-Haenszel relative risk, stratified by cell and rain class: 1.35, 95 % interval 0.83 to 2.54
shared fires given to the last storm with lightning in the cell: RR 1.76, 117 fires with lightning kept
shared fires left out when one day had lightning and the other not: RR 0.66, 51 fires with lightning kept
When do the new fires appear?¶
A fire lit by lightning usually shows up soon after the flash: the delay, called holdover, is mostly less than a day. A fire unrelated to lightning can show up at any time. So, if lightning lights some of the fires, the fires in cells with lightning should appear earlier in their 48 hour window, counted from the first flash, than the fires in cells without it. The figure compares both groups: the time from the start of the window (the first flash, or the storm time of the day) to the moment the fire was first seen.
new_fires = table[table.fire_new == 1]
hours = (new_fires.fire_first - new_fires.label_start) / 3600
lit = new_fires.exposed == 1
fig, ax = plt.subplots(figsize=(8, 4))
bins = np.arange(0, LABEL_HOURS + 3, 3)
ax.hist(hours[~lit], bins=bins, density=True, alpha=0.5, color="tab:grey", label="without lightning: from the storm time")
ax.hist(hours[lit], bins=bins, density=True, alpha=0.5, color="tab:red", label="with lightning: from the first flash")
ax.set_xlabel("hours from the start of the window to the first detection")
ax.set_ylabel("share of new fires per hour")
ax.set_title("When the new fires appear in their window")
ax.legend(fontsize=8)
plt.tight_layout()
for name, h in {"with lightning": hours[lit], "without lightning": hours[~lit]}.items():
print(f"{name}: {len(h)} fires, median {h.median():.1f} h, first 12 h {(h < 12).mean():.0%}, first 24 h {(h < 24).mean():.0%}")with lightning: 100 fires, median 19.2 h, first 12 h 34%, first 24 h 73%
without lightning: 787 fires, median 21.4 h, first 12 h 23%, first 24 h 68%

Each bar shows the share of new fires first seen in a 3 hour step of the 48 hour window, counted from the first flash in cells with lightning (red) and from the storm time in cells without it (grey); darker red is where the two overlap. Both groups peak the same afternoon and the next one, about 24 hours later, because windows start in the afternoon and most fires are seen then. Between 3 and 12 hours, during the first night, the red bars stand above the grey ones: fires in cells with lightning show up sooner, as expected if a flash lit them, although with only 100 such fires the shape is noisy.
Two checks of the design¶
More lightning, more fires? If lightning starts fires, cells that get many flashes should burn more often than cells that get a few. The left panel shows the relative risk for four classes of flashes per cell, each compared with the cells without lightning. A relative risk that grows with the number of flashes is one of the strongest signs of a real effect that an observational study can give.
No lightning, no effect? A sound design finds nothing where there is nothing. The lightning maps are shuffled at random between storm days 200 times, so the flashes no longer fall where the fires are counted, and the relative risk is recomputed each time. The right panel shows those values, which should sit around 1. The share of shuffles that reach the real value is a permutation p value for RQ1.
# More lightning, more fires? The relative risk for each class of flashes per cell
dose = pd.cut(table.lfl_flash_count, DOSE_BINS, labels=DOSE_LABELS)
rows = []
for label in DOSE_LABELS:
t = table[(table.exposed == 0) | (dose == label)]
estimate, ci_low, ci_high = with_interval(t, mantel_haenszel_rr, N_BOOT)
rows.append({"flashes in the cell": label, "cells with lightning": int((dose == label).sum()),
"fires with lightning": int(table.fire_new[dose == label].sum()),
"relative risk": estimate, "2.5 %": ci_low, "97.5 %": ci_high})
dose_rr = pd.DataFrame(rows).set_index("flashes in the cell")
display(dose_rr.round(2))
# No lightning, no effect? Lightning maps shuffled between storm days
maps = cube.exposed.values
e = pd.Index(cube.episode.values).get_indexer(table.episode)
yi, xi = pd.Index(cube.y.values).get_indexer(table.y), pd.Index(cube.x.values).get_indexer(table.x)
rng = np.random.default_rng(SEED)
null = np.array([mantel_haenszel_rr(table.assign(exposed=maps[rng.permutation(len(maps))[e], yi, xi].astype(float)))
for _ in range(N_PERM)])
p_value = (1 + np.sum(null >= rr)) / (1 + N_PERM)
print(f"lightning shuffled between days: median {np.nanmedian(null):.2f}, 95 % of the shuffles between "
f"{np.nanpercentile(null, 2.5):.2f} and {np.nanpercentile(null, 97.5):.2f}; permutation p value: {p_value:.3f}")
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(13, 4))
plot_intervals(ax1, dose_rr["relative risk"], dose_rr["2.5 %"], dose_rr["97.5 %"], dose_rr.index)
ax1.set_xlabel("flashes in the cell during the storm day")
ax1.set_ylabel("Mantel-Haenszel relative risk")
ax1.set_title("More lightning, more fires?")
ax2.hist(null[np.isfinite(null)], bins=30, color="lightgrey", label="lightning shuffled between days")
ax2.axvspan(low, high, color="tab:blue", alpha=0.1, label="95 % interval of the real estimate")
ax2.axvline(rr, color="tab:blue", label=f"real lightning, {rr:.2f}")
ax2.axvline(1, color="black", ls="--")
ax2.set_xlabel("Mantel-Haenszel relative risk")
ax2.set_title("No lightning, no effect?")
ax2.legend(fontsize=8)
plt.tight_layout()Answer to RQ1¶
Probably yes, but one season is not enough to be sure. Cells hit by lightning had more new fires than the same cells on days with similar rain and no lightning, but the 95 % interval still includes 1, so H0 cannot be rejected.
The answer stays open because lightning lights only a small share of the fires, and the label counts new fires of every cause. In one season that leaves about a hundred fires in cells with lightning, and the effect of the flashes is mixed with many fires that would have happened anyway.
The checks point the same way, which makes the effect likely to be real. When the lightning is shuffled between days, the relative risk falls back to about 1 and rarely reaches the real value. Fires in cells with lightning appear sooner after the flash, which is what an ignition by lightning looks like. More flashes bring more fires, except in the cells with the most flashes, possibly because the strongest storms also bring the most rain; with so few fires that last class cannot be read.
How fires that fall inside the windows of two storm days are counted matters. Giving them to the last storm with lightning raises the estimate. Leaving out the ones shared by a day with and a day without lightning drops it below 1, but that rule removes about half of the fires in cells with lightning, because lightning often strikes the same area on consecutive days. The main rule, the most recent storm, can only err against lightning, so the estimate is, if anything, on the low side.
RQ2: does dry weather make lightning more dangerous?¶
Lightning is most likely to start a fire when it strikes without rain, in what is known as a dry thunderstorm (Rorig and Ferguson, 1999). The difference between a dry and a wet storm is decided before the storm begins, by how much water the air holds.
DRY STORM WET STORM
dry air before the storm moist air before the storm
(little precipitable water) (much precipitable water)
.------------------. .------------------.
( storm cloud ) ( storm cloud )
'------------------' '------------------'
\ : : : \ | | | |
/ rain dries up / | | | |
\ on the way down \ | | | |
~~~~~~~~~/~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~/~~~~~|~|~|~|~~~~~~
lightning hits dry vegetation lightning hits wet vegetation
nothing puts the spark out the rain puts the spark out
a new fire is MORE likely a new fire is LESS likelyIn the Mediterranean, the storms that start fires tend to have a high cloud base, less water in the air than usual and little rain (Pérez-Invernón et al., 2021). The GII measures that water in the air, and how unstable the air is, in the hours before the storm. Rorig and Ferguson (1999) told dry from wet storm days using the temperature difference between 850 and 500 hPa, the same difference the K-index is built on.
If this idea holds, cells hit by lightning should burn more often when the air held less water, when less rain fell and when the vegetation was drier. The rain itself is measured by H61B, but only as a daily total, which cannot say whether it fell before, with or after the lightning. The GII fills part of that gap by describing what kind of storm it was.
If dry storms are the ones that start fires, the excess risk of RQ1 should be larger in dry conditions than in wet ones. The cell below splits the sample into three equal parts (thirds) by the Fire Weather Index, which describes how dry the fuel is, and into thirds by the precipitable water before the storm, which describes how much water the air held. It then computes the relative risk of RQ1 inside each third. The ratio between the driest and the wettest third, with its bootstrap interval, says how much dry weather changes the effect. The precipitable water only exists under clear sky, so its thirds use the cells where it is available.
# The relative risk of RQ1 in each third of fuel dryness and of precipitable water
MODIFIERS = {"frm_fwi": ("Fire Weather Index", "high"), "gii_prec_water_total": ("precipitable water", "low")}
THIRDS = ["low", "middle", "high"]
rows, ratios = [], {}
for var, (label, dry) in MODIFIERS.items():
t = table.dropna(subset=[var])
t = t.assign(third=pd.qcut(t[var], 3, labels=THIRDS))
by_third = lambda df: np.array([mantel_haenszel_rr(df[df.third == k]) for k in THIRDS])
estimate, boot_thirds = by_third(t), episode_bootstrap(t, by_third, N_BOOT)
ci = np.nanpercentile(boot_thirds, [2.5, 97.5], axis=0)
for i, k in enumerate(THIRDS):
rows.append({"modifier": label, "third": k, "range": f"{t[var][t.third == k].min():.1f} to {t[var][t.third == k].max():.1f}",
"fires with lightning": int((t.fire_new * t.exposed)[t.third == k].sum()),
"relative risk": estimate[i], "2.5 %": ci[0, i], "97.5 %": ci[1, i]})
wet = "low" if dry == "high" else "high"
i_dry, i_wet = THIRDS.index(dry), THIRDS.index(wet)
with np.errstate(divide="ignore", invalid="ignore"): # a third without fires gives no ratio
ratios[label] = (estimate[i_dry] / estimate[i_wet], *np.nanpercentile(boot_thirds[:, i_dry] / boot_thirds[:, i_wet], [2.5, 97.5]))
modification = pd.DataFrame(rows).set_index(["modifier", "third"])
display(modification.round(2))
for label, (r, lo, hi) in ratios.items():
print(f"{label}: RR of the driest third / RR of the wettest third = {r:.2f}, 95 % interval {lo:.2f} to {hi:.2f}")
fig, axes = plt.subplots(1, 2, figsize=(12, 4), sharey=True)
for ax, (label, _) in zip(axes, MODIFIERS.values()):
m = modification.loc[label]
plot_intervals(ax, m["relative risk"], m["2.5 %"], m["97.5 %"], [f"{k}\n{r}" for k, r in zip(THIRDS, m["range"])])
ax.set_title(f"Relative risk by third of {label}")
axes[0].set_ylabel("Mantel-Haenszel relative risk")
plt.tight_layout()Can a model tell which flashes start a fire?¶
Two models look at the cells hit by lightning and try to tell the ones that burned from the ones that
did not. The outcome is a new fire in the window, of any cause. Ten features describe each cell: the
rain of the day; the three fuel moisture codes (frm_ffmc, frm_dmc, frm_dc), without the Fire
Weather Index, which is built from them; the number of flashes, on a logarithmic scale, and their mean
duration; the tree cover; the day of the season and the north to south position of the cell, which take
care of seasonal and regional trends; and cell_base_rate, the new fire rate of the same cell on days
without lightning, which carries the background risk of the place. The GII is left out of the models,
because it only exists under clear sky and would remove many cells.
The main model is a logistic regression on standardised features, fitted without penalty so that its effects are not shrunk. XGBoost, a gradient boosted tree model that can capture non linear effects, is the contrast. Both are trained on the data as they are, without class weights, so their outputs can be read as probabilities. Each model is trained on 36 storm days and tested on the one left out, 37 times, so a day is never used for training and testing at once.
Two scores summarise the predictions. The AUC-PR measures how well a model ranks the cells that burned above the others; a model without skill scores the prevalence, the share of cells with a fire. The Brier score is the mean squared error of the predicted probabilities; lower is better. Accuracy is not used: with fewer than one cell in a hundred burning, a model that always says “no fire” is almost always right and has learned nothing.
Finally, the logistic regression is fitted on all the storm days to estimate its odds ratios, with 95 % intervals from the same cluster bootstrap. An odds ratio above 1 means the chance of a new fire rises with the feature, below 1 that it falls, and an interval that crosses 1 means the data cannot tell the direction. The three fuel codes describe the same system, so they share their effect and widen each other’s intervals.
hit = table[table.exposed == 1].copy()
hit["cell_base_rate"] = hit.cell.map(table[table.exposed == 0].groupby("cell").fire_new.mean())
hit["lfl_flash_count"] = np.log1p(hit.lfl_flash_count)
complete = hit[FEATURES_RQ2].notna().all(axis=1)
print(f"cells hit by lightning: {len(hit)} | with every feature: {int(complete.sum())} | "
f"new fires among them: {int(hit.fire_new[complete].sum())}")
hit = hit[complete]
X_rq2, y_rq2, groups_rq2 = hit[FEATURES_RQ2], hit.fire_new.astype(int), hit.episode
def logistic():
return make_pipeline(StandardScaler(), LogisticRegression(C=np.inf, max_iter=1000))
def boosted():
return XGBClassifier(n_estimators=300, max_depth=3, learning_rate=0.05, subsample=0.8,
random_state=SEED)
oof = pd.DataFrame(index=hit.index, columns=["logistic", "xgboost"], dtype=float)
for train, test in LeaveOneGroupOut().split(X_rq2, y_rq2, groups_rq2):
X_train, y_train = X_rq2.iloc[train], y_rq2.iloc[train]
oof.iloc[test, 0] = logistic().fit(X_train, y_train).predict_proba(X_rq2.iloc[test])[:, 1]
oof.iloc[test, 1] = boosted().fit(X_train, y_train).predict_proba(X_rq2.iloc[test])[:, 1]
prevalence = y_rq2.mean()
scores = pd.DataFrame({m: {"AUC-PR": average_precision_score(y_rq2, p), "Brier": brier_score_loss(y_rq2, p)}
for m, p in oof.items()}).T
scores.loc["no skill (prevalence)"] = [prevalence, prevalence * (1 - prevalence)]
display(scores.round(4))
# The effect of each condition, from the logistic regression fitted on all the storm days
coef_of = lambda df: logistic().fit(df[FEATURES_RQ2], df.fire_new.astype(int))[-1].coef_[0]
coef, ci_low, ci_high = with_interval(hit, coef_of, N_BOOT)
odds = pd.DataFrame({"odds ratio": np.exp(coef), "2.5 %": np.exp(ci_low), "97.5 %": np.exp(ci_high)}, index=FEATURES_RQ2)
display(odds.round(3))
o = odds.sort_values("odds ratio")
fig, ax = plt.subplots(figsize=(8, 5))
plot_intervals(ax, o["odds ratio"], o["2.5 %"], o["97.5 %"], o.index, horizontal=True)
ax.set_xscale("log")
ax.set_xlabel("odds ratio per standard deviation (95 % interval)")
ax.set_title("Logistic regression, cells hit by lightning")
plt.tight_layout()Answer to RQ2¶
Not in a way this season can show. Split into dry and wet thirds, the sample keeps only a handful to a few dozen fires with lightning in each third. The relative risks of the thirds overlap, and the ratio between the driest and the wettest third stays close to 1 with very wide intervals. The dry thunderstorm idea is not contradicted; one season does not hold enough lightning fires to test it.
Neither model does clearly better than a model without skill, so the conditions of the day do not tell the cells that burned from the others. The only two features with a clear effect are the day of the season and the background fire rate of the cell. After lightning, a new fire is more likely late in the summer and in places that burn often anyway; the properties of the storm itself make no visible difference.
Limitations¶
The results hold within the limits of the data, gathered here in one place.
| Limitation | What it does to the results |
|---|---|
| Parallax corrected with one fixed height | Flashes from clouds much lower or higher than 10 km keep part of their shift, so a few land in a neighbouring cell. This pushes the relative risk towards 1 |
| All lightning, not only ground strikes | Only flashes that reach the ground can light a fire, but the Lightning Imager also counts those inside the cloud. Exposure is broader than real contact with the ground |
| Fires of any cause | The label counts every new fire, whatever lit it. Lightning starts a small share of the fires, so its effect is measured on a small part of them |
| Daily satellite rain | H61B is a daily total at about 3 km. It cannot tell whether the rain fell before or after a flash |
| Clear sky air | The instability indices only exist under clear sky, and they are read before the storm over the whole study area, not before the first flash in each cell |
| Fire detection limit | The FCI sees a fire only above a minimum power and not under clouds. Small or smouldering fires are missed, and the time to detection is an upper bound of the holdover |
| Fixed sources from the same season | The rules that remove industrial sources are computed on the season they clean, with reasoned thresholds, and removing eight neighbours can remove a real fire next to a source |
| Fuel is a forecast | The Fire Risk Map is a 24 hour forecast and carries the error of the forecast weather |
| Land cover of 2023 | Three years before the season studied |
| One season | All results come from 2026, which limits the number of fires and widens every interval |
Conclusions¶
The notebook took six products from four providers to two answers. On the way it showed four things about working with DEFAIR.
Readers can be added. Three products without a reader came in through three small plugins, registered with a standard entry point and used exactly like the built-in readers.
Very different sources end on one grid. In the companion notebook, gridded and point products, geostationary and projected, become layers of the same cells through the same read, crop, reproject and align steps.
The cube is the handover. One
open_zarrcall is the whole link between the data preparation and the analysis, and the same cube feeds a stratified statistical comparison and two machine learning models.A cube that carries its context supports careful statistics. Every cell has its label, window, identity, rain, visibility and storm day, so it can be compared with itself, the design can be checked against shuffled lightning, models can be tested without mixing days, cells the satellite could not see stay out of the sample, and each fire is counted once.
New fires were more frequent in cells hit by lightning than in the same cells without it, and the checks of the design support that this is not chance, but one season leaves the result short of statistical proof (RQ1). Dry fuel and dry air did not change the effect in a way the data can show, and the best signs of a fire after lightning were the time of the summer and the place (RQ2).
Lightning starts about 15 % of the forest fires of the Mediterranean Basin (Soler et al., 2021), and the label counts every new fire whatever its cause, so the effect of lightning is measured on a small part of the fires. More seasons, which the same pipeline can process, or records of fire causes would sharpen it. The results describe how often new fires followed lightning in one season, not the cause of any single fire.
Resources and references¶
Scientific literature
Bližňák, V., & Sokol, Z. (2026). First validation of the Lightning Imager aboard Meteosat Third Generation satellite with Earth Networks Total Lightning Network. International Journal of Applied Earth Observation and Geoinformation, 147, 105205. Bližňák & Sokol (2026)
DaCamara, C. C., Calado, T. J., Ermida, S. L., Trigo, I. F., Amraoui, M., & Turkman, K. F. (2014). Calibration of the Fire Weather Index over Mediterranean Europe based on fire activity retrieved from MSG satellite imagery. International Journal of Wildland Fire, 23(7), 945 to 958. https://
Enno, S.-E., Viticchié, B., Navia, D., & Grandell, J. (2026). First year of Meteosat Third Generation Lightning Imager observations. EGUsphere preprint, under review for Atmospheric Measurement Techniques. Enno et al. (2026)
Mantel, N., & Haenszel, W. (1959). Statistical aspects of the analysis of data from retrospective studies of disease. Journal of the National Cancer Institute, 22(4), 719 to 748. Oxford University Press (OUP) (1959)
Moris, J. V., Conedera, M., Nisi, L., Bernardi, M., Cesti, G., & Pezzatti, G. B. (2020). Lightning-caused fires in the Alps: Identifying the igniting strokes. Agricultural and Forest Meteorology, 290, 107990. Moris et al. (2020)
Moris, J. V., Álvarez-Álvarez, P., Conedera, M., et al. (2023). A global database on holdover time of lightning-ignited wildfires. Earth System Science Data, 15, 1151 to 1163. Moris et al. (2023)
Pérez-Invernón, F. J., Huntrieser, H., Soler, S., Gordillo-Vázquez, F. J., Pineda, N., Navarro-González, J., Reglero, V., Montanyà, J., van der Velde, O., & Koutsias, N. (2021). Lightning-ignited wildfires and long continuing current lightning in the Mediterranean Basin: preferential meteorological conditions. Atmospheric Chemistry and Physics, 21, 17529 to 17557. Pérez-Invernón et al. (2021)
Pineda, N., & Rigo, T. (2017). The rainfall factor in lightning-ignited wildfires in Catalonia. Agricultural and Forest Meteorology, 239, 249 to 263. Pineda & Rigo (2017)
Rodrigues, M., Jiménez-Ruano, A., Gelabert, P. J., Resco de Dios, V., Torres, L., Ribalaygua, J., & Vega-García, C. (2023). Modelling the daily probability of lightning-caused ignition in the Iberian Peninsula. International Journal of Wildland Fire, 32(3), 351 to 362. Rodrigues et al. (2023)
Rorig, M. L., & Ferguson, S. A. (1999). Characteristics of lightning and wildland fire ignition in the Pacific Northwest. Journal of Applied Meteorology, 38(11), 1565 to 1575. Rorig & Ferguson (1999)
Soler, A., Pineda, N., San Segundo, H., Bech, J., & Montanyà, J. (2021). Characterisation of thunderstorms that caused lightning-ignited wildfires. International Journal of Wildland Fire, 30(12), 954 to 970. Soler et al. (2021)
Van Wagner, C. E. (1987). Development and structure of the Canadian Forest Fire Weather Index System. Canadian Forestry Service, Forestry Technical Report 35, Ottawa. https://
Vecín-Arias, D., Castedo-Dorado, F., Ordóñez, C., & Rodríguez-Pérez, J. R. (2016). Biophysical and lightning characteristics drive lightning-induced fire occurrence in the central plateau of the Iberian Peninsula. Agricultural and Forest Meteorology, 225, 36 to 47. Vecín-Arias et al. (2016)
Product documentation
LSA SAF, Product User Manual for Fire Risk Map, version 2 (FRM2), product LSA-504.2, SAF/LAND/IDL/PUM_FRM2/1.0, 2020. LSA SAF, Product User Manual for the MTG FRP-Pixel product, SAF/LAND/IPMA/PUM_MTFRP/1.0. LSA SAF, Product Output Format, SAF/LAND/IPMA/POF/1.2, available in the LSA SAF documentation repository. EUMETSAT, MSG Level 1.5 Image Data Format Description, EUM/MSG/ICD/105, v8, 2017, user.eumetsat.int. EUMETSAT, MTG LI Level 2 Format Specification, user.eumetsat.int. Pytroll, satpy area definitions, area msg_seviri_fes_3km, satpy
Destination Earth DataLake and DEFAIR
Data discovery and access use the Harmonised Data Access STAC API at https://
- Soler, A., Pineda, N., San Segundo, H., Bech, J., & Montanyà, J. (2021). Characterisation of thunderstorms that caused lightning-ignited wildfires. International Journal of Wildland Fire, 30(12), 954–970. 10.1071/wf21076
- Pérez-Invernón, F. J., Huntrieser, H., Soler, S., Gordillo-Vázquez, F. J., Pineda, N., Navarro-González, J., Reglero, V., Montanyà, J., van der Velde, O., & Koutsias, N. (2021). Lightning-ignited wildfires and long continuing current lightning in the Mediterranean Basin: preferential meteorological conditions. Atmospheric Chemistry and Physics, 21(23), 17529–17557. 10.5194/acp-21-17529-2021
- Vecín-Arias, D., Castedo-Dorado, F., Ordóñez, C., & Rodríguez-Pérez, J. R. (2016). Biophysical and lightning characteristics drive lightning-induced fire occurrence in the central plateau of the Iberian Peninsula. Agricultural and Forest Meteorology, 225, 36–47. 10.1016/j.agrformet.2016.05.003
- Rodrigues, M., Jiménez-Ruano, A., Gelabert, P. J., de Dios, V. R., Torres, L., Ribalaygua, J., & Vega-García, C. (2023). Modelling the daily probability of lightning-caused ignition in the Iberian Peninsula. International Journal of Wildland Fire, 32(3), 351–362. 10.1071/wf22123
- Pineda, N., & Rigo, T. (2017). The rainfall factor in lightning-ignited wildfires in Catalonia. Agricultural and Forest Meteorology, 239, 249–263. 10.1016/j.agrformet.2017.03.016
- Moris, J. V., Conedera, M., Nisi, L., Bernardi, M., Cesti, G., & Pezzatti, G. B. (2020). Lightning-caused fires in the Alps: Identifying the igniting strokes. Agricultural and Forest Meteorology, 290, 107990. 10.1016/j.agrformet.2020.107990
- Moris, J. V., Álvarez-Álvarez, P., Conedera, M., Dorph, A., Hessilt, T. D., Hunt, H. G. P., Libonati, R., Menezes, L. S., Müller, M. M., Pérez-Invernón, F. J., Pezzatti, G. B., Pineda, N., Scholten, R. C., Veraverbeke, S., Wotton, B. M., & Ascoli, D. (2023). A global database on holdover time of lightning-ignited wildfires. Earth System Science Data, 15(3), 1151–1163. 10.5194/essd-15-1151-2023
- Enno, S.-E., Viticchié, B., Navia, D., & Grandell, J. (2026). First Year of Meteosat Third Generation Lightning Imager Observations. 10.5194/egusphere-2026-3386
- Statistical Aspects of the Analysis of Data From Retrospective Studies of Disease. (1959). JNCI: Journal of the National Cancer Institute. 10.1093/jnci/22.4.719
- Bližňák, V., & Sokol, Z. (2026). First validation of the Lightning Imager aboard Meteosat Third Generation satellite with Earth Networks Total Lightning Network. International Journal of Applied Earth Observation and Geoinformation, 147, 105205. 10.1016/j.jag.2026.105205
- Rorig, M. L., & Ferguson, S. A. (1999). Characteristics of Lightning and Wildland Fire Ignition in the Pacific Northwest. Journal of Applied Meteorology, 38(11), 1565–1575. https://doi.org/10.1175/1520-0450(1999)038<1565:colawf>2.0.co;2