def _load_airnow(self): """Load air quality data """ # Load ozone, pm25 import airnow from airnow.grib import AirNowGrib combined = None pm25 = None ozone = None today = None tomorrow = None if self.latitude and self.longitude: a = AirNowGrib() r = a.data_latlon(self.latitude, self.longitude) if r: if 'pm25' in r: pm25 = r['pm25'] combined = pm25 if 'ozone' in r: ozone = r['ozone'] if float(ozone) > float(pm25): combined = ozone if 'today' in r: today = r['today'] if 'tomorrow' in r: tomorrow = r['tomorrow'] self.combined = airnow.models.Aqi(combined) self.pm25 = airnow.models.Aqi(pm25) self.ozone = airnow.models.Aqi(ozone) self.today = airnow.models.Aqi(today) self.tomorrow = airnow.models.Aqi(tomorrow)
def grib_process_csv(param): from airnow.grib import AirNowGrib a = AirNowGrib() a.process_csv(param)