lib.fire

Fire detection algorithms: absolute threshold, contextual anomaly, day/night classification, and connected component zone analysis.

Fire detection algorithms: threshold, contextual, zone analysis, and ML.

lib.fire.detect_fire_simple(T4, T11, T4_thresh=325.0, dT_thresh=10.0)[source]

Simple absolute fire detection (no contextual test, for speed on mosaics). Based on MODIS MOD14 / Giglio et al. approach.

Parameters:
  • T4 (ndarray) – Brightness temperature at ~3.9 μm [K].

  • T11 (ndarray) – Brightness temperature at ~11.25 μm [K].

  • T4_thresh (float) – Absolute fire threshold [K]. 325 K (52°C) for daytime, 310 K (37°C) for nighttime.

  • dT_thresh (float) – Minimum T4-T11 difference [K].

Return type:

ndarray

lib.fire.is_daytime(solar_zenith, threshold=85.0)[source]

Return boolean mask: True where pixel is daytime (SZA < threshold).

Parameters:
  • solar_zenith (ndarray) – Solar zenith angle [degrees]. 0° = sun overhead, 90° = horizon.

  • threshold (float) – Day/night boundary [degrees]. MODIS MOD14 uses 85°.

Return type:

ndarray

lib.fire.detect_fire(T4, T11, daytime, T4_day_thresh=325.0, T4_night_thresh=310.0, delta_T_thresh=10.0, context_window=61, context_sigma=3.0)[source]

Run fire detection on a MASTER scene with contextual anomaly test.

Parameters:
  • T4 (ndarray) – Brightness temperature at ~3.9 μm [K].

  • T11 (ndarray) – Brightness temperature at ~11.25 μm [K].

  • daytime (ndarray) – Boolean mask, True = daytime pixel.

  • T4_day_thresh (float) – Daytime absolute T4 threshold [K].

  • T4_night_thresh (float) – Nighttime absolute T4 threshold [K].

  • delta_T_thresh (float) – Minimum T4-T11 difference [K].

  • context_window (int) – Sliding window size [pixels].

  • context_sigma (float) – Number of std deviations above local mean for anomaly.

Return type:

dict[str, Any]

Returns dict with detection masks and intermediate arrays.

lib.fire.detect_fire_zones(fire_mask)[source]

Find connected fire zones using 8-connectivity.

Returns:

2D int array (0 = no fire, 1..N = zone ID) n_zones: number of zones zone_sizes: list of (zone_id, pixel_count) sorted largest-first

Return type:

labels

Parameters:

fire_mask (ndarray)

lib.fire.compute_aggregate_features(gs)[source]

Compute 12 aggregate features per pixel from grid state accumulators.

Features: [T4_max, T4_mean, T11_mean, dT_max,

SWIR_max, SWIR_mean, Red_mean, NIR_mean, NDVI_min, NDVI_mean, NDVI_drop, obs_count]

Returns:

(N, 12) float32 array for pixels with >=1 observation valid_mask: (nrows, ncols) bool — which pixels have features

Return type:

features

Parameters:

gs (dict[str, Any])