| name | calculate-aqi |
| description | Use when a user has raw pollutant measurements and needs to convert them to AQI, or wants to understand how a specific reading maps to health impacts. |
Calculate AQI from Pollutant Concentrations
Compute US EPA Air Quality Index (AQI) from raw pollutant readings. Supports PM2.5, PM10, O3, NO2, SO2, and CO.
When to use
- User has a pollutant reading and wants to know the AQI equivalence
- User needs to convert sensor data to standardized health categories
- User wants to compare concentrations across different scales or regions
- User needs to compute per-pollutant sub-AQI and identify the dominant pollutant
Inputs to gather
Any one or more of the following (supply units and averaging period):
- PM2.5: µg/m³, 24-hour average
- PM10: µg/m³, 24-hour average
- O3: ppb, 8-hour or 1-hour average (specify which)
- NO2: ppb, 1-hour average
- SO2: ppb, 1-hour average
- CO: ppm, 8-hour average
Procedure
- For each pollutant provided, look up the AQI breakpoint table and compute sub-AQI.
- EPA Breakpoints and Index Scale:
- PM2.5 (µg/m³, 24h avg):
- 0–12 → 0–50 | 12.1–35.4 → 51–100 | 35.5–55.4 → 101–150 | 55.5–150.4 → 151–200 | 150.5–250.4 → 201–300 | 250.5–500.4 → 301–500
- PM10 (µg/m³, 24h avg):
- 0–54 → 0–50 | 55–154 → 51–100 | 155–254 → 101–150 | 255–354 → 151–200 | 355–424 → 201–300 | 425–604 → 301–500
- O3 (ppb, 8h avg):
- 0–54 → 0–50 | 55–70 → 51–100 | 71–85 → 101–150 | 86–105 → 151–200 | 106–200 → 201–300 | >200 → 301–500
- NO2 (ppb, 1h):
- 0–53 → 0–50 | 54–100 → 51–100 | 101–360 → 101–150 | 361–649 → 151–200 | 650–1249 → 201–300 | >1249 → 301–500
- SO2 (ppb, 1h):
- 0–35 → 0–50 | 36–75 → 51–100 | 76–185 → 101–150 | 186–304 → 151–200 | 305–604 → 201–300 | >604 → 301–500
- CO (ppm, 8h):
- 0–4.4 → 0–50 | 4.5–9.4 → 51–100 | 9.5–12.4 → 101–150 | 12.5–15.4 → 151–200 | 15.5–30.4 → 201–300 | 30.5–50.4 → 301–500
- For each pollutant, use linear interpolation within the applicable breakpoint band:
AQI = ((I_hi - I_lo) / (BP_hi - BP_lo)) * (C - BP_lo) + I_lo
where C is the concentration, BP_lo/BP_hi are the breakpoint limits, and I_lo/I_hi are the AQI index limits.
- Compute overall AQI as the maximum sub-AQI across all pollutants.
- Identify dominant pollutant: the one with the highest sub-AQI.
- Map AQI to health category:
- 0–50: Good
- 51–100: Moderate
- 101–150: Unhealthy for Sensitive Groups
- 151–200: Unhealthy
- 201–300: Very Unhealthy
- 301–500: Hazardous
Output / side effects
Print a table of per-pollutant AQI:
| Pollutant | Concentration | Sub-AQI | Category |
|-----------|----------------|---------|-------------------------------|
| PM2.5 | 45 µg/m³ | 120 | Unhealthy for Sensitive Groups |
| PM10 | 120 µg/m³ | 95 | Moderate |
| O3 | 72 ppb (8h) | 130 | Unhealthy for Sensitive Groups |
Then summarize:
- Overall AQI: 130
- Category: Unhealthy for Sensitive Groups
- Dominant pollutant: O3
Include a note: This is the US EPA AQI scale. The EU CAQI (Common Air Quality Index) and AirNow regional scales use different breakpoints; results may differ.
Safety / constraints
- Validate that concentrations are non-negative; reject or warn on negative inputs.
- If averaging period is mismatched (e.g., 1-hour PM2.5 instead of 24-hour), warn the user that the result may not align with regulatory standards.
- Do not perform any external API calls in this skill — all computation is local and deterministic.