Skip to main content

StormCellDetector

Struct StormCellDetector 

Source
pub struct StormCellDetector { /* private fields */ }
Expand description

Detects storm cells in a reflectivity sweep field using connected-component labeling.

The algorithm identifies contiguous regions of gates with reflectivity at or above a configurable threshold, then computes geographic properties for each region using the radar coordinate system.

§Algorithm

  1. Scan all gates in the polar grid. Mark each gate as “above threshold” if its status is Valid and its value >= reflectivity_threshold_dbz.
  2. Perform flood-fill connected-component labeling on the above-threshold gates. Two gates are connected if they are adjacent in azimuth or range (4-connectivity). Azimuth wraps: the last azimuth index is adjacent to the first.
  3. Filter out components with fewer than min_gate_count gates.
  4. For each remaining component, compute cell properties.

§Example

use nexrad_process::detection::StormCellDetector;
use nexrad_model::geo::RadarCoordinateSystem;

let detector = StormCellDetector::new(35.0, 10)?;
let cells = detector.detect(&reflectivity_field, &coord_system)?;

for cell in &cells {
    println!("Cell {} at ({:.2}, {:.2}): max {:.1} dBZ, area {:.1} km²",
        cell.id(),
        cell.centroid().latitude,
        cell.centroid().longitude,
        cell.max_reflectivity_dbz(),
        cell.area_km2(),
    );
}

Implementations§

Source§

impl StormCellDetector

Source

pub fn new( reflectivity_threshold_dbz: f32, min_gate_count: usize, ) -> Result<Self>

Create a new storm cell detector.

§Parameters
  • reflectivity_threshold_dbz — Minimum reflectivity in dBZ. Gates at or above this value are candidates for cell membership.
  • min_gate_count — Minimum number of contiguous gates for a region to be considered a storm cell. Regions smaller than this are discarded as noise.
§Errors

Returns Error::InvalidParameter if min_gate_count is zero.

Source

pub fn detect( &self, field: &SweepField, coord_system: &RadarCoordinateSystem, ) -> Result<Vec<StormCell>>

Detect storm cells in the given reflectivity sweep field.

§Parameters
  • field — A reflectivity sweep field (dBZ values).
  • coord_system — The radar coordinate system for computing geographic positions.
§Returns

A vector of detected storm cells, sorted by descending maximum reflectivity. Returns an empty vector if no cells are found.

§Errors

Returns Error::InvalidGeometry if the field has zero azimuths or zero gates.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.