Every air quality analysis rests on a cleaning step that nobody sees and reviewers always probe. Done badly, it produces numbers that are precisely wrong — and no downstream statistic will reveal it.
Order Matters
The steps below must run in sequence. The most common structural error is assessing completeness after dropping invalid values, which makes a poor dataset look complete.
- Parse timestamps
- Build a regular time index
- Apply instrument validity flags
- Range and rate-of-change checks
- Cross-parameter consistency checks
- Assess data capture
- Aggregate under a capture rule
- Document every exclusion
1. Parse Timestamps
More analyses are wrong from timestamps than from statistics.
Set the format explicitly. Indian exports are usually DD-MM-YYYY. Automatic inference can read the first twelve days of each month as MM-DD and the rest correctly, producing a dataset that is wrong in a pattern no summary reveals.
Set the timezone explicitly. Otherwise the analysis is not reproducible on another machine.
Check for duplicates. Duplicate hours mean a clock or export problem. Resolve before continuing — do not silently keep the first.
Count parse failures. Never discard them without recording how many there were.
2. Build a Regular Time Index
Reindex to a complete hourly sequence from first to last observation, so missing hours exist as explicit null rows.
This single step is what makes completeness calculable. Without it, absent hours are invisible and every capture rate is optimistic.
3. Apply Instrument Validity Flags
Station data carries status codes — calibration, maintenance, error, offline, span check. These are not measurements. They must become null, not zero and not carried forward.
Common flag families:
| Flag type | Meaning | Action |
|---|---|---|
| CAL / SPAN / ZERO | Calibration in progress | Null |
| MAINT / SVC | Maintenance | Null |
| ERR / FAULT | Instrument error | Null |
| OFF / DOWN | Not operating | Null |
| < DL | Below detection limit | Substitute per a documented convention |
That last row is a judgement call. A frequent convention is half the detection limit, but whatever you choose must be documented — substitution materially changes low-concentration statistics.
4. Range and Rate Checks
Range checks remove physically impossible values. Negatives arise from zero drift and are not real. Extreme highs are usually instrument faults, though genuine episodes exist, so review rather than delete blindly.
Indicative ranges for screening:
| Parameter | Plausible range (µg/m³) |
|---|---|
| PM2.5 | 0 – 1000 |
| PM10 | 0 – 2000 |
| NO2 | 0 – 500 |
| SO2 | 0 – 500 |
| O3 | 0 – 400 |
| CO | 0 – 50 mg/m³ |
Rate-of-change checks flag implausible jumps between consecutive hours. Real pollution changes fast during episodes, so treat these as review flags rather than automatic deletions.
Stuck-value checks catch an instrument reporting an identical value for many consecutive hours — usually a fault, occasionally a genuinely calm period.
5. Cross-Parameter Consistency
The checks that catch what single-parameter tests cannot:
- PM2.5 must not exceed PM10. It is a physical subset. Where it does, one analyser is wrong.
- NO must not exceed NOx, and NO2 should approximate NOx minus NO.
- Extreme values across every parameter simultaneously usually indicates a site-wide power or logger event, not a pollution episode.
- Wind speed zero with a defined direction is contradictory and indicates a sensor fault.
These find instrument problems that look entirely plausible in isolation.
6. Assess Data Capture
Capture is the proportion of valid measurements against the number theoretically possible in a period.
Compute it against the regular time index, not against the rows that survived cleaning. Otherwise you are measuring the completeness of what remains, which is always 100%.
Report capture at every level you report a value: hourly to daily, daily to annual.
Where the gaps sit matters as much as how many. A year at 80% capture with gaps spread evenly is usable. The same 80% with the entire winter missing is not, because the excluded period is when concentrations peak. Always plot capture over time.
7. Aggregate Under a Capture Rule
The widely applied minimum is 75% before a period may be reported. Below the threshold, the period is reported as missing rather than as a value computed from partial data.
Aggregate in stages — hourly to daily, then daily to annual. Going straight from hourly to annual allows a handful of complete months to represent a sparse year.
Note that ozone and carbon monoxide standards are defined on rolling averages, not clock-hour blocks. Computing them by simple resampling gives the wrong figure.
8. Document Everything
The cleaning log is what makes the analysis defensible. It should record, per parameter:
| Record | Why |
|---|---|
| Rows in raw export | Starting point |
| Timestamps failing to parse | Data integrity |
| Values nulled per flag type | Instrument availability |
| Values nulled per range check | Data quality |
| Values nulled per cross-check | Instrument agreement |
| Final capture rate by period | Reportability |
| Any manual exclusion, with reason | Judgement calls are the ones queried |
When a reviewer asks why your annual mean differs from another figure, this log is the answer. Without it, the difference is unexplainable.
Mistakes That Recur
| Mistake | Effect |
|---|---|
| Computing capture after dropping nulls | Completeness always looks perfect |
| Treating flagged values as zero | Mean pulled downward |
| Deleting high values as outliers | Genuine episodes removed, exposure understated |
| Filling gaps by interpolation without saying so | Invented data presented as measured |
| Inferring the date format | Silent day/month corruption |
| Ignoring where gaps cluster | Seasonal bias |
| No cleaning log | Nothing can be defended or reproduced |
Automating It Without Losing Judgement
Cleaning has to be scripted to be reproducible, but fully automatic cleaning removes real data.
The workable split is automate the mechanical, review the ambiguous:
Automate without review — timestamp parsing, reindexing, flag application, negative values, physically impossible ranges, exact duplicates. These are unambiguous.
Automate as a flag, then review — extreme highs, sharp rate-of-change events, stuck values, cross-parameter failures. Each has a legitimate explanation as well as a fault explanation, and only a person can tell them apart in context.
Never automate — deciding that a pollution episode is an outlier. That judgement needs the site log, the meteorology and knowledge of what was happening locally.
A practical structure is a script that outputs two things: a cleaned dataset, and a review file listing every flagged-but-not-removed value with its timestamp and reason. The reviewer works through the second file and records decisions, which then feed back as an explicit exclusion list. The exclusion list is versioned alongside the code, so a rerun reproduces the same result.
This keeps the pipeline reproducible while keeping a human in the one place where judgement genuinely cannot be replaced.
Should You Fill Gaps?
Generally, for compliance reporting, no. Report the capture rate and let the gap stand.
Gap filling is legitimate for modelling inputs and for exploratory work, provided it is clearly labelled and the method is stated. It is not legitimate to fill gaps and then report the result as measured data.
If you do fill, use a documented method — a same-hour seasonal mean, or a regression against a correlated nearby station — and always retain the unfilled series alongside.
Handling Multi-Year Records
Long records accumulate changes that break comparability, and none of them are visible in the numbers.
Instrument changes. A swap from gravimetric to beta attenuation, or between analyser models, introduces a systematic step. It will read as a trend. Check the site log against any apparent step change before attributing it to emissions.
Site relocation. Even a move of a few hundred metres changes exposure to nearby sources. Treat a relocated station as two separate records unless an overlap period demonstrates equivalence.
Method or standard revisions. Reporting conventions change. A series computed under two different capture rules is not one series.
Detection limit changes. A more sensitive instrument shifts the low end of the distribution, which moves the annual mean without any change in air quality.
The practical safeguard is a metadata file kept alongside the data, recording every instrument, location, method and threshold change with its date. It takes minutes to maintain and it is the first thing anyone auditing a long record will ask for. Without it, a multi-year trend cannot be defended.
Frequently Asked Questions
What data capture is required? 75% is the widely used minimum for reporting a period. Confirm the specific requirement for your regulator and always state the achieved capture.
Should I delete negative values? Yes, as invalid. Small negatives near zero reflect instrument drift; they are not measurements of negative concentration.
How do I treat values below the detection limit? Substitute by a documented convention — commonly half the detection limit — and record what you did.
Can I remove a pollution episode as an outlier? No, unless you can attribute it to an instrument fault. Genuine episodes are the data.
How do I know if a gap pattern biases my result? Plot capture over time and compare the seasonal distribution of gaps against the seasonal distribution of concentrations.
Who should do the cleaning? Someone who understands both the instruments and the statistics. Purely statistical cleaning removes real episodes; purely instrumental cleaning misses distributional problems.
What next after cleaning? Statistical analysis and trend testing. See Python for air quality data analysis and air quality monitoring data QA/QC.
Need air quality data analysed properly? DSTechnoverse handles monitoring data QA/QC, statistical analysis, trend testing and compliance reporting in R and Python. We are based in Indore, Madhya Pradesh and work with clients across India. See our air quality analysis and EIA data analysis outsourcing services, or talk to our team.
Sources and Further Reading
Official and primary sources for the standards, rules and data discussed on this page.
- CPCB: National Air Quality Index portal: live AQI and continuous monitoring station data across India.
- Central Pollution Control Board (CPCB): national standards, guidelines and monitoring data for air and water in India.
- WHO Global Air Quality Guidelines (2021): health-based guideline values for PM2.5, PM10, NO2, SO2, O3 and CO.
- U.S. EPA: 2024 Appendix W final rule: the latest revision of the Guideline on Air Quality Models.
Related services
Related articles
- QA/QC for Air Quality Monitoring Data: Validation, Flagging, Gap Treatment and Data Capture
- How Flight Distance Is Established for CORSIA Reporting
- Air Quality Analysis: The Complete Guide to Air Quality Data Analysis, Methods and Services
- Air Quality Compliance Reporting Against NAAQS: Percentiles, Exceedances and Defensible Statistics