pub struct VerticalCrossSection { /* private fields */ }Expand description
Vertical cross-section (RHI-style) — assembles a range-height display from PPI scan data at a fixed azimuth.
For each cell in the output grid, the beam-height equation (standard 4/3 earth-radius model) is used to map range and altitude back to each elevation tilt’s polar coordinates. The maximum valid value across all tilts is retained, producing a pseudo-RHI from PPI scan data.
Unlike CompositeReflectivity, this type does not
implement ScanDerivedProduct because its output is a
VerticalField (range vs. altitude) rather than a
CartesianField. Its
construction parameters (azimuth, range, altitude, dimensions) fully define the
output grid, so no coordinate system or geographic extent is needed at compute time.
§Example
use nexrad_process::derived::VerticalCrossSection;
use nexrad_model::data::{SweepField, Product};
// Extract reflectivity fields from all sweeps
let ref_fields: Vec<SweepField> = scan.sweeps().iter()
.filter_map(|s| SweepField::from_radials(s.radials(), Product::Reflectivity))
.collect();
// Create a cross-section at 200° azimuth, 0-230 km range, 0-18 km altitude
let vcs = VerticalCrossSection::new(200.0, 230.0, 18000.0, 600, 300)?;
let vertical_field = vcs.compute(&ref_fields)?;
// Render with nexrad-render
use nexrad_render::{render_vertical, default_color_scale, RenderOptions};
let scale = default_color_scale(Product::Reflectivity);
let result = render_vertical(&vertical_field, &scale, &RenderOptions::new(1200, 600))?;
result.save("vertical_cross_section.png")?;Implementations§
Source§impl VerticalCrossSection
impl VerticalCrossSection
Sourcepub fn new(
azimuth_degrees: f32,
max_range_km: f64,
max_altitude_m: f64,
width: usize,
height: usize,
) -> Result<Self>
pub fn new( azimuth_degrees: f32, max_range_km: f64, max_altitude_m: f64, width: usize, height: usize, ) -> Result<Self>
Create a new vertical cross-section builder.
§Parameters
azimuth_degrees— target azimuth (0-360 degrees)max_range_km— horizontal extent in kmmax_altitude_m— vertical extent in meterswidth— number of horizontal bins (columns)height— number of vertical bins (rows)
§Errors
Returns an error if any parameter is non-positive.
Sourcepub fn compute(&self, fields: &[SweepField]) -> Result<VerticalField>
pub fn compute(&self, fields: &[SweepField]) -> Result<VerticalField>
Compute the vertical cross-section from sweep fields at multiple elevations.
Each input field contributes data at the altitude determined by its elevation angle and the beam-height equation. Where multiple tilts overlap the same output cell, the maximum valid value is retained. The label and unit of the output field are taken from the first input field.
§Errors
Returns an error if no fields are provided.