Пример #1
0
def point(latlon):
    """ Get data for lat lon """
    from grib import AirNowGrib

    lat, lon = latlon.split(',')

    a = AirNowGrib()
    response_data = a.data_latlon(float(lat), float(lon))
    if 'ozone' in response_data:
        response_data['combined'] = response_data['ozone'] if float(response_data['ozone']) > float(response_data['pm25']) else response_data['pm25']

    response = Response(json.dumps(response_data), status=200, mimetype='text/html')
    return response
Пример #2
0
    def run(self):
        a = AirNowGrib()
        #print(a.data_latlon(40.7762,-111.8786))
        #print(a.grid_xy(40.7762,-111.8786))
        #return

        #for param in (AirNowGrib.PM25, AirNowGrib.OZONE, AirNowGrib.FORECAST_TODAY, AirNowGrib.FORECAST_TOMORROW):
        for param in (AirNowGrib.PM25, AirNowGrib.OZONE):
            a.csv(param)
            a.process_csv(param)

        for param in (AirNowGrib.FORECAST_TODAY, AirNowGrib.FORECAST_TOMORROW):
            a.csv(param)
            a.process_csv(param, True)
Пример #3
0
    def run(self):

        # Download
        from an import Ftp
        f = Ftp()
        f.grib2_download()
        f.close

        # Convert to csv and process
        a = AirNowGrib()
        for param in (AirNowGrib.PM25, AirNowGrib.OZONE):
            a.csv(param)
            a.process_csv(param)

        for param in (AirNowGrib.FORECAST_TODAY, AirNowGrib.FORECAST_TOMORROW):
            a.csv(param)
            a.process_csv(param, True)