dhhagan / py-openaq

Python wrapper for the Open AQ API
MIT License
63 stars 10 forks source link

Helper function for unit conversion #20

Closed dhhagan closed 6 years ago

dhhagan commented 6 years ago

Add a helper function to convert between ppb and ugm3 and viceversa for all common components (gases)

wjrholden commented 6 years ago

I would like to work on implementing this feature for you! :) I was doing a little bit of preliminary research and it appears that the OpenAQ measurements for the gases SO2, NO2, O3, CO, and BC (which I assume is benzene?) all have well-described conversion factors. I'm curious how PM25 and PM10 might also be easily converted considering their unknown composition and therefore unknown molecular weight?

dhhagan commented 6 years ago

Hey @wjrholden Great to hear! BC is Black Carbon, which is a component of particulate matter. Hopefully, PM25 and PM10 don't need to be converted, as it is pretty standard to report them in units of mass (microgram-cm3). However, many locations throughout Asia and Europe report the gases in units of mass as well, rather than as mixing ratios (ppb, ppm). While there are complicated ways to calculate the mixing ratio based on pressures, temperatures, etc, it should be pretty easy to just use the ideal gas law and assume atmospheric conditions. In doing so, there should be conversion factors for each gas to switch between mass units and mixing ratios. Let me know if you have any questions! This is a great resource as well.