Skip to main content

VerticalCrossSection

Struct VerticalCrossSection 

Source
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

Source

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 km
  • max_altitude_m — vertical extent in meters
  • width — number of horizontal bins (columns)
  • height — number of vertical bins (rows)
§Errors

Returns an error if any parameter is non-positive.

Source

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.

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.