# variables.py
# register output variables
import numpy as np
from typing import TypedDict, Any, Union, Tuple, Dict
# Dimensions
DIM_PARTICLE = "particle"
DIM_SLICE_POS = "slice_pos"
DIM_DIODE = "diode"
DIM_COORDS = "coords"
DIM_BINS = "bins"
DIM_AR_BINS = "ar_bins"
DIM_BIN_EDGES = "bin_edges"
DIM_HABITS = "habits"
def _get_level_1_variables() -> Dict[str, VariableMeta]:
"""
Internal helper to define level-1 variables for particle data,
including their data types, dimensions, and attributes.
Users should access LEVEL_1_VARIABLES constant instead.
Returns:
--------
variables_dict: Dict[str, VariableMeta]
A dictionary where each key is a variable name, and each value is another dictionary specifying
the variable's data type (`dtype`), dimensions (`dims`), and attributes (`attrs`).
History:
--------
- 2026-01-01: Updated by Yongjie Huang (huangynj@gmail.com)
- 2024-03-04: Created by Yongjie Huang (huangynj@gmail.com)
"""
return {
"Date": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="YYYYMMDD",
description="Date of image record in which the particle resides",
),
},
"Time": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="HHMMSS",
description="Time (UTC) of image record in which the particle resides",
),
},
"msec": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="ms",
description="Sub-second time of image record in which the particle resides",
),
},
"Time_in_seconds": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(units="sec", description="Time since probe was activated"),
},
"time": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="seconds since 1970-01-01 00:00:00",
description="time (UTC) of image record in which the particle resides",
),
},
"time_sec": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="seconds since start_date",
description="image arrival time in seconds",
),
},
"time_ns": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="ns since time_sec",
description="image arrival time in nanoseconds",
),
},
"SliceCount": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--", description="Number of slices containing particle"
),
},
"dof_flag": {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
_FillValue=np.uint8(255),
long_name="DMT depth-of-field flag",
units="1",
flag_values=np.array([0, 1], dtype=np.uint8),
flag_meanings="out_of_focus meets_depth_of_field_requirement",
description=(
"Active-high DMT probe flag: 1 indicates that the particle meets "
"the depth-of-field requirement for sizing; 0 indicates rejection. "
"Missing flags are stored as the fill value and are not rejected."
),
),
},
"overload_flag": {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
_FillValue=np.uint8(255),
long_name="instrument overload flag",
units="1",
flag_values=np.array([0, 1], dtype=np.uint8),
flag_meanings="not_overloaded overloaded",
description=(
"Active-high flag used for instrument dead-time estimation. "
"The preceding inter-arrival time contributes to dead time when "
"this flag is 1."
),
),
},
"Particle_number_all": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(units="--", description="Index of particle in 2-D buffer"),
},
"position": {
"dtype": np.int16,
"dims": [DIM_PARTICLE, DIM_SLICE_POS],
"attrs": dict(
units="--",
description="Slice within image record where particle is first sampled",
),
},
"ParticleTime": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="HHMMSS", description="Particle time (not available for 2DS/HVPS)"
),
},
"ParticleMillisec": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="ms",
description="Sub-second particle time (not available for 2DS/HVPS/3VCPI)",
),
},
"ParticleMicrosec": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="microsec",
description="Sub-second particle time (unitless clock count for 2DS/HVPS/3VCPI)",
),
},
"ParentRecordNumber": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Index of image record in which the particle resides",
),
},
"ParticleNumber": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--", description="Particle index within current image record"
),
},
"ParticleLength": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Particle length in time direction using # photodiodes",
),
},
"ParticleWidth": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Particle length in photodiode direction using # photodiodes",
),
},
"ParticleArea": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm^2",
description="Projected area using the # shadowed photodiodes",
),
},
"ParticleLongestY": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Longest vertically-oriented chord through particle in time direction",
),
},
"ParticleMaxTopEdgeTouching": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Maximum # of times the top diode is shadowed in succession",
),
},
"ParticleMaxBottomEdgeTouching": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Maximum # of times the bottom diode is shadowed in succession",
),
},
"ParticleTouchingEdge": {
"dtype": np.int8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="0: denotes particle entirely in array; 1: denotes particle touching one edge; 2: denotes particle touching both edges",
),
},
"ParticleAutoReject": {
"dtype": np.dtype("U1"),
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description='ASCII reject code ("0": accepted; "H": accepted hollow; "R": reaccepted; "a": aspect ratio > 6; "t": aspect ratio > 5 + image touching edge; "p": < 25% shadowed diodes; "h": rejected hollow (no valid edge); "u": rejected hollow (unphysical area hole ratio); "s": split image; "z"/"f": zero area image; "r": area ratio < 0.2; "D": DMT DOF overload; "I": negative inter-arrival time; "S": shattering artifact)',
),
},
"ParticleIsHollow": {
"dtype": np.byte,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="-1 denotes zero-area particle; 0 denotes not hollow; 1 denotes a hollow particle; 2 denotes split particles",
),
},
"ParticleCenterIn": {
"dtype": np.byte,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="0 denotes center of particle outside array; 1 denotes center is inside",
),
},
"ParticleAxisRatio": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Ratio between maximum time-direction length and maximum diode-direction length",
),
},
"ParticleDiameter_MinR": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm", description="Dmax of smallest circle enclosing the particle"
),
},
"ParticleDiameter_AreaR": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm",
description="Area equivalent diameter, Darea = 2 * sqrt(Sarea/pi)",
),
},
"ParticlePerimeter": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm", description="Perimeter following the particle boundary"
),
},
"ParticleRectangleLength": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm",
description="Length of smallest rectangle enclosing the particle",
),
},
"ParticleRectangleWidth": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm",
description="Width of smallest rectangle enclosing the particle",
),
},
"ParticleRectangleAngle": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="degrees",
description="Angle of rectangle with respect to the time direction",
),
},
"ParticleEllipseLength": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm",
description="Length of smallest ellipse enclosing the particle",
),
},
"ParticleEllipseWidth": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm",
description="Width of smallest ellipse enclosing the particle",
),
},
"ParticleEllipseAngle": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="degrees",
description="Angle of ellipse with respect to the time direction",
),
},
"PercentShadowArea": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="percent", description="Ratio between the projected area and L*W"
),
},
"EdgeAtMaxHole": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Number of diodes between edges of the particle for the slice containing the largest gap inside the particle",
),
},
"MaxHoleDiameter": {
"dtype": np.int16,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Diameter of the largest hole inside the particle",
),
},
"ParticleDepth": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Particle depth in object plane calculated via lookup table",
),
},
"DiameterCorrectionFactor": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Dmax correction factor following Korolev (2007) correction for the Poisson Spot effect: Dmax_corr = Dmax * DiameterCorrectionFactor",
),
},
"HolroydHabit": {
"dtype": np.dtype("U1"),
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description='ASCII habit code following the Holroyd (1987) algorithm ("M" or 77: zero image; "C" or 67: center-out image; "t" or 116: tiny; "o" or 111: oriented; "l" or 108: linear; "a" or 97: aggregate; "g" or 103: graupel; "s" or 115: sphere; "h" or 104: hexagonal; "i" or 105: irregular; "d" or 100: dendrite)',
),
},
"FineDetailRatio": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--", description="Perim*Diam/Area following Holroyd (1987)"
),
},
"sphericity": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="sqrt(area)/perim following McFarquhar et al. (2005)",
),
},
"AreaHoleRatio": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="Ratio between the projected area and the area of hole inside particle",
),
},
"InterArrivalTime": {
"dtype": np.double,
"dims": DIM_PARTICLE,
"attrs": dict(
units="sec",
description="Inter-arrival time between particles (use diff(time_in_seconds) for all but 2DC/2DP)",
),
},
"DiodeStats": {
"dtype": np.int32,
"dims": DIM_DIODE,
"attrs": dict(
units="--",
description="# times specified photodiode is shadowed for particles in this file",
),
},
"ParticleDiodeStats": {
"dtype": np.int32,
"dims": [DIM_PARTICLE, DIM_DIODE],
"attrs": dict(
units="--",
description="# times specified photodiode is shadowed for each particle",
),
},
# --- Level-1
"image_index": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="image number",
long_name="reference to index of image containing current particle",
),
},
"particle_sec": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="seconds since start_date 00:00:00 +0000",
long_name="image arrival time in seconds",
timezone="UTC",
),
},
"particle_ns": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="ns since particle_sec",
long_name="image arrival time in nanoseconds",
ancillary_variables="particle_sec",
),
},
"N_p": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Max distance in the photodiode-array dimension",
equivalent_name="N_y, L5",
),
},
"N_t": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Max distance in the time dimension",
equivalent_name="N_x, L1",
),
},
"N_eq": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Diameter of circle with area equivalent to particle area",
),
},
"N_s": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Diameter of minimum enclosing circle",
equivalent_name="N_max",
),
},
"N_h": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Hypotenuse of triangle formed by N_p and N_t, sqrt(N_p^2 + N_t^2)",
references="Mitchell and Arnott (1994)",
),
},
"N_m": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Mean of N_p and N_t",
references="Brown and Francis (1995)",
),
},
"N_slice_count": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Diameter of slice with maximum number of shaded pixels",
equivalent_name="L2",
references="Lawson (2011), doi: 10.5194/amt-4-1361-2011",
),
},
"N_slice_diff": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Diameter of slice with greatest pixel separation",
equivalent_name="L4",
references="Lawson (2011), doi: 10.5194/amt-4-1361-2011",
),
},
"N_reconst": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Reconstructed circle diameter for center-in particle",
),
},
"N_hole": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Max hole diameter",
references="Korolev (2007), doi: 10.1175/JTECH1980.1",
),
},
"N_korolev": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Korolev-corrected diameter",
references="Korolev (2007), doi: 10.1175/JTECH1980.1",
),
},
"area_pixels": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(units="pixels", long_name="Number of shaded pixels"),
},
"perimeter": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Number of pixels around perimeter of particle",
),
},
"bbox": {
"dtype": np.float32,
"dims": [DIM_PARTICLE, DIM_COORDS],
"attrs": dict(
units="pixels",
long_name="Bounding box of particle. p0, t0, pN, tN pixel coordinates",
),
},
"l_edge_count": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Number of shaded pixels along left (0th) photodiode boundary for current particle",
),
},
"r_edge_count": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="Number of shaded pixels along right (Nth) photodiode boundary for current particle",
),
},
"center_in": {
"dtype": np.byte,
"dims": DIM_PARTICLE,
"attrs": dict(
units="dimensionless",
long_name="Flag indicating if particle is center-in",
),
},
"all_in": {
"dtype": np.byte,
"dims": DIM_PARTICLE,
"attrs": dict(
units="dimensionless", long_name="Flag indicating if particle is all-in"
),
},
"ellipse_maj_axis": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="The length of the major axis of the ellipse fit to particle",
),
},
"ellipse_min_axis": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="The length of the minor axis of the ellipse fit to particle",
),
},
"ellipse_angle": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="radians",
long_name="Orientation of the ellipse fit to particle",
comment=(
"Raw orientation returned by the minimum-enclosing-ellipse eigendecomposition. "
"The angle is not normalized and can span approximately -3*pi/4 to 3*pi/4 radians; "
"orientations separated by pi are equivalent. Reference is parallel to the photodiode array."
),
),
},
"fit_maj_axis": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="The length of particle along the least-squares fit line orientation",
),
},
"fit_min_axis": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="pixels",
long_name="The length of particle perpendicular to the least-squares fit line orientation",
),
},
"fit_angle": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="radians",
long_name="Orientation of particle fit to line using least-squares technique",
comment=(
"Normalized to the half-open interval [0, pi) radians. "
"Reference is parallel to the photodiode array."
),
),
},
"fit_r2": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="dimensionless",
long_name="R squared value from least-squares line fit",
),
},
"F": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="dimensionless",
description="Shape factor of particle (Perim*Diam/Area)",
references="Holroyd (1987)",
),
},
"S": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="dimensionless",
description="Ratio of fully shaded slices to total slices",
references="Holroyd (1987)",
),
},
# --- Level-1
"D_p": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Max distance in the photodiode-array dimension",
equivalent_name="D_y, L5",
),
},
"D_t": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Max distance in the time dimension",
equivalent_name="D_x, L1",
),
},
"D_eq": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Diameter of circle with area equivalent to particle area",
),
},
"D_s": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Diameter of minimum enclosing circle",
equivalent_name="D_max",
),
},
"D_h": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Hypotenuse of triangle formed by D_p and D_t, sqrt(D_p^2 + D_t^2)",
references="Mitchell and Arnott (1994)",
),
},
"D_m": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Mean of D_p and D_t",
references="Brown and Francis (1995)",
),
},
"D_slice_count": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Diameter of slice with maximum number of shaded pixels",
equivalent_name="L2",
references="Lawson (2011), doi: 10.5194/amt-4-1361-2011",
),
},
"D_slice_diff": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Diameter of slice with greatest pixel separation",
equivalent_name="L4",
references="Lawson (2011), doi: 10.5194/amt-4-1361-2011",
),
},
"D_reconst": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Reconstructed circle diameter for center-in particle",
),
},
"D_hole": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Max hole diameter",
references="Korolev (2007), doi: 10.1175/JTECH1980.1",
),
},
"D_korolev": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Korolev-corrected diameter = D_s * DiameterCorrectionFactor",
references="Korolev (2007), doi: 10.1175/JTECH1980.1",
),
},
"ellipse_maj_axis_um": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="The length of the major axis of the ellipse fit to particle",
),
},
"ellipse_min_axis_um": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="The length of the minor axis of the ellipse fit to particle",
),
},
"fit_maj_axis_um": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="The length of particle along the least-squares fit line orientation",
),
},
"fit_min_axis_um": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="The length of particle perpendicular to the least-squares fit line orientation",
),
},
"area": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(units="um^2", long_name="Area of shaded pixels"),
},
"KorolevHabit": {
"dtype": np.dtype("U1"),
"dims": DIM_PARTICLE,
"attrs": dict(
units="--",
description="ASCII habit code following the Korolev (2000) algorithm ("
":"
", "
":"
", ...)",
references="Korolev (2000), doi: 10.1002/qj.49712656913",
),
},
"particle_mass": {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="g",
long_name="Particle mass derived from habit-specific mass-dimension (m-D) relationships",
description="Calculated particle mass based on Holroyd habit classification using empirical mass-dimension power laws (m = a*D^b).",
references="Brown and Francis (1995), doi: 10.1175/1520-0426(1995)012<0410:IMOTIW>2.0.CO;2; Holroyd (1987), doi: 10.1175/1520-0426(1987)004<0498:STAUOC>2.0.CO;2",
),
},
"calcd_area": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="mm^2",
long_name="Particle projected area derived from habit-specific area-dimension relationships",
description=(
"Calculated from the selected particle diameter and Holroyd habit classification "
"using empirical area-dimension power laws (A = a*D^b)."
),
references="Mitchell (1996), doi: 10.1175/1520-0469(1996)053<1710:UOMAAD>2.0.CO;2",
),
},
"particle_massbl": {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="g",
long_name="Particle mass derived from Baker and Lawson (2006) empirical relationship",
description="Calculated particle mass using the habit-specific mass-dimension and mass-area relationships defined by Baker and Lawson (2006): m = a * A^b where a = 0.115e-3, b = 1.218",
references="Baker and Lawson (2006), doi: 10.1175/JAM2398.1",
),
},
"area_ratio": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="-",
long_name="Particle area ratio (projected area / circumscribing circle area)",
description="Ratio of the projected particle area to the area of a circumscribing circle of diameter D (ParticleArea / (pi * D^2 / 4))",
references="Heymsfield and Westbrook (2010), doi: 10.1175/2010JAS3379.1",
),
},
"particle_vt": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="m/s",
long_name="Particle terminal velocity",
description="Calculated terminal fall speed based on particle habit, mass, area ratio, and environmental conditions (temperature and pressure).",
references="Heymsfield and Westbrook (2010), doi: 10.1175/2010JAS3379.1",
),
},
"particle_pr": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="g m/s",
long_name="Single particle precipitation rate contribution",
description="Contribution of the individual particle to the total precipitation rate, calculated as the product of particle mass and terminal velocity (particle_mass * particle_vt).",
),
},
"AreaRatioFilled": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="-",
long_name="Filled particle area ratio",
description="Filled particle area ratio using scipy.ndimage.binary_fill_holes in image space.",
),
},
"particle_phase": {
"dtype": np.int8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="-",
long_name="Particle phase classification",
flag_values=[0, 1, 2],
flag_meanings="unknown liquid ice",
description="Morphology and temperature-based roundness/phase classification flag (0=unknown, 1=liquid candidate, 2=ice candidate).",
),
},
"particle_mass_liquid": {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="g",
long_name="Liquid candidate mass",
description="Calculated particle mass using the spherical liquid volume formula (1e-3 * pi/6 * D^3).",
),
},
"particle_vt_liquid": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="m/s",
long_name="Liquid candidate terminal velocity",
description="Calculated terminal velocity for liquid candidate using spherical mass and drag solver.",
),
},
"particle_pr_liquid": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="g m/s",
long_name="Liquid candidate precipitation rate contribution",
description="Single particle precipitation contribution for liquid candidate (particle_mass_liquid * particle_vt_liquid).",
),
},
}
def _get_ml_level_1_variables() -> Dict[str, VariableMeta]:
"""
Level-1 variables written only when the optional ML size correction (cops.ml) is enabled.
History:
--------
- 2026-10-16: Added for the frozen Jeju kNN/RF/HGB D_s corrections.
- 2026-10-17: Added split-population routing (ml_population) and the mixed D_s_ml selection.
"""
from .ml import schema as ml
family_label = {"knn": "kNN", "rf": "random-forest", "hgb": "gradient-boosting"}
out: Dict[str, VariableMeta] = {}
for family in ml.FAMILIES:
out[ml.DIAMETER_VARIABLE[family]] = {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name=f"{family_label[family]} ML-corrected minimum enclosing circle diameter",
description=(
f"D_s * exp(y_hat) with y_hat = predicted log(D_true/D_s) of the bundled {family} model "
f"(split mode: the {family} model of the particle's ml_population); "
f"NaN unless {ml.STATUS_VARIABLE[family]} == 0. Raw diagnostic value: no fallback, no clipping."
),
),
}
out[ml.LOG_CORRECTION_VARIABLE[family]] = {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"{family_label[family]} predicted log size correction log(D/D_s)",
),
}
out[ml.STATUS_VARIABLE[family]] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"Status of the {family_label[family]} ML diameter",
flag_values=np.arange(len(ml.STATUS_MEANINGS.split()), dtype=np.uint8),
flag_meanings=ml.STATUS_MEANINGS,
),
}
out[ml.MIXED_DIAMETER_VARIABLE] = {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Mixed-family ML-corrected minimum enclosing circle diameter",
description=(
"D_s * exp(y_hat): entire-in particles from the ml_entire_family model, center-in "
"edge particles from the ml_edge_family model (see ml_population and the "
"ml_sizing_entire_family/ml_sizing_edge_family attributes); NaN unless ml_status_ml == 0. "
"Raw diagnostic value: no fallback, no clipping."
),
),
}
out[ml.MIXED_LOG_CORRECTION_VARIABLE] = {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(units="1", long_name="Mixed-family predicted log size correction log(D/D_s)"),
}
out[ml.MIXED_STATUS_VARIABLE] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name="Status of the mixed-family ML diameter",
flag_values=np.arange(len(ml.STATUS_MEANINGS.split()), dtype=np.uint8),
flag_meanings=ml.STATUS_MEANINGS,
),
}
out[ml.POPULATION_VARIABLE] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name="ML sizing population of the particle (split mode)",
flag_values=np.array([0, 1, 2], dtype=np.uint8),
flag_meanings=ml.POPULATION_MEANINGS,
comment=("entire_in: all_in == 1, ParticleTouchingEdge == 0, center_in == 1; "
"center_in_edge: all_in == 0, center_in == 1, ParticleTouchingEdge 1 or 2, "
"mask consistent with the flags. unsupported: no ML model applies."),
),
}
out[ml.SUPPORT_FLAG_VARIABLE] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name="ML training/evaluation support diagnostics of stored N_s",
flag_masks=ml.SUPPORT_FLAG_MASKS,
flag_meanings=ml.SUPPORT_FLAG_MEANINGS,
comment=("Diagnostic only; predictions are never clipped or removed by these flags. "
"Split mode: evaluated with the support metadata of the particle's "
"ml_population (0 for unsupported particles)."),
),
}
out[ml.SELECTED_DIAMETER_VARIABLE] = {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(
units="um",
long_name="Selected particle diameter used for bulk properties, QC and size distributions",
description="Selected ML diameter, or D_s per the configured fallback; see D_selected_source.",
),
}
out[ml.SELECTED_SOURCE_VARIABLE] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name="Source of the selected particle diameter",
flag_values=np.array([0, 1, 2], dtype=np.uint8),
flag_meanings=ml.SOURCE_MEANINGS,
),
}
return out
def _get_ml_classification_level_1_variables() -> Dict[str, VariableMeta]:
"""Level-1 metadata for optional ML synthetic source-class outputs."""
from .ml.classification import schema as mlc
family_label = {"knn": "kNN", "rf": "random-forest", "hgb": "gradient-boosting"}
class_label = {"drops": "drop", "columns": "column", "ice": "ice"}
out: Dict[str, VariableMeta] = {}
for family in mlc.FAMILIES:
for source_class in mlc.CLASS_NAMES:
variable = mlc.PROBABILITY_VARIABLE[family][source_class]
distinction = (
" This synthetic source class is distinct from the derived broad ice phase."
if source_class == "ice"
else ""
)
out[variable] = {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=(
f"{family_label[family]} uncalibrated {class_label[source_class]} "
"source-class score"
),
valid_min=0.0,
valid_max=1.0,
description=(
"Uncalibrated probability score from a model trained on synthetic "
f"source classes; score for the {source_class!r} source label."
f"{distinction}"
),
),
}
out[mlc.ICE_PHASE_PROBABILITY_VARIABLE[family]] = {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"{family_label[family]} derived broad-ice phase score",
valid_min=0.0,
valid_max=1.0,
description=(
"Derived as the sum of the uncalibrated synthetic columns and ice "
"source-class scores. This broad ice-phase quantity is distinct from "
"the narrower synthetic ice source class."
),
),
}
out[mlc.CLASS_VARIABLE[family]] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"{family_label[family]} synthetic source class",
flag_values=np.array([0, 1, 2, 3], dtype=np.uint8),
flag_meanings=mlc.CLASS_MEANINGS,
description=(
"Most likely synthetic source class. The ice source class is not the "
"derived broad ice phase, which also includes columns."
),
),
}
out[mlc.PHASE_VARIABLE[family]] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"{family_label[family]} derived broad particle phase",
flag_values=np.array([0, 1, 2], dtype=np.uint8),
flag_meanings=mlc.PHASE_MEANINGS,
description=(
"Broad phase derived from the synthetic source classes: drops are "
"liquid; columns and ice are ice."
),
),
}
out[mlc.STATUS_VARIABLE[family]] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name=f"Status of the {family_label[family]} ML classification",
flag_values=np.arange(len(mlc.STATUS_MEANINGS.split()), dtype=np.uint8),
flag_meanings=mlc.STATUS_MEANINGS,
),
}
out[mlc.POPULATION_VARIABLE] = {
"dtype": np.uint8,
"dims": DIM_PARTICLE,
"attrs": dict(
units="1",
long_name="ML classification population of the particle",
flag_values=np.array([0, 1, 2], dtype=np.uint8),
flag_meanings=mlc.POPULATION_MEANINGS,
comment=(
"Uses the same routing codes as ML sizing: entire_in for complete images, "
"center_in_edge for supported clipped images, and unsupported when no "
"classification model applies."
),
),
}
return out
def _get_iat_qc_level_1_variables() -> Dict[str, VariableMeta]:
"""Level-1 metadata for inter-arrival-time QC diagnostics (written per intArrThreshMode)."""
out: Dict[str, VariableMeta] = {
# intArrThreshMode = adaptive
"tau_star": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(long_name="Adaptive inter-arrival time threshold", units="s"),
},
"tau_star_source": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
long_name="Source of adaptive inter-arrival time threshold",
flag_values=np.array([0, 1, 2, 3], dtype=np.int32),
flag_meanings="not_applied adaptive insufficient_count unimodal",
),
},
# intArrThreshMode = probabilistic or probabilistic_multifeature
"iat_p_natural": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(long_name="Poisson arrival probability of natural occurrence", units="1"),
},
"poisson_lambda": {
"dtype": np.float64,
"dims": DIM_PARTICLE,
"attrs": dict(long_name="Estimated local Poisson arrival rate", units="s-1"),
},
"shatter_cluster_id": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
long_name="Probabilistic shattering cluster identifier",
units="1",
flag_values=np.array([0], dtype=np.int32),
flag_meanings="no_cluster_or_unclassified",
note="Positive integers represent unique cluster identifiers.",
),
},
"shatter_confidence": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(long_name="Confidence of shattering cluster membership", units="1"),
},
# intArrThreshMode = probabilistic_multifeature
"shatter_score": {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(long_name="Multifeature composite shattering score", units="1"),
},
"shatter_role": {
"dtype": np.int32,
"dims": DIM_PARTICLE,
"attrs": dict(
long_name="Classification role inside detected shattering cluster",
units="1",
flag_values=np.array([0, 1, 2, 3], dtype=np.int32),
flag_meanings="no_cluster fragment_rejected parent_reaccepted cluster_member_preserved",
),
},
}
# Written only when intArrMFWriteComponentDiagnostics = 1
for name in IAT_MF_COMPONENT_SCORES:
out[name] = {
"dtype": np.float32,
"dims": DIM_PARTICLE,
"attrs": dict(long_name=f"Multifeature component score: {name}", units="1"),
}
return out
#: Per-particle multifeature shattering component scores (optional Level-1 diagnostics).
IAT_MF_COMPONENT_SCORES = (
"iat_score", "burst_density_score", "size_contrast_score", "small_fragment_score", "morphology_score",
)
# Define the constants
LEVEL_1_VARIABLES: Dict[str, VariableMeta] = {
**_get_level_1_variables(),
**_get_ml_level_1_variables(),
**_get_ml_classification_level_1_variables(),
**_get_iat_qc_level_1_variables(),
}
def _get_level_2_variables() -> Dict[str, VariableMeta]:
"""
Internal helper to define level-2 variables for particle size distribution data,
including their data types, dimensions, and attributes.
Users should access LEVEL_2_VARIABLES constant instead.
Returns:
--------
variables_dict:
A dictionary where each key is a variable name, and each value is another dictionary specifying
the variable's data type (`dtype`), dimensions (`dims`), and attributes (`attrs`).
History:
--------
- 2026-01-01: Updated by Yongjie Huang (huangynj@gmail.com)
- 2024-03-16: Created by Yongjie Huang (huangynj@gmail.com)
"""
return {
# --- Good particles
"time": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="HHMMSS", long_name="Time"),
},
"tas": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="m s-1", long_name="Mean true airspeed"),
},
"bin_min": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="millimeter", long_name="bin minimum size", short_name="bin min"
),
},
"bin_max": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="millimeter", long_name="bin maximum size", short_name="bin max"
),
},
"bin_mid": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="millimeter", long_name="bin midpoint size", short_name="bin mid"
),
},
"bin_dD": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="millimeter", long_name="bin size", short_name="bin size"
),
},
"bin_center": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="millimeter",
long_name="diameter at bin center",
short_name="diameter at bin center",
),
},
"bin_edges": {
"dtype": np.double,
"dims": (DIM_BIN_EDGES),
"attrs": dict(
units="millimeter",
long_name="diameter at bin edges",
short_name="diameter at bin edges",
),
},
"n_D": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="cm-4",
long_name="Particle size distribution function using Dmax",
short_name="N(Dmax)",
),
},
"area": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_AR_BINS),
"attrs": dict(
units="cm-4",
long_name="binned area ratio",
short_name="binned area ratio",
),
},
"n_Deq": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="cm-4",
long_name="Particle size distribution function using area-equivalent Diameter",
short_name="N(Darea)",
),
},
"conc": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="cm-3", long_name="Particle number concentration"),
},
"total_area": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="mm2/cm4",
long_name="Particle projected area (extinction)",
short_name="Ac",
),
},
"mass": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="g/cm4",
long_name="Particle mass distribution function using m-D relations",
short_name="mass",
),
},
"habitsd": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_HABITS),
"attrs": dict(
units="cm-4",
long_name="Particle size distribution function with Habit",
short_name="habit SD",
),
},
"re": {
"dtype": np.double,
"dims": (),
"attrs": dict(
units="um", long_name="Particle effective radius", short_name="Re"
),
},
"ar": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="100/100", long_name="Area Ratio", short_name="AR"),
},
"massBL": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(
units="g/cm4",
long_name="mass using Baker and Lawson method",
short_name="mass_BL",
),
},
"Reject_ratio": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="100/100", long_name="Reject Ratio"),
},
"vt": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="m/s", long_name="Mass-weighted terminal velocity"),
},
"Prec_rate": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="mm/hr", long_name="Precipitation Rate"),
},
"habitmsd": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_HABITS),
"attrs": {
"units": "g/cm-4",
"long_name": "Mass Size Distribution with Habit",
"short_name": "Habit Mass SD",
},
},
"Calcd_area": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "mm^2/cm4",
"long_name": "Particle Area Calculated using A-D relations",
"short_name": "Ac_calc",
},
},
"count": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "number count for particle images without any correction",
},
},
"mean_aspect_ratio_rectangle": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "Aspect Ratio by Rectangle fit",
"conditional": "iCreateAspectRatio == 1",
},
},
"mean_aspect_ratio_ellipse": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "Aspect Ratio by Ellipse fit",
"conditional": "iCreateAspectRatio == 1",
},
},
"mean_area_ratio": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {"units": "1", "long_name": "Area Ratio"},
},
"mean_perimeter": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {"units": "um", "long_name": "mean perimeter"},
},
# --- Bad particles
"REJ_n_D": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "cm-4",
"long_name": "Particle size distribution function of rejected particles using Dmax",
"short_name": "N(Dmax) rejected",
},
},
"REJ_area": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_AR_BINS),
"attrs": {
"units": "cm-4",
"long_name": "binned area ratio of rejected particles",
"short_name": "binned area ratio rejected",
},
},
"REJ_n_Deq": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "cm-4",
"long_name": "Particle size distribution function of rejected particles using area-equivalent Diameter",
"short_name": "N(Darea) rejected",
},
},
"REJ_conc": {
"dtype": np.double,
"dims": (),
"attrs": {
"units": "cm-3",
"long_name": "Particle number concentration of rejected particles",
"short_name": "N_rejected",
},
},
"REJ_total_area": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "mm2/cm4",
"long_name": "Particle projected area (extinction) of rejected particles",
"short_name": "Ac_rejected",
},
},
"REJ_mass": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "g/cm4",
"long_name": "Particle mass distribution function of rejected particles using m-D relations",
"short_name": "mass_rejected",
},
},
"REJ_habitsd": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_HABITS),
"attrs": {
"units": "cm-4",
"long_name": "Particle size distribution function with Habit of rejected particles",
"short_name": "habit SD rejected",
},
},
"REJ_re": {
"dtype": np.double,
"dims": (),
"attrs": {
"units": "um",
"long_name": "Particle effective radius of rejected particles",
"short_name": "Re_rejected",
},
},
"REJ_ar": {
"dtype": np.double,
"dims": (),
"attrs": {
"units": "100/100",
"long_name": "Area Ratio of rejected particles",
"short_name": "AR_rejected",
},
},
"REJ_massBL": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "g/cm4",
"long_name": "mass of rejected particles using Baker and Lawson method",
"short_name": "mass_BL_rejected",
},
},
"REJ_vt": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "m/s",
"long_name": "Mass-weighted terminal velocity of rejected particles",
},
},
"REJ_Prec_rate": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "mm/hr",
"long_name": "Precipitation Rate of rejected particles",
},
},
"REJ_habitmsd": {
"dtype": np.double,
"dims": (DIM_BINS, DIM_HABITS),
"attrs": {
"units": "g/cm-4",
"long_name": "Mass Size Distribution with Habit of rejected particles",
"short_name": "Habit Mass SD rejected",
},
},
"REJ_Calcd_area": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "mm^2/cm4",
"long_name": "Particle Area of rejected particles Calculated using A-D relations",
"short_name": "Ac_calc_rejected",
},
},
"REJ_count": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "number count of rejected particles for partial images without any correction",
},
},
"REJ_mean_aspect_ratio_rectangle": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "Aspect Ratio of rejected particles by Rectangle fit",
},
},
"REJ_mean_aspect_ratio_ellipse": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "1",
"long_name": "Aspect Ratio of rejected particles by Ellipse fit",
},
},
"REJ_mean_area_ratio": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {"units": "1", "long_name": "Area Ratio of rejected particles"},
},
"REJ_mean_perimeter": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "um",
"long_name": "mean perimeter of rejected particles",
},
},
"active_sample_time": {
"dtype": np.double,
"dims": (),
"attrs": {
"units": "s",
"long_name": "active sample time after subtracting instrument overload dead time",
},
},
"overload_correction_status": {
"dtype": np.uint8,
"dims": (),
"attrs": {
"_FillValue": np.uint8(255),
"units": "1",
"long_name": "status of the overload dead-time correction",
"flag_values": np.array([0, 1, 2, 3], dtype=np.uint8),
"flag_meanings": (
"native_flag inferred_flag "
"unavailable_or_incomplete_nominal_assumed "
"unavailable_or_incomplete_invalid"
),
"description": (
"0: corrected with a probe-native overload flag; "
"1: corrected with an inferred overload flag; "
"2: overload status was unavailable or incomplete and nominal sample time was assumed for the missing portion; "
"3: overload status was unavailable or incomplete and science output was invalidated."
),
},
},
"sample_vol": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": {
"units": "cm^3",
"long_name": "sample volume for each bin",
},
},
"iat_threshold": {
"dtype": np.double,
"dims": (),
"attrs": {
"units": "s",
"long_name": "inter-arrival time threshold used to determine which particles are likely shattered artifacts",
"conditional": "exist('iatThresh') == 1",
},
},
"n_D_liquid": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="#/cm4", long_name="liquid candidate number size distribution", short_name="n_D_liquid"),
},
"n_D_ice": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="#/cm4", long_name="ice candidate number size distribution", short_name="n_D_ice"),
},
"n_D_unknown": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="#/cm4", long_name="unknown candidate number size distribution", short_name="n_D_unknown"),
},
"conc_liquid": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="#/L", long_name="liquid candidate total concentration", short_name="conc_liquid"),
},
"conc_ice": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="#/L", long_name="ice candidate total concentration", short_name="conc_ice"),
},
"conc_unknown": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="#/L", long_name="unknown candidate total concentration", short_name="conc_unknown"),
},
"total_area_liquid": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="mm^2/cm4", long_name="liquid candidate total area size distribution", short_name="total_area_liquid"),
},
"total_area_ice": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="mm^2/cm4", long_name="ice candidate total area size distribution", short_name="total_area_ice"),
},
"total_area_unknown": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="mm^2/cm4", long_name="unknown candidate total area size distribution", short_name="total_area_unknown"),
},
"mass_liquid": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="g/cm4", long_name="liquid candidate mass size distribution", short_name="mass_liquid"),
},
"mass_ice": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="g/cm4", long_name="ice candidate mass size distribution", short_name="mass_ice"),
},
"mass_unknown": {
"dtype": np.double,
"dims": (DIM_BINS),
"attrs": dict(units="g/cm4", long_name="unknown candidate mass size distribution", short_name="mass_unknown"),
},
"LWC": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="g/m3", long_name="Liquid Water Content", short_name="LWC"),
},
"IWC": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="g/m3", long_name="Ice Water Content", short_name="IWC"),
},
"UWC": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="g/m3", long_name="Unknown Water Content", short_name="UWC"),
},
"TWC": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="g/m3", long_name="Total Water Content", description="Total Water Content calculated as LWC + IWC + UWC", short_name="TWC"),
},
"re_liquid": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="microns", long_name="liquid candidate effective radius", short_name="re_liquid"),
},
"re_ice": {
"dtype": np.double,
"dims": (),
"attrs": dict(units="microns", long_name="ice candidate effective radius", short_name="re_ice"),
},
}
# Define the constants
LEVEL_2_VARIABLES: Dict[str, VariableMeta] = _get_level_2_variables()
# Deprecated function alias for backward compatibility (optional, can be removed)
[docs]
def level_1_variables() -> Dict[str, VariableMeta]:
return LEVEL_1_VARIABLES
[docs]
def level_2_variables() -> Dict[str, VariableMeta]:
return LEVEL_2_VARIABLES