regulatory_parity¶
regulatory_parity ¶
EPA AERMOD test-suite parity helpers.
Used to score a pyaermod-produced POSTFILE against an EPA reference
POSTFILE from the bundled AERMOD test-case distribution
(test_cases/aermet_24142_aermod_24142/postfiles/*.PST).
The scoring metric is the best-fit slope of paired
(reference, candidate) concentrations through the origin, matching
EPA's Compare_AERMOD_test_cases.R script. The script's published
acceptance margin is ±0.001 around 1.0; we expose that as
:data:DEFAULT_SLOPE_TOLERANCE and the convenience predicate
:func:passes_parity.
Pairing is done on (x, y, date, ave, grp) join keys.
ParityScore
dataclass
¶
Outcome of comparing a candidate POSTFILE to an EPA reference.
passes ¶
True if best-fit slope is within tolerance of 1.0.
score_postfile_pair ¶
score_postfile_pair(reference: Union[str, Path], candidate: Union[str, Path], *, case: str = '') -> ParityScore
Score a candidate POSTFILE against an EPA reference POSTFILE.
Both files must be in the same format (PLOT or UNFORM); the auto-detect
in :func:pyaermod.postfile.read_postfile is applied to each.
Pairing is on (x, y, date, ave, grp). Receptors / timesteps that
appear in only one file are dropped before scoring (their count is
not subtracted from n_paired).
passes_parity ¶
passes_parity(reference: Union[str, Path], candidate: Union[str, Path], *, tolerance: float = DEFAULT_SLOPE_TOLERANCE) -> bool
Convenience: True if the candidate's best-fit slope is within tolerance.