Skip to main content

render_sweep

Function render_sweep 

Source
pub fn render_sweep(
    field: &SweepField,
    color_scale: &ColorScale,
    options: &RenderOptions,
) -> Result<RenderResult>
Expand description

Renders a SweepField (polar grid) to an image with metadata.

This is the primary rendering entry point for processed data. It accepts a SweepField — the output of data extraction or processing — and produces a RenderResult that includes both the rendered image and metadata for geographic placement and data inspection.

§Arguments

  • field - The sweep field to render
  • color_scale - Color scale to apply (discrete or continuous)
  • options - Rendering options (size, background, extent, coordinate system)

§Example

use nexrad_render::{render_sweep, RenderOptions, ColorScale};
use nexrad_model::data::{SweepField, Product};

let field = SweepField::from_radials(sweep.radials(), Product::Reflectivity).unwrap();
let scale = ColorScale::from(nexrad_render::nws_reflectivity_scale());
let result = render_sweep(&field, &scale, &RenderOptions::new(800, 800))?;

result.image().save("radar.png").unwrap();
let meta = result.metadata();
let ring_px = meta.km_to_pixel_distance(100.0);