コード例 #1
0
    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)
コード例 #2
0
ファイル: models.py プロジェクト: jonstjohn/air-canary-web
    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)
コード例 #3
0
def grib_process_csv(param):
    from airnow.grib import AirNowGrib
    a = AirNowGrib()
    a.process_csv(param)
コード例 #4
0
ファイル: tasks.py プロジェクト: jonstjohn/air-canary-web
def grib_process_csv(param):
    from airnow.grib import AirNowGrib

    a = AirNowGrib()
    a.process_csv(param)