Values shown on map don't match the sensor time series when EPA conversion is applied

Usually, the numbers on the map correspond to the most recent data point of a sensor’s historical time series (the graph you see if you click on a sensor). However, after applying the EPA conversion, there is a huge gap between the two. The conversion makes the time series values much lower (e.g. from 150 to 100 or so), but the map value only changes a little (e.g. from 150 to 140). Based on my understanding of the conversion, and the numbers shown on the AirNow Fire and Smoke map (which also applies the EPA conversion), I think the timeseries is correct and map view is incorrect.

Agreed. I posted a bug report on this yesterday but their spam filter has hidden my post.

1 Like

Found the bug, in the class definition for the US EPA conversion (in the Modern map code, file pa.map.2.0.11-SNAPSHOT.modern.js):

      getGraphValueFromData(t, e, i, r) {
        return 'inside' == e.location_type ? this.calculate_cf(t[this.getDataHeaderIndex('pm2.5_cf_1_' + i)], t[this.getDataHeaderIndex('humidity_a')]) : this.calculate_cf(t[this.getDataHeaderIndex('pm2.5_atm_' + i)], t[this.getDataHeaderIndex('humidity_a')])
      }

That second half of the conditional, used for outside sensors, should call calculate_atm() and not calculate_cf(). Thus the graph is using the adjustment for CF_1 on CF_ATM data. By comparison, extractValue() is using the correct conversion function, and that function is used for the popup.

As noted in another thread, be careful comparing PA map data to the EPA’s Fire & Smoke Map (FSM). FSM is using a value run through their NowCast algorithm (a weighted average over the last 11 hours in 10-minute chunks) vs. the PurpleAir map which is either an instantaneous real-time value or a rolling average over a set time period. NowCast is resistant to short-term spikes.

2 Likes