I basically adapted this code from the following project, https://github.com/sparkfun/Wimp_Weather_Station, so that the code for the follow product, https://www.sparkfun.com/products/8942, was implimented in a library.
This is distributed with a BSD license.