OzWrapper.OzAnomaly.preprocessing¶
Config parsing and window-shape normalisation helpers.
These helpers translate a device’s raw config dict into the flat list
of parameter codes we expect to see in sensor data, and rename the
dust-channel columns into the z1..z4 scheme that the threshold table
uses.
No I/O happens here — everything is pure transformation on dicts and column-oriented numpy windows.
Attributes¶
Functions¶
Rename dust columns to |
|
|
Return the OGS sensor list for skip-check lookups. |
|
Flag parameters expected by config that never appear in the window. |
|
Flatten a device config into a sorted list of expected parameter codes. |
|
Undo the |
|
Pick the subset of window columns the per-parameter checks care about. |
|
Return True if element has any sibling raw-dust channel (pN1..pN4). |
Module Contents¶
- OzWrapper.OzAnomaly.preprocessing.filter_and_rename_columns(window: OzWrapper.OzAnomaly.data_provider.Window | None) Tuple[OzWrapper.OzAnomaly.data_provider.Window | None, Dict[str, str]][source]¶
Rename dust columns to
z1..z4for threshold lookups.Maps either
p1..p4orp11..p41toz1..z4depending on which set is the raw-value set in the window. The rename mapping is returned so the caller can restore original names on the output keys.
- OzWrapper.OzAnomaly.preprocessing.get_ogs_list(config: Dict[str, Any], device_type: str | None) List[Dict[str, Any]][source]¶
Return the OGS sensor list for skip-check lookups.
DUSTROID devices don’t carry gas cartridges, so their config does not hold OGS entries with the
lblabel that the skip lists key off. We return an empty list for that device type so the skip helpers simply fall through without raising. For every other device type we return the rawconfig['ogs']list (or an empty list if absent).
- OzWrapper.OzAnomaly.preprocessing.para_check(window: OzWrapper.OzAnomaly.data_provider.Window | None, config: Dict[str, Any]) Dict[str, int][source]¶
Flag parameters expected by config that never appear in the window.
For each parameter returned by
process_config()that is not a key inwindow(and not in the ignore list), emit a{param}_e6: 1entry.
- OzWrapper.OzAnomaly.preprocessing.process_config(config: Dict[str, Any]) List[str][source]¶
Flatten a device config into a sorted list of expected parameter codes.
Walks the nested config dict, collects every enabled sensor’s sc value plus the gas keys under soft.config, and filters out metadata keys (lat, lon, etc.). For every p1..p4 present we also emit p11..p41 as expected data channels, then drop the p1..p4 stubs.
- OzWrapper.OzAnomaly.preprocessing.replace_keys_with_original(output_dict: Dict[str, Any], rename_dict: Dict[str, str]) Dict[str, Any][source]¶
Undo the
p -> zcolumn rename on output field keys.When
filter_and_rename_columns()renamedp11 -> z1, any output key that starts withz1is restored top11so the caller sees the original parameter naming.
- OzWrapper.OzAnomaly.preprocessing.select_columns(window: OzWrapper.OzAnomaly.data_provider.Window | None) List[str][source]¶
Pick the subset of window columns the per-parameter checks care about.
Returns gases (
g*1,g*5,o*1,v*1,v*5), dust (z1..z4), and a small fixed list of environmental columns (light, leq, t1, t2, temp, hum, pr).
- OzWrapper.OzAnomaly.preprocessing.should_drop(element: str, dust_list: List[str]) bool[source]¶
Return True if element has any sibling raw-dust channel (pN1..pN4).
Used to pick the raw dust columns over the aggregated ones when both are present.
- OzWrapper.OzAnomaly.preprocessing.logger¶