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
- Scan all gates in the polar grid. Mark each gate as “above threshold” if
its status is
Validand its value >=reflectivity_threshold_dbz. - 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.
- Filter out components with fewer than
min_gate_countgates. - 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
impl StormCellDetector
Sourcepub fn new(
reflectivity_threshold_dbz: f32,
min_gate_count: usize,
) -> Result<Self>
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.
Sourcepub fn detect(
&self,
field: &SweepField,
coord_system: &RadarCoordinateSystem,
) -> Result<Vec<StormCell>>
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§
impl Freeze for StormCellDetector
impl RefUnwindSafe for StormCellDetector
impl Send for StormCellDetector
impl Sync for StormCellDetector
impl Unpin for StormCellDetector
impl UnsafeUnpin for StormCellDetector
impl UnwindSafe for StormCellDetector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more