Skip to main content

render_radials

Function render_radials 

Source
pub fn render_radials(
    radials: &[Radial],
    product: Product,
    scale: &DiscreteColorScale,
    options: &RenderOptions,
) -> Result<RgbaImage>
Expand description

Renders radar radials to an RGBA image.

Converts polar radar data into a Cartesian image representation. Each radial’s moment values are mapped to colors using the provided color scale, producing a centered radar image with North at the top.

§Arguments

  • radials - Slice of radials to render (typically from a single sweep)
  • product - The radar product (moment type) to visualize
  • scale - Color scale mapping moment values to colors
  • options - Rendering options (size, background, etc.)

§Errors

Returns an error if:

  • No radials are provided
  • The requested product is not present in the radials

§Example

use nexrad_render::{render_radials, Product, RenderOptions, nws_reflectivity_scale};

let scale = nws_reflectivity_scale();
let options = RenderOptions::new(800, 800);

let image = render_radials(
    sweep.radials(),
    Product::Reflectivity,
    &scale,
    &options,
).unwrap();

image.save("radar.png").unwrap();