How to use the eeweather.exceptions.UnrecognizedUSAFIDError function in eeweather

To help you get started, we’ve selected a few eeweather examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opentaps / opentaps_seas / scripts / import_weather_histories.py View on Github external
def import_data(which):
    print('Importing {} data...'.format(which))

    for meter in Meter.objects.values('weather_station').distinct():
        try:
            weather_station = WeatherStation.objects.get(weather_station_id=meter['weather_station'])
        except WeatherStation.DoesNotExist:
            print("-- Cannot find weather station: {}".format(meter['weather_station']))
        else:
            print('Importing data for {}'.format(weather_station.station_name))
            try:
                get_weather_history_for_station(weather_station, 30)
            except (UnrecognizedUSAFIDError, ISDDataNotAvailableError):
                print("-- Cannot get history for weatherstation: {}".format(weather_station.station_name))