MadisAmdarPreprocessor#
- class rojak.datalib.madis.amdar.MadisAmdarPreprocessor(filepaths, glob_pattern=None)[source]#
Preprocesses raw MADIS ACARS netCDF files into filtered parquet files of turbulence-relevant observations
Each raw (gzip-compressed) netCDF file is decompressed, restricted to
data_vars_for_turbulence, filtered to drop observations with invalid quality-control (quality_control_vars) or error (error_vars) flags, and written out as a parquet file (seeapply_preprocessor()).- __init__(filepaths, glob_pattern=None)[source]#
- Parameters:
filepaths (Iterable[Path] | Path) – Files to preprocess. If
glob_patternis given, this is instead the root directory (or directories) to search for files matchingglob_patternwithin. Ifglob_patternisNoneand this is a single path (not an iterable), it must point to an existing file.glob_pattern (str | None) – If provided, glob pattern used to find files within
filepaths, andrelative_to_root_pathis populated with each file’s directory relative to its root infilepaths. IfNone,filepathsis used as-is.
- Raises:
ValueError – If
glob_patternisNoneandfilepathsis a single path that is not an existing file- Return type:
None
Methods
__init__(filepaths[, glob_pattern])apply_preprocessor(output_directory)Preprocess every file in
filepathsinto a filtered parquet file underoutput_directorydecompress_gz(filepath)Decompress a gzip-compressed file into a temporary file
drop_invalid_error_data(dataset)Drop observations with a failing error flag on any of
error_varsdrop_invalid_qc_data(dataset)Drop observations with an invalid quality-control flag on any of
quality_control_varsAttributes
data_vars_for_turbulencedimension_nameerror_varsquality_control_varsrelative_to_root_pathfilepaths