-
Notifications
You must be signed in to change notification settings - Fork 0
/
Classes.py
78 lines (68 loc) · 2.57 KB
/
Classes.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
def extractData(CellPos,ws):
temp = []
for i in ws[CellPos][0]:
if i.value!=None:
temp.append(i.value)
else:
return temp
return temp
def ExtrapolateData(Data,Number):
try:
Average = sum(Data)/len(Data)
except ZeroDivisionError:
Average = 0
for i in range(Number-len(Data)):
Data.append(Average)
def Integral(Data):
Result = []
Sum = 0
for i in Data:
Sum+=float(i)
Result.append(Sum)
return Result
class field:
CurrentWaterExt = []
AccumCurrentWaterExt = []
YestWaterExt = []
YestAccumWaterExt = []
ws1 = []
ws2 = []
CurrentOilExt = []
AccumCurrentOilExt = []
YestOilExt = []
YestAccumOilExt = []
OilRelease = []
AccumOilRelease = []
YestOilRelease = []
YestAccumOilRelease = []
QuantityOfData = 0
def __init__(self,ws1_,ws2_):
self.ws1 = ws1_
self.ws2 = ws2_
def setAllCurrentData(self,CWE,COE,OR):
self.CurrentWaterExt = extractData(CWE,self.ws1)
ExtrapolateData(self.CurrentWaterExt,12)
self.AccumCurrentWaterExt = Integral(self.CurrentWaterExt)
self.CurrentOilExt = extractData(COE,self.ws2)
self.QuantityOfData = len(self.CurrentOilExt)
ExtrapolateData(self.CurrentOilExt,12)
self.AccumCurrentOilExt = Integral(self.CurrentOilExt)
self.OilRelease = extractData(OR,self.ws2)
ExtrapolateData(self.OilRelease,12)
self.AccumOilRelease = Integral(self.OilRelease)
def setYesterdayData(self,pos):
with open('jidkPred.txt') as f:
lines = f.read().splitlines()
self.YestWaterExt = lines[(12*(pos-1)):12*pos]
self.YestAccumWaterExt = Integral(self.YestWaterExt)
with open('neftPred.txt') as f:
lines = f.read().splitlines()
self.YestOilExt = lines[(12*(pos-1)):12*pos]
self.YestAccumOilExt = Integral(self.YestOilExt)
with open('sdachaPred.txt') as f:
lines = f.read().splitlines()
self.YestOilRelease = lines[(12*(pos-1)):12*pos]
self.YestAccumOilRelease = Integral(self.YestOilRelease)
def getListOfVariables(self):
return [self.CurrentWaterExt,self.AccumCurrentWaterExt,self.YestWaterExt,self.YestAccumWaterExt,self.CurrentOilExt,self.AccumCurrentOilExt,self.YestOilExt,self.YestAccumOilExt,
self.OilRelease,self.AccumOilRelease,self.YestOilRelease,self.YestAccumOilRelease]