Workaround for Plotting WUnderground Data - '-99.0' Issue

Posted on
Thu Apr 06, 2017 5:14 am
DaveL17 offline
User avatar
Posts: 4754
Joined: Aug 20, 2013
Location: Chicago, IL, USA

Workaround for Plotting WUnderground Data - '-99.0' Issue

When the WUnderground service doesn't have a good value to send for an API field (and sometimes for wide swaths of Personal Weather Station data) it will send instead a value of -99.0 (or -999.0, -9999.0, etc.) The WUnderground plugin tries to be agnostic about this, although it does try to refactor everything to -99.0 for consistency. Having -99.0 appear in your data can make for some spectacularly ugly charts.

While not spectacularly ugly, here's an example with a half-dozen -99.0 values at the start of the dataset:

chart_humidity_outdoor.png (11.22 KiB) Viewed 351 times

There is a work around for this. If we replace the -99.0 values with the placeholder NaN (short for Not a Number), we then get something better.
Code: Select all
Timestamp,outdoor humidity
2017-04-03 08:08:40.317000,NaN
2017-04-03 08:23:48.772000,NaN
2017-04-03 08:38:57.276000,NaN
2017-04-03 08:54:06.047000,NaN
2017-04-03 09:09:14.608000,NaN
2017-04-03 09:24:23.878000,83.0
2017-04-03 09:39:32.208000,83.0
2017-04-03 09:54:41.107000,84.0
2017-04-03 10:09:50.003000,86.0
2017-04-03 10:24:58.110000,89.0
2017-04-03 10:40:07.057000,93.0
2017-04-03 10:55:16.087000,94.0
2017-04-03 11:10:25.595000,95.0
2017-04-03 11:25:34.361000,96.0
2017-04-03 11:40:42.778000,96.0
2017-04-03 11:55:51.606000,97.0
2017-04-03 12:11:00.491000,97.0
2017-04-03 12:26:09.192000,97.0

chart_humidity_outdoor.png (12.38 KiB) Viewed 351 times

Note: There is a bug in versions of Matplotlib prior to 2.0, which causes things to go haywire with the Y axis range if the dataset starts with NaN. One way to address this issue is to specify a Y axis range for the chart device in the plugin (I set the Y axis range to 0-100 for this example).

I'm mulling how best to address the charting behavior (and the Matplotlib bug) in the plugin, but this is a short-term workaround for those inclined to fix their own data.

I came here to drink milk and kick ass....and I've just finished my milk.

[My Plugins] - [My Forums]

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 1 guest