-
Notifications
You must be signed in to change notification settings - Fork 0
/
console-run.py
executable file
·94 lines (63 loc) · 2.18 KB
/
console-run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/python
from ea import ea
from ea.eaPoor import eaPoor
from penMon.pen_mclass import penm
class GetResults:
def runner(self):
'''This method will control
what is run
'''
print "Choose your action: Calculate Ea (a), Calculate Ea-Poor(b), Calculate Eto (c)"
decide=raw_input("")
if decide == 'c':
self.calculateEto()
elif decide == 'a':
self.calculateEa()
elif decide == 'b':
self.calculateEaPoor()
else:
print "Choose an appropriate letter"
def calculateEa(self):
'''This method will calculate the
ea when given the appropriate data
'''
print "You have selected Ea calculation"
tmax = float(raw_input("Insert Tmax: "))
tmin = float(raw_input("Insert Tmin: "))
rhmax = float(raw_input("Insert RHmax: "))
rhmin = float(raw_input("Insert RHmin: "))
eaCalculated=ea.ea(tmin,tmax,rhmin,rhmax)
print str(eaCalculated.calc_ea())
def calculateEaPoor(self):
'''This method will calculate the
ea poor when given the appropriate data
'''
print "You have selected EaPoor calculation"
tmax = float(raw_input("Insert Tmax: "))
tmin = float(raw_input("Insert Tmin: "))
rh = float(raw_input("Insert RH: "))
eaPoorCalculated=eaPoor(tmin,tmax,rh)
print eaPoorCalculated.calc_ea()
def calculateEto(self):
'''Method that calculates
the ETo given the arguments it requests
'''
print "You have selected Eto calculation"
tmax = float(raw_input("Insert Tmax: "))
tmin = float(raw_input("Insert Tmin: "))
ea = float(raw_input("Insert Ea: "))
speed= float(raw_input("Insert Air Speed: "))
monthNum= int(raw_input("Insert Month Number: "))
latDeg= int(raw_input("Insert Latitude Degrees: "))
latMin= int(raw_input("Insert Latitude Minutes: "))
monthlyAv= float(raw_input("Insert Monthly Average Temperature: "))
monthlyAvPrev= float(raw_input("Insert Previoud Monthly Average Temperature: "))
alt= float(raw_input("Insert Altitude: "))
sun= float(raw_input("Insert Sun Hours: "))
p=penm(tmax,tmin,ea,speed,15,monthNum,latDeg,latMin,monthlyAv,monthlyAvPrev,alt,sun)
print str(p.calculate())
def main():
a=GetResults()
a.runner()
if __name__ == '__main__':
main()