RawDataReader
RawDataReader is the factory that reads one instrument's raw files, applies
that instrument's QC and returns a time-indexed DataFrame with provenance in
df.attrs.
- Using it — every parameter, the date-range / resampling /
fill_missingbehaviour, thedf.attrskeys and the files written: RawDataReader Usage. - What it does to the data — the four levels, what is cached and what is recomputed per call: Data Levels (L0–L3).
- How it works inside — QC machinery, status modes, the full flag vocabulary: RawDataReader Reference.
- Per instrument — file formats, status codes, QC rules and output columns: Supported Instruments.
Pass start / end as keywords
The third and fourth positional parameters are reset and qc.
RawDataReader('AE33', path, start, end) does not raise — it sets
reset=start, qc=end and applies no date filter.
Signature
AeroViz.rawDataReader.RawDataReader
RawDataReader(instrument: str, path: Path | str, reset: bool | str = False, qc: bool | str = True, start: datetime | str = None, end: datetime | str = None, mean_freq: str | None = None, size_range: tuple[float, float] | None = None, append_stats: bool = False, fill_missing: bool = True, ignored_status_errors: list[str] | None = None, flag_severity: dict[str, str] | None = None, output_dir: Path | str | None = None, output_prefix: str | None = None, save_pkl: bool = True, save_intermediate_csv: bool = True, save_report: bool = True, quiet: bool = False, log_level: Literal['DEBUG', 'INFO', 'WARNING', 'ERROR'] = 'INFO', **kwargs)
Factory function to instantiate the appropriate reader module for a given instrument and return the processed data over the specified time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
instrument
|
str
|
The instrument name for which to read data, must be a valid key in the meta dictionary |
required |
path
|
Path or str
|
The directory where raw data files for the instrument are stored |
required |
reset
|
bool or str
|
Data processing control mode: False (default) - Use existing processed data if available True - Force reprocess all data from raw files 'append' - Add new data to existing processed data |
False
|
qc
|
bool or str
|
Quality control and rate calculation mode: True (default) - Apply QC and calculate overall rates False - Skip QC and return raw data only str - Calculate rates at specified intervals: 'W' - Weekly rates 'MS' - Month start rates 'QS' - Quarter start rates 'YS' - Year start rates Can add number prefix (e.g., '2MS' for bi-monthly) |
True
|
start
|
datetime or str
|
Start time for filtering the data. If omitted, starts at the first timestamp the files contain. |
None
|
end
|
datetime or str
|
End time for filtering the data. If omitted, ends at the last timestamp
the files contain. Omit both |
None
|
mean_freq
|
str
|
Resampling frequency for averaging the output (e.g. '1h', '30min', '1D'). If omitted, the data is returned at its native resolution — no resampling. Useful for already-aggregated / second-hand sources (e.g. EPA, IGAC, BAM1020). |
None
|
size_range
|
tuple[float, float]
|
Size range in nanometers (min_size, max_size) for SMPS/APS data filtering |
None
|
append_stats
|
bool
|
SMPS/APS only. The reader returns the dN/dlogDp distribution (diameters
as columns). When True, the derived summary statistics (total / GMD /
GSD / mode, per weighting and mode) are appended as extra columns of the
returned frame. The default (False) keeps the return value a clean PSD
matrix so it can be passed straight to |
False
|
fill_missing
|
bool
|
Time-grid coverage of the output:
True - reindex/pad out to the full requested [start, end] range
(historical behaviour; a short file can become a large mostly-NaN
frame).
False - clamp the grid to the data's actual coverage, so the output
never extends past what the files contain. Use |
True
|
ignored_status_errors
|
list
|
Whitelist of statuses that should NOT be treated as a Status Error
during QC, for operator-known benign warnings — without rewriting the
raw files. Supported on every instrument with a status check; the
whitelist is interpreted in that instrument's status mode (entries
that don't fit are skipped, so the same call is safe across readers):
- SMPS (text): comma-separated string tokens; a row is accepted when
every token is the OK value or whitelisted, e.g.
|
None
|
flag_severity
|
dict
|
Reclassify QC rules for this run: Rules ship as Demoting a rule to Flags raised after the main QC pass can be named too — currently
|
None
|
output_dir
|
Path or str
|
Directory for all output files (pkl, csv, log, report).
Default: |
None
|
output_prefix
|
str
|
Prefix for output file names (e.g., |
None
|
save_pkl
|
bool
|
Whether to save pickle cache files. Existing pickles are still read
when |
True
|
save_intermediate_csv
|
bool
|
Whether to save intermediate |
True
|
save_report
|
bool
|
Whether to save |
True
|
quiet
|
bool
|
Suppress all console output (progress bar, timeline, log messages). Log file is still written. |
False
|
log_level
|
(DEBUG, INFO, WARNING, ERROR)
|
Logging level for the log file (default: 'INFO') |
'DEBUG'
|
**kwargs
|
Additional arguments to pass to the reader module |
{}
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
Processed data with specified QC and time range. Reader metadata is attached to
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If QC mode or mean_freq format is invalid |
TypeError
|
If parameters are of incorrect type |
KeyError
|
If instrument name is not found in the supported instruments list, or if it names an instrument withdrawn from the reader (pre-aggregated, second-hand data — the message carries the migration advice) |
NotImplementedError
|
If it names a real instrument whose reader has not been written yet |
FileNotFoundError
|
If path does not exist or cannot be accessed |
See Also
AeroViz.rawDataReader.core.AbstractReader A abstract reader class for reading raw data from different instruments
Examples:
>>> from AeroViz import RawDataReader
>>>
>>> # Using string inputs
>>> df_ae33 = RawDataReader(
... instrument='AE33',
... path='/path/to/your/data/folder',
... reset=True,
... qc='1MS',
... start='2024-01-01',
... end='2024-06-30',
... mean_freq='1h',
... )
>>> # Using Path and datetime objects
>>> from pathlib import Path
>>> from datetime import datetime
>>>
>>> df_ae33 = RawDataReader(
... instrument='AE33',
... path=Path('/path/to/your/data/folder'),
... reset=True,
... qc='1MS',
... start=datetime(2024, 1, 1),
... end=datetime(2024, 6, 30),
... mean_freq='1h',
... )