コード例 #1
0
 def handle(self, *args, **options):
     site_list = Site.objects.all()
     for site in site_list:
         self.stdout.write("Updating Predictions for %s" % site)
         self.stdout.write("Deleting previous Predictions")
         delete_weather(site)
         self.stdout.write("Getting new Weather Predictions")
         update_weather(site)
         site.last_weather_refresh = datetime.now()
         site.save()
コード例 #2
0
ファイル: site_check.py プロジェクト: SeanConnell/windwatchdb
    #if we find a good that's it, we're done looking because we report the best condition of the day
    #    if launching_condition == 'good':
    #        break #else we have fair
    #for landing_condition in launchability:
    #    if landing_condition == 'good':
    #        break 
    #Lookup overall resultant flyability of site based on launch/landing combos
    return flyability_dict

if __name__ == "__main__":
    from _update_weather import update_weather
    #Create a test site, save it, get weather for it, and run these functions on it
    test_site = Site(name="Test Site",lat="45.224007",lon="-123.97316",city="Pacific City",state="Oregon")
    test_site.save()
    test_launch = Launch(name="Test Launch West",site=test_site,flyable_wind_direction_min=0,flyable_wind_direction_max=360,flyable_wind_speed_max=50,flyable_wind_speed_min=0)
    test_launch.save()
    test_landing = Landing(name="Test Landing West",site=test_site,flyable_wind_speed_min=0,flyable_wind_speed_max=50,flyable_wind_direction_min=0,flyable_wind_direction_max=360)
    test_landing.save()
    test_wwq = WeatherWatchQueue(relevant_site=test_site)
    test_wwq.save()
    #update the wwq 
    update_weather(test_site)
    #we now have a legit site with a launch, landing, and weather queue. Test away!
    for day in DayOfWeather.objects.filter(weather_stream=test_wwq):
        print site_check(test_site,day)
    #cleanup the DB
    test_site.delete()
    test_launch.delete()
    test_landing.delete()
    test_wwq.delete()