def makeDepthPressureTemperatureData(self): if self.finalData is None: return s1 = self.finalData.iloc[:, 4] s1.dropna(inplace=True, how='all') s2, s3 = pd.Series(), pd.Series() PresDF = self.finalData.iloc[:, [0, 1]] TemperDF = self.finalData.iloc[:, [0, 2]] for i in range(s1.size): s2 = s2.append(pd.Series([ Other.searchAndInterpolate(PresDF, self.finalData.iloc[i, 3]) ]), ignore_index=True) s3 = s3.append(pd.Series([ Other.searchAndInterpolate(TemperDF, self.finalData.iloc[i, 3]) ]), ignore_index=True) self.depthPressureTemperatureData = pd.concat([s1, s2, s3], axis=1)
def preciseCalcStaticLevel(self, referencePoint): lowBound = int(max(1, referencePoint - 50)) highBound = int(min(self.maxDepth, referencePoint + 50)) if self.tableInd == 0: tempDF11 = self.finalData.iloc[:self.centralDots[1], [4, 3]] tempDF22 = self.finalData.iloc[:self.centralDots[0], [0, 1]] else: tempDF11 = self.finalData.iloc[self.centralDots[1]:, [4, 3]] tempDF22 = self.finalData.iloc[self.centralDots[0]:, [0, 1]] tempDF1 = tempDF11.dropna(how='all') tempDF2 = tempDF22.dropna(how='all') prevPres = 9000 for i in range(lowBound, highBound): timeDepth = Other.searchAndInterpolate(tempDF1, i) newPres = Other.searchAndInterpolate(tempDF2, timeDepth) if (newPres - prevPres) * 10 > 0.7: return i else: prevPres = newPres return referencePoint
def supportDots(self, data, interval): depth = [] elongation = [] pressure = [] temperature = [] time = [] for shelf in data: tempDepths = [] tempElongations = [] tempPressures = [] tempTemperatures = [] tempTimes = [] maxDepth = int(max(shelf.iloc[:, 4])) minDepth = int(max(min(shelf.iloc[:, 4]), 0)) for depthI in range(minDepth, maxDepth): if depthI % interval == 0 and (maxDepth - depthI) > 30: tempDepths.append(depthI) # глубины tempElongations.append( round(Other.searchAndInterpolate(self.incl, depthI), 2)) # удлинения searchArray = shelf.iloc[:, [4, 3]] # давления searchArray.dropna(inplace=True, how='all') tempTime = Other.searchAndInterpolate(searchArray, depthI) tempTimes.append(tempTime) searchArray = shelf.iloc[:, [0, 1]] searchArray.dropna(inplace=True, how='all') tempPressures.append( round( Other.searchAndInterpolate(searchArray, tempTime), 2)) searchArray = shelf.iloc[:, [0, 2]] # температуры searchArray.dropna(inplace=True, how='all') tempTemperatures.append( round( Other.searchAndInterpolate(searchArray, tempTime), 2)) tempDepths.append(maxDepth) # глубины depth.append(tempDepths) tempElongations.append( round(Other.searchAndInterpolate(self.incl, maxDepth), 2)) # удлинения elongation.append(tempElongations) # давления searchArray = shelf.iloc[:, [4, 3]] searchArray.dropna(inplace=True, how='all') tempTime = Other.searchAndInterpolate(searchArray, maxDepth) searchArray = shelf.iloc[:, [0, 1]] searchArray.dropna(inplace=True, how='all') tempPressures.append( round(Other.searchAndInterpolate(searchArray, tempTime), 2)) pressure.append(tempPressures) # температуры searchArray = shelf.iloc[:, [0, 2]] searchArray.dropna(inplace=True, how='all') tempTemperatures.append( round(Other.searchAndInterpolate(searchArray, tempTime), 2)) temperature.append(tempTemperatures) tempTimes.append(tempTime) time.append(tempTimes) return depth, elongation, pressure, temperature, time
def getWellParams(self): def sqlBed(bedID): with Other.sqlQuery() as connection: cursor = connection.cursor() cursor.execute( '''SELECT ots_bn.sosbed.bedname from ots_bn.sosbed WHERE ots_bn.sosbed.bedid = :bedid''', bedid=bedID) row = cursor.fetchone() return row[0] with Other.sqlQuery() as connection: cursor = connection.cursor() cursor.execute( '''SELECT ots_bn.sosperforation.PRFPERFORATEDZONETOP, ots_bn.sosperforation.PRFBEDID from ots_bn.sosperforation WHERE ots_bn.sosperforation.prfwellid = :wellid''', wellid=self.otsWellID) rows = cursor.fetchall() rows.sort() self.vdp = rows[0][0] self.layersIDs = [i[1] for i in rows] layer = [sqlBed(i[1]) for i in rows] self.layer = set(layer) cursor.execute('''SELECT ots_bn.soswell.WELANGULARITYTESTDEPTH, ots_bn.soswell.WELANGULARITYTESTELONGATION, ots_bn.soswell.welorganizationid, ots_bn.soswell.welfieldid, ots_bn.soswell.WELALTITUDE from ots_bn.soswell WHERE ots_bn.soswell.welid = :wellid''', wellid=self.otsWellID) rows = cursor.fetchone() self.tzehID = rows[2] self.otsFieldID = rows[3] self.altitude = rows[4] try: bytesLen = int.from_bytes(rows[0].read()[3:7], byteorder=byteorder) depth = pd.Series( np.frombuffer(pylzma.decompress(rows[0].read()[7:], maxlength=bytesLen), dtype=np.dtype('f'))) if len(depth) == 0: raise except: try: depth = pd.Series( np.frombuffer(rows[0].read()[3:], dtype=np.dtype('f'))) except: depth = pd.Series([0., 0.]) try: bytesLen = int.from_bytes(rows[1].read()[3:7], byteorder=byteorder) elong = pd.Series( np.frombuffer(pylzma.decompress(rows[1].read()[7:], maxlength=bytesLen), dtype=np.dtype('f'))) if len(elong) == 0: raise except: try: elong = pd.Series( np.frombuffer(rows[1].read()[3:], dtype=np.dtype('f'))) except: elong = pd.Series([0., 0.]) self.incl = pd.concat([depth, elong], axis=1) self.vdpElong = round( Other.searchAndInterpolate(self.incl, self.vdp), 2) tempPressureTimeSeries = self.data.iloc[:, 0] tempPressureTimeSeries.dropna(inplace=True) self.researchDate = str( tempPressureTimeSeries[len(tempPressureTimeSeries) // 2])[:10] self.resMid = tempPressureTimeSeries[len(tempPressureTimeSeries) // 2] self.firstMeasureDatetime = tempPressureTimeSeries.iloc[0] self.lastMeasureDatetime = tempPressureTimeSeries.iloc[-1] self.tpID = dict_suborg[self.tzehID] self.maxDepth = self.data.iloc[:, 4].max() self.discretMan = round( (self.data.iloc[1, 0] - self.data.iloc[0, 0]).total_seconds(), 0) self.discretSPS = round( (self.data.iloc[1, 3] - self.data.iloc[0, 3]).total_seconds(), 0)