예제 #1
0
파일: ecl_cmp.py 프로젝트: Ensembles/ert
class EclCase(object):
    def __init__(self , case):
        self.case = case

        self.grid = None
        self.restart = None
        self.init = None
        self.summary = None
        
        self.loadSummary( )


    def __contains__(self , key):
        return key in self.summary

    
    def keys(self):
        return self.summary.keys()


    def wells(self):
        return self.summary.wells( )
            
    def loadSummary(self):
        self.summary = EclSum( self.case )


    def startTimeEqual(self , other):
        if self.summary.getDataStartTime() == other.summary.getDataStartTime():
            return True
        else:
            return False

    def endTimeEqual(self , other):
        if self.summary.getEndTime() == other.summary.getEndTime():
            return True
        else:
            return False


    def cmpSummaryVector(self , other , key , sample = 100):
        if key in self and key in other:
            days_total = min( self.summary.getSimulationLength() , other.summary.getSimulationLength() )
            dt = days_total / (sample - 1)
            days = [ x * dt for x in range(sample) ]
            
            ref_data = self.summary.get_interp_vector( key , days_list = days )
            test_data = other.summary.get_interp_vector( key , days_list = days )
            diff_data = ref_data - test_data

            ref_sum = sum(ref_data)
            diff_sum = sum( abs(diff_data) )
            return (diff_sum , ref_sum)
        else:
            raise KeyError("Key:%s was not present in both cases" % key)
예제 #2
0
파일: test_ecl_sum.py 프로젝트: agchitu/ert
 def test_labscale(self):
     case = self.createTestPath("Statoil/ECLIPSE/LabScale/HDMODEL")
     sum = EclSum( case )
     self.assertEqual( sum.getStartTime( ) , datetime.datetime(2013,1,1,0,0,0))
     self.assertEqual( sum.getEndTime( )   , datetime.datetime(2013,1,1,19,30,0))
     self.assertFloatEqual( sum.getSimulationLength() , 0.8125 )