lib.stats

Pixel-level statistics, location aggregation, cell area computation, and area formatting.

Analysis utilities: pixel tables, location statistics, area computation.

lib.stats.build_pixel_table(files, lat_min, lat_max, lon_min, lon_max, day_night='D', flight_num='')[source]

Build a per-pixel DataFrame from all files in a flight.

Each valid pixel from each file is one row. Grid cells observed by multiple flight lines appear as multiple rows with different ‘file’ values, preserving all observations for statistics.

Parameters:
  • files (list[str]) – list of HDF file paths for one flight.

  • lat_min (float) – grid extent [degrees].

  • lat_max (float) – grid extent [degrees].

  • lon_min (float) – grid extent [degrees].

  • lon_max (float) – grid extent [degrees].

  • day_night (str) – ‘D’ or ‘N’ flag.

  • flight_num (str) – flight identifier string.

Returns:

flight, file, lat, lon, T4, T11, dT, SWIR, Red, NIR, NDVI, fire

Return type:

pd.DataFrame with columns

lib.stats.compute_location_stats(pixel_df)[source]

Compute per-location statistics from a pixel table.

Groups by (lat, lon) and computes mean, std, count, and fire detection rate for each grid cell across all observations.

Parameters:

pixel_df (Any) – DataFrame from build_pixel_table().

Returns:

lat, lon, T4_mean, T4_std, T11_mean, T11_std, dT_mean, dT_std, SWIR_mean, SWIR_std, NDVI_mean, NDVI_std, fire_rate, obs_count

Return type:

pd.DataFrame with one row per unique (lat, lon), columns

lib.stats.compute_cell_area_m2(lat_center_deg)[source]

Area of one grid cell in m² at the given latitude.

Parameters:

lat_center_deg (float)

Return type:

float

lib.stats.format_area(area_m2)[source]

Format area as m² or hectares.

Parameters:

area_m2 (float)

Return type:

str