Skip to content

Design-Value / NAAQS Validation

docs/validation.md shows that pyaermod drives AERMOD to reproduce EPA's concentrations. This page covers the layer above that: the post-processing in pyaermod.design_values that turns a concentration time series into the number a permit application quotes.

That layer is where a regulatory wrapper is easiest to get quietly wrong, because a wrong design value is still a plausible-looking number. Everything below is a known answer — either read off the regulation, computed by hand, or taken from EPA's own ranked output — never a recorded pyaermod result.

What the standards actually say

The NAAQS percentile forms are order statistics selected from a lookup table, not interpolated quantiles. Each appendix sorts the year's daily values from highest to lowest, looks the year's count of valid days up in a table, and takes the n-th value from the top.

Standard Form Full-year rank Citation
PM2.5, 24-hour 3-yr avg of annual 98th percentile of daily 24-hour averages 8th highest 40 CFR 50 app. N, Table 1
NO2, 1-hour 3-yr avg of annual 98th percentile of daily max 1-hour values 8th highest 40 CFR 50 app. S, Table 1
SO2, 1-hour 3-yr avg of annual 99th percentile of daily max 1-hour values 4th highest 40 CFR 50 app. T, Table 1
O3, 8-hour 3-yr avg of annual 4th-highest daily max of the running 8-hour means, computed from 1-hour values 4th highest 40 CFR 50.19; app. U 3(b)-(e)
PM10, 24-hour Highest (N+1)-th-high of the pooled record of N years: H2H with one year, H6H with five — AERMOD User's Guide 3.2.16.2 (High-N+1-High), for the standard of 40 CFR 50.6(a) and app. K: at most one expected exceedance per year
SO2, annual (secondary) 3-yr avg of annual means — 40 CFR 50.21; app. T 3.2, 5.2

Modelled values are compared with the standard unrounded (Appendix W 9.2.2(b)); the rounding conventions of the Part 50 appendices apply to monitored design values. Years are met years, as AERMOD counts them: a record that starts on 1 July is ranked July to June, and year_start="calendar" forces calendar years.

The ozone daily maximum follows Appendix U 3(b)-(d). The running 8-hour mean is computed for every hour and kept at its first hour, and is valid with at least 6 of its 8 hours. A day's value is the highest of the 17 means that start from 07:00 to 23:00, and the day is valid with at least 13 of them or with a value above the level. A POSTFILE stamp names the hour ending at HH, so the mean starting at 07:00 covers the rows stamped 08 to 15. AERMOD's own 8-HR averages are three fixed blocks a day; o3_8hr_design_value still reads them, with a warning that the result can understate the Appendix U value. The annual means (PM2.5, NO2 and the secondary SO2 standard) average every row of the year. Appendix N forms the PM2.5 annual mean from quarterly means of daily values, which differs slightly from an all-hours mean.

AERMOD writes a calm or missing hour to a 1-HR POSTFILE as 0.0 with no flag: HRLOOP skips the calculation and the background for that hour and still calls POSTFL (AERMOD 26135, aermod.f and calc2.f). Read as concentrations, those zeros lower every running mean they fall in. Pass the hours to o3_8hr_design_value(calm_missing=...); calm_and_missing_hours(surface_file) reads them from the AERMET surface file by AERMOD's own tests. Each mean then leaves those hours out and divides by the hours that remain, or by 6 if fewer remain, which is the divisor of AERMOD's own 8-hour average (AVER). The 24-hour and annual means formed from hourly rows still count calm and missing hours as zeros; for those, have AERMOD write the 24-hour or annual values.

AERMOD stamps each row with the date and hour of the surface-file record (KURDAT, hours 1 to 24) and does no time conversion, so the stamps are in the time base of the meteorology, which AERMET writes as hour-ending local standard time. Concentrations are in µg/m³ unless the run sets EMISUNIT or CONCUNIT; a POSTFILE does not name its units. AERMOD's ppb constants for BACKGRND and ozone inputs are rounded and differ from ppb_to_ugm3 by up to 0.11 % (SO2).

naaqs_percentile_rank(n_days, percentile) implements the tables. Both are transcribed into tests/test_naaqs_rank_tables.py and checked row by row for every day count from 1 to 366.

The multi-year step matches AERMOD's own: rank each year independently, then take the arithmetic mean of the annual values (SUMHNH(...) / DBLE(NUMYRS) in aermod.f). Ranking the pooled multi-year record instead gives a different — and wrong — answer, and a test pins the difference.

Evidence

1. The regulation, transcribed

tests/test_naaqs_rank_tables.py holds appendix N/S/T Table 1 as data and asserts naaqs_percentile_rank reproduces each row for each day count. It also pins that the result differs from Series.quantile(0.98, interpolation="linear"), so a silent revert to an interpolated quantile fails the suite instead of shipping.

2. Hand-computable series

On a year of 365 strictly decreasing daily values (365, 364, … 1) the k-th highest is exactly 366 − k, so every expected number is arithmetic:

  • 98th percentile → 358; 99th percentile → 362.
  • Three years whose 8th-highest values are 358, 258 and 158 give a design value of 258 — the average of the annual ranks. Ranking the pooled 1095-day record would give 361.
  • A 200-day year moves the 98th percentile to the 4th highest (app. S Table 1 row "151–200"), giving 197.

3. EPA's own ranked output

tests/regulatory/test_epa_known_answers.py needs no AERMOD binary: it reads the concentration time series EPA ships (postfiles/*.PST) and compares pyaermod's ranking against EPA's ranked tables for the same run. Both sides come from identical numbers, so agreement is exact — no tolerance is applied.

Check Reference file Coverage
1st-highest at every receptor plotfiles/*.PLT every PST/PLT pair in the reference set
Ranks 1–8 of the 24-hour series Outputs/PSET2PA.DA1–DA8 EPA's surfcoal deck, every receptor
NAAQS design value plotfiles/PSDCRED_*.PLT AERMOD's own 1-hour NO2 design-value output, every receptor
Overall-maximum table Outputs/AERTEST.SUM ranks 1–3, value and coordinates

The PSDCRED case is the strongest of the four: those plotfiles are what AERMOD writes under its own 1-hour NO2 NAAQS processing (1ST-HIGHEST MAX DAILY 1-HR VALUES AVERAGED OVER n YEARS), so matching them receptor-by-receptor is EPA's implementation of the design-value algorithm agreeing with pyaermod's.

The .SUM overall-maximum table is easy to misread: for rank n it lists the largest n-th-highest value at any receptor, not the n-th largest value in the record. On AERTEST the second row is 421.98845, while the second largest hourly value in the .PST is 746.09714 at a different receptor.

4. AERMOD's own design-value files, from a deck pyaermod wrote

The three checks above start from files EPA shipped. This one closes the loop from pyaermod's side: naaqs_output_pathway("SO2") writes the OU keywords AERMOD's 1-hour NAAQS processing uses (MAXDAILY, MXDYBYYR, MAXDCONT at the rank the NAAQS table gives), a gfortran build of AERMOD v26135 runs the deck on EPA's Anchorage 1999 meteorology, and so2_1hr_design_value(read_maxdaily(...)) is compared with what AERMOD itself ranked:

pyaermod, from the MAXDAILY daily series AERMOD's MXDYBYYR 4th-highest row AERMOD's MAXDCONT total
128.5329 / 108.8119 µg/m³ identical identical

The NO2 case (8th highest) agrees the same way. The files, and the decks that produced them, are tests/fixtures/epa_style/{so2,no2}_1hr_*; tests/test_design_values.py::TestAermodDesignValueOutputs runs the comparison, exact, on every commit.

The same method, elsewhere

The pattern here -- find the artefact that already contains the answer, and let the tool that consumes a format be the judge of it -- is what the rest of this phase used too:

Component Oracle Result
Design values 40 CFR 50 app. N/S/T tables; EPA's .PLT / DA1-8 / .SUM exact
BPIP EPA's BPIP-PRIME, compiled from source exact, 6,480 direction comparisons
AERSURFACE the binary's own setup pass (RUNORNOT NOT) EPA's reference reproduced byte-for-byte; ~30 configurations accepted
AERMOD decks AERMOD's setup pass, all 13 source types accepted
AERSCREEN EPA's AERSCREEN 21112 compiled from source (patched for gfortran), spawning MAKEMET, AERMOD, BPIP-PRIME and AERMAP all 12 flat test cases reproduced line for line through both interfaces (typed answers and restart file) and all 9 terrain cases through AERMAP; all 22 restart headers byte-for-byte

Running it

pytest tests/test_naaqs_rank_tables.py tests/regulatory/test_epa_known_answers.py

The EPA-fixture tests skip when the reference set is not unpacked under test_cases/ (see pyaermod.epa_testcases.find_epa_testcase_set and $PYAERMOD_EPA_TESTCASES). Two very large .PST pairs carry @pytest.mark.slow and need -m slow; nothing else is excluded, and a collection guard fails the suite if fewer pairs than expected are found so it cannot pass vacuously.