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.

3 Likes

Hello Drew_Frank,

We have an article explaining the difference in the graph and the map marker.

You can read more information here: Difference in Graph and Map Marker Data

Hi Ashley,

Thank you for the reply. That is definitely an important difference to be aware of!

However, in this case I believe there is also (or was at the time – I haven’t checked recently) a bug in the conversion factor applied to the graph data. Please see Dough White’s post above for the details.

Thanks,
Drew

Thank you for sharing this. I just realized that I never responded. I brought up this issue earlier this year with the development team, and the code has been fixed. Apologies for just passing that along now :sweat_smile:

1 Like