Core Types and Volume Helpers
Core Types (CfRadial 2.1)
Daisho.Volume — Type
VolumeTop-level CfRadial 2.1 container. Required global attrs/vars are spec-mandated; everything else is optional. sweeps is a Vector{SweepGroup}. The struct is immutable; field addition mutates SweepGroup.fields (its OrderedDict), which is allowed.
Daisho.SweepGroup — Type
SweepGroupA single sweep. Time axis runs over time, range axis over range. fields is an OrderedDict{String,Field} keyed by canonical name. Optional sub-groups (georeference, radar_monitoring, spectra) hang off here.
Daisho.Field — Type
Field(data, metadata)A single radar field on a sweep, with data::AbstractMatrix of shape (time, range) already in physical units.
Daisho.FieldMetadata — Type
FieldMetadataPer-field metadata mirroring the CfRadial 2.1 §5.6 attribute table.
Three mutually exclusive gate states (CfRadial 2.1 / ODIM vocabulary):
- true missing — gate not measured. Sentinel:
fill_value(CF_FillValue). - undetect — gate scanned, no detectable signal. Sentinel:
undetect(ODIM_Undetect). - valid — gate scanned, signal detected (a real measured value).
Both sentinels can be present, both can be absent.
extra_attrs is the catch-all for non-spec attrs encountered in real files. The reader populates it; update_cfradial preserves it through to disk. write_cfradial drops extra_attrs unless write_extras=true.
Daisho.Georeference — Type
GeoreferencePer-ray georeference for mobile platforms. lat/lon/alt are required; everything else is optional. extra_vars passes through non-spec variables.
Daisho.RadarMonitoring — Type
RadarMonitoringPer-ray radar monitoring. All fields optional; extra_vars passes through non-spec variables (e.g. measuredtransmitpower_h reported under a non-canonical name).
Daisho.RadarParameters — Type
RadarParametersVolume-level static radar parameters. extra_vars passes through anything not enumerated here (e.g. transmit/receive sub-system tags).
Daisho.RadarCalibration — Type
RadarCalibration(entries, calib_index)Volume-level calibration table. entries holds one RadarCalibrationEntry per pulse-width / mode; calib_index (optional) is a per-ray index across the volume.
Daisho.RadarCalibrationEntry — Type
RadarCalibrationEntryOne row of a radar_calibration group, indexed by pulse-width / mode. Fields mirror CfRadial §7.3 table.
Daisho.GeoreferenceCorrection — Type
GeoreferenceCorrectionVolume-level static georeference offsets, applied uniformly to all rays.
Daisho.SpectrumGroup — Type
SpectrumGroupType stub for CfRadial spectrum groups (§6). Reader/writer support is not implemented.
Daisho.LidarMonitoring — Type
LidarMonitoringType stub for CfRadial lidar monitoring. Reader/writer support is not implemented; the type exists so that Volume and SweepGroup schemas remain closed.
Daisho.LidarParameters — Type
LidarParametersType stub for CfRadial lidar parameters. Reader/writer support is not implemented.
Daisho.LidarCalibration — Type
LidarCalibrationType stub for CfRadial lidar calibration. Reader/writer support is not implemented.
Volume Helpers
Daisho.add_field! — Function
add_field!(sweep::SweepGroup, name, data, metadata=FieldMetadata())Add a field to a sweep. data must be (n_rays, n_gates) matching the sweep's time × range axes.
Daisho.remove_field! — Function
remove_field!(sweep::SweepGroup, name) -> BoolRemove a field by name. Returns true if removed, false if it wasn't present.
Daisho.n_rays — Function
n_rays(sweep::SweepGroup) -> Int
n_rays(volume::Volume) -> IntTotal number of rays. For a SweepGroup, length(sweep.time). For a Volume, the sum across sweeps.
Daisho.field_names — Function
field_names(sweep::SweepGroup) -> Vector{String}
field_names(volume::Volume) -> Vector{String}Canonical field names. For a sweep, in the order they appear in sweep.fields. For a volume, the union across sweeps in alphabetical order.
Daisho.has_field — Function
has_field(sweep::SweepGroup, name) -> Bool
has_field(volume::Volume, name) -> BoolCheck for presence of a field. For a volume, returns true if any sweep has it.
Legacy radar Compatibility
Helpers to convert between the CfRadial 2.1 Volume type and the legacy radar struct.
Daisho.as_volume — Function
as_volume(r::radar; field_names::Vector{String}, sweep_modes=nothing,
instrument_name="", scan_name=r.scan_name,
field_metadata=Dict{String,FieldMetadata}()) -> VolumeReverse direction. Reconstruct a Volume from a legacy radar struct given the canonical field names corresponding to r.moments columns. Sweep boundaries come from r.swpstart / r.swpend.
Daisho.as_legacy_radar — Function
as_legacy_radar(volume::Volume; field_names=nothing) -> (radar, field_names)Flatten a Volume into the legacy radar struct and return it alongside the ordered list of canonical field names that match the moments-matrix columns.
When field_names is nothing (default), columns are laid out in alphabetical order of the volume's fields (legacy behavior, preserved for backwards compatibility).
When field_names is supplied, columns are laid out in that exact order. Fields named but not present in any sweep produce a column of missing.
Mobile-platform per-ray velocities (eastward_velocity, northward_velocity, vertical_velocity) are copied from sweep.georeference into the legacy ew/ns/w_platform arrays when present; otherwise those arrays are zeros.
Assumes all sweeps share the same range axis.