Gridding

Grid Initialization

Daisho.initialize_regular_gridFunction
initialize_regular_grid(xmin, xincr, xdim, ymin, yincr, ydim, zmin, zincr, zdim) -> Array{Float64, 4}

Initialize a 3D regular Cartesian grid with Z, Y, X coordinates.

Allocates and fills a 4D array where the first three dimensions correspond to Z, Y, X grid indices and the fourth dimension stores the coordinate values (z, y, x) at each grid point.

Arguments

  • xmin: Minimum x-coordinate (meters).
  • xincr: Grid spacing in the x-direction (meters).
  • xdim: Number of grid points in the x-direction.
  • ymin: Minimum y-coordinate (meters).
  • yincr: Grid spacing in the y-direction (meters).
  • ydim: Number of grid points in the y-direction.
  • zmin: Minimum z-coordinate (meters).
  • zincr: Grid spacing in the z-direction (meters).
  • zdim: Number of grid points in the z-direction.

Returns

A (zdim, ydim, xdim, 3) Array{Float64, 4} where the last dimension stores [z, y, x] coordinates.

source
initialize_regular_grid(xmin, xincr, xdim, ymin, yincr, ydim) -> Array{Float64, 3}

Initialize a 2D regular Cartesian grid with Y, X coordinates.

Allocates and fills a 3D array where the first two dimensions correspond to Y, X grid indices and the third dimension stores the coordinate values (y, x) at each grid point.

Arguments

  • xmin: Minimum x-coordinate (meters).
  • xincr: Grid spacing in the x-direction (meters).
  • xdim: Number of grid points in the x-direction.
  • ymin: Minimum y-coordinate (meters).
  • yincr: Grid spacing in the y-direction (meters).
  • ydim: Number of grid points in the y-direction.

Returns

A (ydim, xdim, 2) Array{Float64, 3} where the last dimension stores [y, x] coordinates.

source
initialize_regular_grid(zmin, zincr, zdim) -> Array{Float64, 1}

Initialize a 1D regular grid (e.g., vertical altitude levels).

Allocates and fills a 1D array of evenly spaced coordinate values.

Arguments

  • zmin: Minimum coordinate value (meters).
  • zincr: Grid spacing (meters).
  • zdim: Number of grid points.

Returns

A (zdim,) Array{Float64, 1} of coordinate values.

source
initialize_regular_grid(reference_latitude, reference_longitude, lonmin, londim, latmin, latdim, degincr, zmin, zincr, zdim) -> Array{Float64, 4}

Initialize a 3D regular grid on a latitude-longitude coordinate system with vertical levels.

Constructs a Transverse Mercator projection centered on the reference point, creates a lat/lon grid, converts it to Cartesian coordinates, and produces a 3D grid array with Z, Y, X values.

Arguments

  • reference_latitude: Latitude of the projection origin (degrees).
  • reference_longitude: Longitude of the projection origin (degrees).
  • lonmin: Minimum longitude of the grid (degrees).
  • londim: Number of grid points in the longitude direction.
  • latmin: Minimum latitude of the grid (degrees).
  • latdim: Number of grid points in the latitude direction.
  • degincr: Grid spacing in degrees for both latitude and longitude.
  • zmin: Minimum altitude (meters).
  • zincr: Vertical grid spacing (meters).
  • zdim: Number of vertical grid levels.

Returns

A (zdim, latdim, londim, 3) Array{Float64, 4} where the last dimension stores [z, y, x] in Transverse Mercator Cartesian coordinates (meters).

source
Daisho.appx_inverse_projectionFunction
appx_inverse_projection(reference_latitude::AbstractFloat, reference_longitude::AbstractFloat, yx_point::AbstractArray) -> Tuple{Float64, Float64}

Compute an approximate inverse map projection from Cartesian (y, x) offsets back to latitude/longitude.

Uses an empirical formula (originating from HRD/FCC wireless communication specifications) to convert meter offsets from a reference point back to geographic coordinates. This is a fast approximation rather than a rigorous geodetic inverse projection.

Arguments

  • reference_latitude::AbstractFloat: Latitude of the reference origin (degrees).
  • reference_longitude::AbstractFloat: Longitude of the reference origin (degrees).
  • yx_point::AbstractArray: A 2-element array [y_offset, x_offset] in meters from the reference point.

Returns

A tuple (lat, lon) of the approximate latitude and longitude in degrees.

source

High-Level Gridding (Volume-typed)

Daisho.grid_radar_volumeFunction
grid_radar_volume(radar_volume, moment_dict, grid_type_dict, output_file, index_time, xmin, xincr, xdim, ymin, yincr, ydim, zmin, zincr, zdim, power_threshold, missing_key="SQI", valid_key="DBZ", heading=-9999.0, metadata=MetadataParameters())

Grid a radar volume scan onto a 3D Cartesian grid and write the result to a NetCDF file.

This is the high-level driver for Cartesian volume gridding. It initializes the grid, computes the radius of influence from the grid spacing, calls grid_volume for the interpolation, and writes the output via write_gridded_radar_volume.

Arguments

  • radar_volume: Radar volume data structure.
  • moment_dict: Dictionary mapping moment names (e.g., "DBZ") to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols (:linear, :nearest, or default weighted average).
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • xmin: Minimum x-coordinate of the grid (meters).
  • xincr: Grid spacing in x (meters).
  • xdim: Number of grid points in x.
  • ymin: Minimum y-coordinate of the grid (meters).
  • yincr: Grid spacing in y (meters).
  • ydim: Number of grid points in y.
  • zmin: Minimum z-coordinate of the grid (meters).
  • zincr: Grid spacing in z (meters).
  • zdim: Number of grid points in z.
  • power_threshold: Minimum beam power weight below which a gate is excluded.
  • missing_key: Moment name used to determine if a gate has valid signal (default "SQI").
  • valid_key: Moment name used for valid-data gating (default "DBZ").
  • heading: Mean heading of the platform in degrees (default -9999.0 for missing).
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
Daisho.grid_radar_latlon_volumeFunction
grid_radar_latlon_volume(radar_volume, moment_dict, grid_type_dict, output_file, index_time, lonmin, londim, latmin, latdim, degincr, zmin, zincr, zdim, power_threshold, missing_key="SQI", valid_key="DBZ", heading=-9999.0, metadata=MetadataParameters())

Grid a radar volume scan onto a 3D latitude-longitude grid and write the result to a NetCDF file.

Similar to grid_radar_volume, but the horizontal grid is defined in degrees of latitude and longitude rather than meters. The reference point is derived from the radar location snapped to the nearest grid increment. Horizontal radius of influence is computed from the degree increment converted to meters.

Arguments

  • radar_volume: Radar volume data structure.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols.
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • lonmin: Minimum longitude offset from reference (degrees).
  • londim: Number of grid points in longitude.
  • latmin: Minimum latitude offset from reference (degrees).
  • latdim: Number of grid points in latitude.
  • degincr: Grid spacing in degrees for both latitude and longitude.
  • zmin: Minimum altitude (meters).
  • zincr: Vertical grid spacing (meters).
  • zdim: Number of vertical grid levels.
  • power_threshold: Minimum beam power weight below which a gate is excluded.
  • missing_key: Moment name used for signal quality gating (default "SQI").
  • valid_key: Moment name used for valid-data gating (default "DBZ").
  • heading: Mean heading of the platform in degrees (default -9999.0 for missing).
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
grid_radar_latlon_volume(radar_volume, output_file, index_time, p::DaishoParameters; heading=-9999.0)

Parameter-struct overload reading from p.grid.latlon, p.gridding, and p.moments.

source
Daisho.grid_radar_rhiFunction
grid_radar_rhi(radar_volume, moment_dict, grid_type_dict, output_file, index_time, rmin, rincr, rdim, rhi_zmin, rhi_zincr, rhi_zdim, power_threshold, missing_key="SQI", valid_key="DBZ", metadata=MetadataParameters())

Grid a radar RHI (Range-Height Indicator) scan onto a 2D range-height grid and write to a NetCDF file.

Initializes a 2D grid in range and altitude, calls grid_rhi for the interpolation, and writes the output via write_gridded_radar_rhi.

Arguments

  • radar_volume: Radar volume data structure containing the RHI scan.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols.
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • rmin: Minimum range (meters).
  • rincr: Range grid spacing (meters).
  • rdim: Number of range grid points.
  • rhi_zmin: Minimum altitude (meters).
  • rhi_zincr: Vertical grid spacing (meters).
  • rhi_zdim: Number of vertical grid points.
  • power_threshold: Minimum beam power weight below which a gate is excluded.
  • missing_key::String: Moment name used for signal quality gating (default "SQI").
  • valid_key::String: Moment name used for valid-data gating (default "DBZ").
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
grid_radar_rhi(radar_volume, output_file, index_time, p::DaishoParameters)

Parameter-struct overload reading from p.grid.rhi, p.gridding, and p.moments.

source
Daisho.grid_radar_ppiFunction
grid_radar_ppi(radar_volume, moment_dict, grid_type_dict, output_file, index_time, xmin, xincr, xdim, ymin, yincr, ydim, power_threshold, missing_key="SQI", valid_key="DBZ", heading=-9999.0, metadata=MetadataParameters())

Grid a radar PPI (Plan Position Indicator) scan onto a 2D Cartesian grid and write to a NetCDF file.

Initializes a 2D horizontal grid, calls grid_ppi for the interpolation, and writes the output via write_gridded_radar_ppi.

Arguments

  • radar_volume: Radar volume data structure containing the PPI scan.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols.
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • xmin: Minimum x-coordinate of the grid (meters).
  • xincr: Grid spacing in x (meters).
  • xdim: Number of grid points in x.
  • ymin: Minimum y-coordinate of the grid (meters).
  • yincr: Grid spacing in y (meters).
  • ydim: Number of grid points in y.
  • power_threshold: Minimum beam power weight below which a gate is excluded.
  • missing_key: Moment name used for signal quality gating (default "SQI").
  • valid_key: Moment name used for valid-data gating (default "DBZ").
  • heading: Mean heading of the platform in degrees (default -9999.0 for missing).
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
grid_radar_ppi(radar_volume, output_file, index_time, p::DaishoParameters; heading=-9999.0)

Parameter-struct overload using the (xmin/xincr/xdim, ymin/yincr/ydim) fields of p.grid.ppi plus p.gridding and p.moments. The Cartesian z-axis fields are ignored. p.grid.ppi falls back to p.grid.cartesian when no [grid.ppi] table is configured.

source
Daisho.grid_radar_compositeFunction
grid_radar_composite(radar_volume, moment_dict, grid_type_dict, output_file, index_time, xmin, xincr, xdim, ymin, yincr, ydim, missing_key="SQI", valid_key="DBZ", mean_heading=-9999.0, metadata=MetadataParameters())

Grid a radar composite (column-maximum) onto a 2D Cartesian grid and write to a NetCDF file.

Creates a 2D horizontal grid and calls grid_composite to select the maximum reflectivity gate at each horizontal grid point across all elevations. The output is written via write_gridded_radar_ppi.

Arguments

  • radar_volume: Radar volume data structure.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols.
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • xmin: Minimum x-coordinate of the grid (meters).
  • xincr: Grid spacing in x (meters).
  • xdim: Number of grid points in x.
  • ymin: Minimum y-coordinate of the grid (meters).
  • yincr: Grid spacing in y (meters).
  • ydim: Number of grid points in y.
  • missing_key: Moment name used for signal quality gating (default "SQI").
  • valid_key: Moment name used for valid-data gating (default "DBZ").
  • mean_heading: Mean heading of the platform in degrees (default -9999.0 for missing).
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
grid_radar_composite(radar_volume, output_file, index_time, p::DaishoParameters; mean_heading=-9999.0)

Parameter-struct overload using the (xmin/xincr/xdim, ymin/yincr/ydim) fields of p.grid.composite plus p.gridding and p.moments. power_threshold is not applicable to composite gridding. p.grid.composite falls back to p.grid.cartesian when no [grid.composite] table is configured.

source
Daisho.grid_radar_columnFunction
grid_radar_column(radar_volume, moment_dict, grid_type_dict, output_file, index_time, column_zmin, column_zincr, column_zdim, power_threshold, missing_key="SQI", valid_key="DBZ", metadata=MetadataParameters())

Grid a radar volume into a single vertical column profile and write to a NetCDF file.

Initializes a 1D vertical grid at the radar location, calls grid_column for the interpolation, and writes the output via write_gridded_radar_column. This is useful for extracting a vertical profile directly above the radar.

Arguments

  • radar_volume: Radar volume data structure.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict: Dictionary mapping moment indices to interpolation type symbols.
  • output_file: Path to the output NetCDF file.
  • index_time: Reference time for the output dataset.
  • column_zmin: Minimum altitude of the column (meters).
  • column_zincr: Vertical grid spacing (meters).
  • column_zdim: Number of vertical grid points.
  • power_threshold: Minimum beam power weight below which a gate is excluded.
  • missing_key::String: Moment name used for signal quality gating (default "SQI").
  • valid_key::String: Moment name used for valid-data gating (default "DBZ").
  • metadata: CF-1.12 global attributes forwarded to the writer (default MetadataParameters()).
source
grid_radar_column(radar_volume, output_file, index_time, p::DaishoParameters)

Parameter-struct overload using p.grid.column.z* as the column axis, plus p.gridding and p.moments. p.grid.column falls back to p.grid.cartesian when no [grid.column] table is configured.

source

Core Gridding Algorithms

Daisho.grid_volumeFunction
grid_volume(reference_latitude, reference_longitude, gridpoints, radar_volume, moment_dict, grid_type_dict, horizontal_roi, vertical_roi, power_threshold, missing_key="SQI", valid_key="DBZ") -> Tuple{Array{Float64}, Array{Float64}}

Interpolate radar moment data onto a 3D Cartesian grid using beam-weighted averaging.

This is the core gridding engine for 3D volume scans. For each horizontal grid column, a BallTree is queried to find nearby radar gates within the radius of influence. Vertical matching is then performed, and weights are computed from the spherical angle difference (beam pattern) and range ratio. Moments can be interpolated using linear (dBZ-aware), nearest-neighbor, or weighted-average schemes as specified by grid_type_dict. The function is multithreaded over horizontal grid points.

Arguments

  • reference_latitude::AbstractFloat: Reference latitude for the Transverse Mercator projection (degrees).
  • reference_longitude::AbstractFloat: Reference longitude for the Transverse Mercator projection (degrees).
  • gridpoints::AbstractArray: 4D grid coordinate array from initialize_regular_grid.
  • radar_volume::radar: Radar volume data structure.
  • moment_dict::Dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict::Dict: Dictionary mapping moment indices to interpolation symbols (:linear, :nearest, or default).
  • horizontal_roi::Float64: Horizontal radius of influence (meters).
  • vertical_roi::Float64: Vertical radius of influence (meters).
  • power_threshold::Float64: Minimum beam power weight for a gate to contribute.
  • missing_key::String: Moment name for signal quality gating (default "SQI").
  • valid_key::String: Moment name for valid-data gating (default "DBZ").

Returns

A tuple (radar_grid, latlon_grid) where:

  • radar_grid: A (n_moments, zdim, ydim, xdim) array of gridded moment values. Fill value is -32768.0 (no data), -9999.0 (in range but QC'd out).
  • latlon_grid: A (ydim, xdim, 2) array of [latitude, longitude] at each horizontal grid point.
source
Daisho.grid_rhiFunction
grid_rhi(reference_latitude, reference_longitude, gridpoints, radar_volume, moment_dict, grid_type_dict, horizontal_roi, vertical_roi, power_threshold, missing_key="SQI", valid_key="DBZ") -> Tuple{Array{Float64}, Array{Float64}}

Interpolate radar moment data onto a 2D range-height grid for an RHI scan using beam-weighted averaging.

Similar to grid_volume, but operates on a 2D grid in range and altitude rather than 3D Cartesian space. A BallTree is constructed on radial distances, and the gridding preserves the RHI azimuth from the scan. The function is multithreaded over range grid points.

Arguments

  • reference_latitude::AbstractFloat: Reference latitude for the Transverse Mercator projection (degrees).
  • reference_longitude::AbstractFloat: Reference longitude for the Transverse Mercator projection (degrees).
  • gridpoints::AbstractArray: 3D grid coordinate array from initialize_regular_grid (2D version).
  • radar_volume::radar: Radar volume data structure containing the RHI scan.
  • moment_dict::Dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict::Dict: Dictionary mapping moment indices to interpolation symbols.
  • horizontal_roi::Float64: Range radius of influence (meters).
  • vertical_roi::Float64: Vertical radius of influence (meters).
  • power_threshold::Float64: Minimum beam power weight for a gate to contribute.
  • missing_key::String: Moment name for signal quality gating (default "SQI").
  • valid_key::String: Moment name for valid-data gating (default "DBZ").

Returns

A tuple (radar_grid, latlon_grid) where:

  • radar_grid: A (n_moments, zdim, rdim) array of gridded moment values.
  • latlon_grid: An (rdim, 2) array of [latitude, longitude] along the RHI azimuth.
source
Daisho.grid_ppiFunction
grid_ppi(reference_latitude, reference_longitude, gridpoints, radar_volume, moment_dict, grid_type_dict, horizontal_roi, power_threshold, missing_key="SQI", valid_key="DBZ") -> Tuple{Array{Float64}, Array{Float64}}

Interpolate radar moment data onto a 2D Cartesian grid for a PPI scan using beam-weighted averaging.

Similar to grid_volume, but operates on a 2D horizontal grid for a single elevation scan. Only azimuthal angle weighting and range weighting are applied (no vertical matching). The function is multithreaded over horizontal grid points.

Arguments

  • reference_latitude::AbstractFloat: Reference latitude for the Transverse Mercator projection (degrees).
  • reference_longitude::AbstractFloat: Reference longitude for the Transverse Mercator projection (degrees).
  • gridpoints::AbstractArray: 3D grid coordinate array from initialize_regular_grid (2D version).
  • radar_volume::radar: Radar volume data structure containing the PPI scan.
  • moment_dict::Dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict::Dict: Dictionary mapping moment indices to interpolation symbols.
  • horizontal_roi::Float64: Horizontal radius of influence (meters).
  • power_threshold::Float64: Minimum beam power weight for a gate to contribute.
  • missing_key::String: Moment name for signal quality gating (default "SQI").
  • valid_key::String: Moment name for valid-data gating (default "DBZ").

Returns

A tuple (radar_grid, latlon_grid) where:

  • radar_grid: A (n_moments, ydim, xdim) array of gridded moment values.
  • latlon_grid: A (ydim, xdim, 2) array of [latitude, longitude] at each grid point.
source
Daisho.grid_compositeFunction
grid_composite(reference_latitude, reference_longitude, gridpoints, radar_volume, moment_dict, grid_type_dict, horizontal_roi, missing_key="SQI", valid_key="DBZ") -> Tuple{Array{Float64}, Array{Float64}}

Create a 2D composite (column-maximum) grid from a radar volume.

For each horizontal grid point, finds all nearby gates via a BallTree query and selects the gate with the maximum value of the valid_key moment. All moments for that gate are assigned to the grid point. This is commonly used to create composite reflectivity maps. The function is multithreaded over horizontal grid points.

Arguments

  • reference_latitude::AbstractFloat: Reference latitude for the Transverse Mercator projection (degrees).
  • reference_longitude::AbstractFloat: Reference longitude for the Transverse Mercator projection (degrees).
  • gridpoints::AbstractArray: 3D grid coordinate array from initialize_regular_grid (2D version).
  • radar_volume::radar: Radar volume data structure.
  • moment_dict::Dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict::Dict: Dictionary mapping moment indices to interpolation symbols (not used for composite, but kept for interface consistency).
  • horizontal_roi::Float64: Horizontal radius of influence (meters).
  • missing_key::String: Moment name for signal quality gating (default "SQI").
  • valid_key::String: Moment name used to find the maximum value gate (default "DBZ").

Returns

A tuple (radar_grid, latlon_grid) where:

  • radar_grid: A (n_moments, ydim, xdim) array of composite moment values.
  • latlon_grid: A (ydim, xdim, 2) array of [latitude, longitude] at each grid point.
source
Daisho.grid_columnFunction
grid_column(reference_latitude, reference_longitude, gridpoints, radar_volume, moment_dict, grid_type_dict, vertical_roi, power_threshold, missing_key="SQI", valid_key="DBZ") -> Tuple{Array{Float64}, Array{Float64}}

Interpolate radar moment data onto a 1D vertical column grid using beam-weighted averaging.

Extracts a vertical profile at the radar location by matching gates vertically using elevation angle weighting and range weighting. This is useful for constructing vertical profiles of radar moments directly above the radar. The function is multithreaded over vertical grid levels.

Arguments

  • reference_latitude::AbstractFloat: Reference latitude for the Transverse Mercator projection (degrees).
  • reference_longitude::AbstractFloat: Reference longitude for the Transverse Mercator projection (degrees).
  • gridpoints::AbstractArray: 1D grid coordinate array from initialize_regular_grid (1D version).
  • radar_volume::radar: Radar volume data structure.
  • moment_dict::Dict: Dictionary mapping moment names to integer indices.
  • grid_type_dict::Dict: Dictionary mapping moment indices to interpolation symbols.
  • vertical_roi::Float64: Vertical radius of influence (meters).
  • power_threshold::Float64: Minimum beam power weight for a gate to contribute.
  • missing_key::String: Moment name for signal quality gating (default "SQI").
  • valid_key::String: Moment name for valid-data gating (default "DBZ").

Returns

A tuple (radar_grid, latlon_grid) where:

  • radar_grid: A (n_moments, zdim) array of gridded moment values.
  • latlon_grid: A 2-element array [latitude, longitude] of the column location.
source

Multi-Sweep Accumulator

Daisho.GridSpecType
GridSpec

Geometry-agnostic description of the grid an accumulator lives on. The shape tag determines the dimensionality of the arrays inside the accumulator:

  • :volume_3d, :latlon_3d(n_fields, n_z, n_y, n_x)
  • :rhi_2d(n_fields, n_z, n_r)
  • :ppi_2d, :composite_2d(n_fields, n_y, n_x)
  • :column_1d(n_fields, n_z)

Axes carry the projected coordinates from the gridding-parameters block. Unused axes are length-1 placeholders.

source
Daisho.SweepProvenanceType
SweepProvenance

Per-sweep tagging metadata recorded each time a sweep is gridded into an accumulator. Used at finalize/retrieval time to reconstruct line-of-sight and to audit which inputs contributed to an output grid.

source
Daisho.ScalarGridAccumulatorType
ScalarGridAccumulator

Pre-normalized weighted sums on a chosen grid. Each grid_sweep! call adds one sweep's contribution. finalize_grid divides by weights, converts linear→dBZ where appropriate, and applies the undetect / true missing sentinels.

Layout: weighted_sum[field_idx, axis_dims…]. The trailing axis dims depend on grid_spec.shape.

GridAccumulator is a deprecation alias kept for downstream compatibility.

source
Daisho.build_accumulatorFunction
build_accumulator(grid_spec, p::DaishoParameters) -> FieldAccumulator

Select the product mode from the config: a WindGridAccumulator when any [fields] entry carries the velocity tag (the dual-Doppler product also grids all scalar fields), else a ScalarGridAccumulator. The driver is then mode-agnostic: acc = build_accumulator(grid_spec, p); grid_sweep!(acc, vol, s, p).

source
Daisho.build_grid_specFunction
build_grid_spec(shape, volume, p; rhi_azimuth=nothing) -> GridSpec

Helper for the Volume drivers. Pulls the right grid sub-spec from p based on shape and pairs it with the volume's reference position to build a GridSpec.

For mobile-platform sweeps the reference position falls back to the first ray's georeference when the volume's stationary lat/lon/alt is the zero default; callers can override by constructing the GridSpec directly.

source
Daisho.grid_sweep!Function
grid_sweep!(accum, sweep::SweepGroup, p::DaishoParameters;
            ref_latitude, ref_longitude, ref_altitude,
            source_file="", heading=-9999.0,
            instrument_name="", scan_name="")

Add one sweep's contribution to accum. The sweep is gridded with the configured ROI and the existing weighting math (Gaussian beam-pattern, range, refraction-corrected height angle). Linear-mode fields accumulate in linear units; finalize_grid converts back to dBZ.

ref_latitude / ref_longitude / ref_altitude is the reference position the sweep was scanned from. For stationary radars supply the volume's lat/lon/alt; for mobile radars supply the first ray's georeference (or any representative position). Per-ray georeference, when present on the SweepGroup, takes precedence.

beam_width is the radar half-power beamwidth (degrees) used for the angular gate weighting; the Volume overload reads it from radar_parameters.beam_width_h. Defaults to 1.0 (the legacy hard-coded beam) when unknown.

A SweepProvenance entry is appended to accum.sweeps.

source
grid_sweep!(accum, volume::Volume, sweep_index::Int, p; heading=-9999.0,
            source_file="")

Volume convenience overload. Resolves the per-sweep reference position from the sweep's georeference when present (mobile), else from the volume's stationary latitude/longitude/altitude. The angular gate weighting uses the radar's half-power beamwidth from volume.radar_parameters.beam_width_h (falling back to the 1° legacy default when absent).

source
Daisho.finalize_gridFunction
finalize_grid(accum) -> Array{Float64}

Normalize an accumulator into the grid shape the existing writers consume. :weighted fields divide by weight_total; :linear fields divide and then convert back to dBZ; :nearest carries through unchanged. Cells with no weight but with coverage == 1 are flagged undetect (scanned, no echo). Cells with coverage == 0 are flagged true missing (gate not measured). The actual sentinel values come from the accumulator's undetect / fill_value (sourced from [io]).

source
Daisho.merge_accumulators!Function
merge_accumulators!(dst, src) -> dst

Combine src into dst in place. Strict compatibility is required: identical grid_spec, identical fields, identical grid_type, identical field_folds. No silent coercion. For scalar (field_folds == false) fields the merge sums weighted sums and weight totals; for :nearest-mode fields the per-cell entry with the larger weight_total is kept. For field_folds == true fields the merge raises — these must be processed per-sweep by the wind retrieval downstream, not summed at the grid level.

source
Daisho.save_accumulatorFunction
save_accumulator(path, accum)

Persist a GridAccumulator to JLD2. The full struct is written; reload with load_accumulator.

source
Daisho.load_accumulatorFunction
load_accumulator(path) -> GridAccumulator

Read a GridAccumulator saved by save_accumulator. Raises if the schema version on disk does not match GRID_ACCUMULATOR_SCHEMA_VERSION.

source
Daisho.grid_sweep_to_fileFunction
grid_sweep_to_file(volume, sweep_index, accumulator_file, p;
                   grid_spec=nothing, heading=-9999.0,
                   merge_into_existing=true) -> path

Grid one sweep of volume into a JLD2 accumulator file. Useful for the airborne / multi-file workflow where each CfRadial file is one sweep along a flight track.

If accumulator_file already exists and merge_into_existing=true, the file is loaded, the new sweep folded in via grid_sweep!, and the result saved back. If merge_into_existing=false an ArgumentError is raised — refusing to overwrite is the safer default.

If accumulator_file does not yet exist, grid_spec must be supplied so the fresh accumulator can be allocated.

Returns the file path.

source
Daisho.combine_accumulator_filesFunction
combine_accumulator_files(input_files, output_file) -> output_file

Load all listed accumulator files (all must share a grid_spec) and merge them into a single accumulator written to output_file. Useful for combining per-sweep airborne accumulators along a leg into one accumulator before finalization.

Fields with field_folds=true cannot be merged across distinct sweeps; the underlying merge_accumulators! will raise an ArgumentError and the caller must process the per-sweep files directly through the wind retrieval instead.

source
Daisho.finalize_accumulator_fileFunction
finalize_accumulator_file(input_file, output_file, p; index_time) -> output_file

Load an accumulator from JLD2, call finalize_grid, and dispatch to the appropriate write_gridded_radar_* writer based on accumulator.grid_spec.shape. Returns the output file path.

source

Gridded Data I/O

Daisho.write_grid_productsFunction
write_grid_products(file, acc::FieldAccumulator, p::DaishoParameters;
                    index_time, start_time=index_time, stop_time=index_time,
                    frame=CartesianFrame()) -> file

Write the gridded products of acc to one CF-1.12 NetCDF file, dispatched on the accumulator type. The shared coordinates (X/Y/Z/time, projected and geographic), the Transverse Mercator grid_mapping, and per-point latitude/longitude are written once.

  • A ScalarGridAccumulator writes every configured field (finalize_grid).
  • A WindGridAccumulator writes the embedded scalar fields and the dual-Doppler product (finalize_wind): the two frame components, their *STD uncertainties, plus DET, NGATES, QFLAG. For the stage-1 CartesianFrame these are U, V, USTD, VSTD, DET, NGATES, QFLAG. No wind variables are present when the accumulator is scalar.

Stage-1 supports the 3D shapes (:volume_3d, :latlon_3d); a pre-existing file is deleted first. frame selects the wind output frame (ignored for scalar). mask_quality (default true) writes the QC'd wind product — components and σ blanked where quality_flag != 0, keeping only points that passed the σ thresholds (the accumulator retains the full non-destructive field for stage 2); DET/NGATES/QFLAG stay unmasked. It has no effect on a scalar accumulator.

source
Daisho.write_gridded_radar_volumeFunction
write_gridded_radar_volume(file, index_time, start_time, stop_time, gridpoints, radar_grid, latlon_grid, moment_dict, reference_latitude, reference_longitude, mean_heading, metadata=MetadataParameters(); fill_value=-32768.0, undetect=-9999.0)

Write a gridded 3D radar volume to a CF-1.12 compliant NetCDF file.

Creates a NetCDF file with X, Y, Z dimensions and time, writes grid coordinates, latitude/longitude fields, a Transverse Mercator grid mapping variable, heading, and all radar moment variables. Any pre-existing file at the output path is deleted first.

Arguments

  • file: Output file path for the NetCDF file.
  • index_time: Reference time for the time variable.
  • start_time: Start time of the radar volume scan.
  • stop_time: Stop time of the radar volume scan.
  • gridpoints: 4D grid coordinate array from initialize_regular_grid.
  • radar_grid: 4D array (n_moments, zdim, ydim, xdim) of gridded moment values.
  • latlon_grid: 3D array (ydim, xdim, 2) of latitude/longitude values.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • reference_latitude::AbstractFloat: Latitude of the projection origin (degrees).
  • reference_longitude::AbstractFloat: Longitude of the projection origin (degrees).
  • mean_heading::AbstractFloat: Mean platform heading in degrees.
  • metadata::MetadataParameters: CF-1.12 global attributes (institution, creator, project, platform, …). Defaults to MetadataParameters().
source
Daisho.write_gridded_radar_rhiFunction
write_gridded_radar_rhi(file, index_time, radar_volume, gridpoints, radar_grid, latlon_grid, moment_dict, reference_latitude, reference_longitude, metadata=MetadataParameters())

Write a gridded 2D RHI (range-height) radar scan to a CF-1.12 compliant NetCDF file.

Creates a NetCDF file with R (range) and Z (altitude) dimensions and time, writes grid coordinates, latitude/longitude along the RHI azimuth, a Transverse Mercator grid mapping variable, the RHI azimuth angle, and all radar moment variables. Any pre-existing file at the output path is deleted first.

Arguments

  • file: Output file path for the NetCDF file.
  • index_time: Reference time for the time variable.
  • radar_volume: Radar volume data structure (used to extract start/stop times and azimuth).
  • gridpoints: 3D grid coordinate array from initialize_regular_grid (2D version).
  • radar_grid: 3D array (n_moments, zdim, rdim) of gridded moment values.
  • latlon_grid: 2D array (rdim, 2) of latitude/longitude along the RHI.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • reference_latitude::AbstractFloat: Latitude of the projection origin (degrees).
  • reference_longitude::AbstractFloat: Longitude of the projection origin (degrees).
  • metadata::MetadataParameters: CF-1.12 global attributes. Defaults to MetadataParameters().
source
Daisho.write_gridded_radar_ppiFunction
write_gridded_radar_ppi(file, index_time, radar_volume, gridpoints, radar_grid, latlon_grid, moment_dict, reference_latitude, reference_longitude, mean_heading, metadata=MetadataParameters())

Write a gridded 2D PPI (plan position indicator) radar scan to a CF-1.12 compliant NetCDF file.

Creates a NetCDF file with X and Y dimensions and time, writes grid coordinates, latitude/longitude fields, a Transverse Mercator grid mapping variable, heading, scan name, and all radar moment variables. Also used for writing composite grids. Any pre-existing file at the output path is deleted first.

Arguments

  • file: Output file path for the NetCDF file.
  • index_time: Reference time for the time variable.
  • radar_volume: Radar volume data structure (used to extract start/stop times and scan name).
  • gridpoints: 3D grid coordinate array from initialize_regular_grid (2D version).
  • radar_grid: 3D array (n_moments, ydim, xdim) of gridded moment values.
  • latlon_grid: 3D array (ydim, xdim, 2) of latitude/longitude values.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • reference_latitude::AbstractFloat: Latitude of the projection origin (degrees).
  • reference_longitude::AbstractFloat: Longitude of the projection origin (degrees).
  • mean_heading::AbstractFloat: Mean platform heading in degrees.
  • metadata::MetadataParameters: CF-1.12 global attributes. The PPI writer also injects scan_name from radar_volume. Defaults to MetadataParameters().
source
Daisho.write_gridded_radar_columnFunction
write_gridded_radar_column(file, index_time, start_time, stop_time, gridpoints, radar_grid, latlon_grid, moment_dict, reference_latitude, reference_longitude, metadata=MetadataParameters())

Write a gridded 1D vertical column profile to a CF-1.12 compliant NetCDF file.

Creates a NetCDF file with Z (altitude) dimension and time, writes the vertical grid coordinates, latitude/longitude of the column location, a Transverse Mercator grid mapping variable, and all radar moment variables. Any pre-existing file at the output path is deleted first.

Arguments

  • file: Output file path for the NetCDF file.
  • index_time: Reference time for the time variable.
  • start_time: Start time of the radar volume scan.
  • stop_time: Stop time of the radar volume scan.
  • gridpoints: 1D grid coordinate array from initialize_regular_grid (1D version).
  • radar_grid: 2D array (n_moments, zdim) of gridded moment values.
  • latlon_grid: 2-element array [latitude, longitude] of the column location.
  • moment_dict: Dictionary mapping moment names to integer indices.
  • reference_latitude::AbstractFloat: Latitude of the column location (degrees).
  • reference_longitude::AbstractFloat: Longitude of the column location (degrees).
  • metadata::MetadataParameters: CF-1.12 global attributes. Defaults to MetadataParameters().
source
Daisho.read_gridded_radarFunction
read_gridded_radar(file, moment_dict::AbstractDict) -> Tuple
Deprecated

The moment_dict (name→index) reader is the legacy v0.1 API. Prefer read_gridded_radar(file, p::DaishoParameters), which returns fields keyed by name and resolves I/O sentinels from p.io.

Read a gridded 3D radar volume from a NetCDF file with X, Y, Z coordinates.

Returns

A tuple (x, y, z, lat, lon, start_time, stop_time, radardata) where radardata is a (n_moments, n_points) array of Union{Missing, Float32} moment values indexed by moment_dict.

source
read_gridded_radar(file, p::DaishoParameters) -> NamedTuple

Fields-API reader for a gridded 3D radar volume. Returns (; X, Y, Z, latitude, longitude, start_time, stop_time, fields, io) where fields::Dict{String,Array{Float32,3}} is keyed by field name (every field in p), each shaped (length(X), length(Y), length(Z)). io is p.io so callers resolve fill_value/undetect without re-reading config. Sentinels are preserved in the data (not collapsed) — display masking is the caller's choice (see mask_sentinels).

source
Daisho.read_gridded_ppiFunction
read_gridded_ppi(file, moment_dict::AbstractDict) -> Tuple
Deprecated

The moment_dict reader is the legacy v0.1 API. Prefer read_gridded_ppi(file, p::DaishoParameters).

Read a gridded 2D PPI/composite radar scan from a NetCDF file with X, Y coordinates. Returns (x, y, lat, lon, start_time, stop_time, radardata) where radardata is a (n_moments, n_points) array indexed by moment_dict.

source
read_gridded_ppi(file, p::DaishoParameters) -> NamedTuple

Fields-API reader for a gridded 2D PPI/composite scan. Returns (; X, Y, latitude, longitude, start_time, stop_time, fields, io) where fields::Dict{String,Matrix{Float32}} is keyed by field name, each shaped (length(X), length(Y)). Sentinels are preserved; see mask_sentinels.

source
Daisho.read_gridded_rhiFunction
read_gridded_rhi(file, moment_dict::AbstractDict) -> Tuple
Deprecated

The moment_dict reader is the legacy v0.1 API. Prefer read_gridded_rhi(file, p::DaishoParameters).

Read a gridded 2D RHI radar scan from a NetCDF file with R (range) and Z (altitude) coordinates. Returns (R, Z, lat, lon, start_time, stop_time, radardata) where radardata is a (n_moments, n_points) array indexed by moment_dict.

source
read_gridded_rhi(file, p::DaishoParameters) -> NamedTuple

Fields-API reader for a gridded 2D RHI scan. Returns (; R, Z, latitude, longitude, start_time, stop_time, fields, io) where fields::Dict{String,Matrix{Float32}} is keyed by field name, each shaped (length(R), length(Z)). Sentinels are preserved; see mask_sentinels.

source
Daisho.mask_sentinelsFunction
mask_sentinels(a::AbstractArray, io::IOParameters) -> Array{Float32}

Return a Float32 copy of a with both the true-missing (io.fill_value) and undetect (io.undetect) sentinels replaced by NaN, for display. The gridded Fields-API readers keep the raw sentinels so the missing-vs-undetect distinction is preserved in the data; call this only when rendering.

source