BAAQMD / BAAQMD/ARB

CARB pollutant IDs now depend on emission units

Open
#2 5 comments 1 reaction 1 assignee Claimed by @ydu0316 View on GitHub
Dominant language
R
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Context

Currently, `ARB_POLLUTANT_CODES` maps the following (integer) pollutant IDs to short, human-readable abbreviations:

```
> show(ARB::ARB_POLLUTANT_CODES)
TSP TOG ROG VOC NOx SO2 CO PM10_PRI
11101 43101 16113 43104 42603 42401 42101 85101
PM10_FIL PM2.5_PRI PM2.5_FIL NH3 Pb
85105 88101 88105 7664417 7439921
```

## New Requirement(s)

However, since CEIDARS-RY2018, CARB requires reporting NH3 and Pb as both criteria and toxic pollutants under different pollutant codes:

![image](https://user-images.githubusercontent.com/825962/81588234-128a6700-936d-11ea-9541-e57f3cc8dcae.png)

## Problem Statement

It's rather unfortunate that CARB has elected to use pollutant IDs to represent not only the substance but also the units in which it's reported.

This creates ambiguities; it means that the logic of encoding/decoding, and translation, has to get more complicated.

## Two Ideas

**One way forward** is just to edit the file `data/ARB_POLLUTANT_CODES.R`, adding two new entries: one for for NH3 (reported in `tons`) and one for Pb (reported in `tons`).

I _think_ it is OK to have non-unique names in a codec (i.e. a named integer vector that we use for encoding and decoding) — that is, to have `NH3` and `Pb` appear twice in `ARB_POLLUTANT_CODES`.

- For use with `codec::decode()`, this is straightforward; there would be no duplicate integer IDs, so decoding (integer ID → abbreviation) is unambiguous.
- Encoding (abbreviation → integer ID) will require a bit of finesse in the relevant R code, since encoding "NH3" and "Pb" would be ambiguous.

**Another approach** is to avoid the use of `codec::encode()` and `codec::decode()` in CEIDARS-related builds.

- We could add an object like `CARB_pollutant_lookup` to the `CEIDARS` package, with columns `DB_pol_id`, `ems_unit`, `pol_abbr`, and `CARB_pol_id`.

- Then we would rely on things like this instead:

```
CARB_data <-
DB_data %>%
rename(
DB_pol_id = pol_id) %>%
left_join(
select(CARB_pollutant_lookup, CARB_pol_id, ems_unit, DB_pol_id),
by = c("DB_pol_id", "ems_unit"))
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.