Guides
Quality control
Observation quality control annotates suspicious physics; it does not rewrite measurements or drop reports. Request it on weather.observations(), inspect the bitfield, and choose the filtering policy that fits your model.
from mostlyright import weather
reports = weather.observations( "KNYC", "2025-01-06", "2025-01-08", quality_control=True,)
clean = reports[reports["obs_qc_status"] == 0]flagged = reports[reports["obs_qc_status"] != 0]quality_control is the 2.0 keyword. The old qc= name is gone.
One column, five rules
Section titled “One column, five rules”obs_qc_status is an integer bitfield. Zero means that none of the registered rules fired. A set bit means that rule flagged the row.
| Bit | Rule id | Flags when |
|---|---|---|
| 0 | temp_c.out_of_range | Temperature is outside [-89, 57] °C |
| 1 | dewpoint_c.exceeds_temp | Dewpoint is above temperature |
| 2 | wind_speed_ms.negative | Wind speed is negative |
| 3 | wind_direction_degrees.out_of_range | Wind direction is outside [0, 360] |
| 4 | sea_level_pressure_hpa.out_of_range | Sea-level pressure is outside [870, 1085] hPa |
Existing bit positions are stable. New rules append a new bit so stored values keep their meaning.
The separate qc_field column is the upstream source’s quality marker. It is not the SDK physics bitfield.
Test individual rules
Section titled “Test individual rules”TEMP_RANGE = 1 << 0DEWPOINT = 1 << 1
status = reports["obs_qc_status"].fillna(0).astype(int)
bad_temperature = reports[(status & TEMP_RANGE) != 0]
# Accept a dewpoint warning but reject every other rule.other_rules = status & ~DEWPOINTusable = reports[other_rules == 0]The returned measurements remain unchanged. This lets you audit a sensor failure, change your filtering threshold later, or re-run training without re-fetching.
QC and settlement labels
Section titled “QC and settlement labels”QC applies to observation features, not settlement truth. weather.training_table() keeps its daily_summary_* labels tied to the venue’s settlement source.
For exact settlement replay, preserve the label as reported even when an observation feature looks suspicious. For model training, record the policy that decided whether to keep, mask, or transform a flagged feature.
Other QC vocabularies
Section titled “Other QC vocabularies”Not every domain uses the observation bitfield:
- CWOP and satellite rows use
qc_statusvalues such asclean,flagged, orsuspect. - NWP forecast rows carry model-aware
qc_status. qc_fieldis raw source metadata on METAR/SPECI rows.
Do not compare these columns as though they were the same scale.
See also
Section titled “See also”- Weather observations: request per-report rows
- Observation schema: measurement and provenance fields
- Sources & provenance: why QC never changes source identity
- API reference: domains and signatures