import datetime
import time
import os
import  os.path
from datetime import datetime
    

now = datetime.now()



while True:

	f = open("gustspeed.txt", "r")
	gustspeed = (f.read())
	f.close
	print (gustspeed)

	gustspeed = (float(gustspeed))

	if gustspeed >= 0 and  gustspeed <=1:

		force = "zero"
		description = "Calm"
			
	elif gustspeed >= 1 and gustspeed <4:

		force = "1"
		description = ("Light Air")
		
	elif gustspeed >= 4 and gustspeed <8:

	        force = "2"
	        description = "Light Breeze"

	elif gustspeed >= 8 and gustspeed <=13:

	        force = "3" 
	        description = "Gentle Breeze"

	elif gustspeed >= 13 and gustspeed <19:
	 
	        force = "4" 
	        description = "Moderate Breeze"


	elif gustspeed >= 19 and gustspeed <25:

	        force = "5" 
	        description = "Fresh Breeze"

	elif gustspeed >= 25 and gustspeed <32:
	   
	        force = "6" 
	        description = "Strong Breeze"

	elif gustspeed >= 32 and gustspeed <39:

		force = "7"
		description =  "Moderate (fresh) Gale"

	elif gustspeed >= 39 and gustspeed <47:

	        force = "8" 
	        description = "Fresh Gale"

	elif gustspeed >= 47 and gustspeed <=55:
	   
	        force = "9" 
	        description = "Strong Gale"

	elif gustspeed >= 55 and gustspeed <64:

	        force = "10" 
	        description = "Storm"

	elif gustspeed >= 64 and gustspeed <73:

	        force = "11" 
	        description = "Violent Storm"

	elif gustspeed >= 73:

	        force = "12" 
	        description = "Hurricane"
		
	else:
	        print ("v windy")


	gustspeed = (str(gustspeed))
	 
	print("force ", force)
	print("description ", description)

	f = open("beaufortnumbergust.txt", "w")
	f.write(force)
	f.close()


	f = open("beaufortdescriptiongust.txt", "w")
	f.write(description)
	f.close()

	f = open("gustspeed.txt", "w")
	f.write(gustspeed)
	f.close()
	
	time.sleep(2)
