本文整理汇总了Python中ert.util.IntVector.initRange方法的典型用法代码示例。如果您正苦于以下问题:Python IntVector.initRange方法的具体用法?Python IntVector.initRange怎么用?Python IntVector.initRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ert.util.IntVector
的用法示例。
在下文中一共展示了IntVector.initRange方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_scale_obs
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import initRange [as 别名]
def test_scale_obs(self):
with ErtTestContext("obs_test", self.config_file) as test_context:
ert = test_context.getErt()
obs = ert.getObservations()
obs1 = obs["WWCT:OP_1"].getNode( 50 )
obs2 = obs["WWCT:OP_1_50"].getNode( 50 )
self.assertEqual( obs1.getStandardDeviation( ) , obs2.getStandardDeviation( ))
std0 = obs1.getStandardDeviation( )
local_obsdata = LocalObsdata("obs" , obs)
node1 = LocalObsdataNode( "WWCT:OP_1" )
node1.addRange( 50 , 50 )
node2 = LocalObsdataNode( "WWCT:OP_1_50" )
node2.addRange( 50 , 50 )
local_obsdata.addNode( node1 )
local_obsdata.addNode( node2 )
mask = BoolVector( default_value = True )
mask[2] = True
meas_data = MeasData(mask)
obs_data = ObsData( )
fs = ert.getEnkfFsManager().getCurrentFileSystem()
active_list = IntVector()
active_list.initRange(0,2,1)
obs.getObservationAndMeasureData( fs , local_obsdata , EnkfStateType.FORECAST , active_list , meas_data , obs_data )
self.assertEqual( 2 , len(obs_data) )
v1 = obs_data[0]
v2 = obs_data[1]
self.assertEqual( v1[1] , std0 )
self.assertEqual( v2[1] , std0 )
meas_data = MeasData(mask)
obs_data = ObsData( 10 )
obs.getObservationAndMeasureData( fs , local_obsdata , EnkfStateType.FORECAST , active_list , meas_data , obs_data )
self.assertEqual( 2 , len(obs_data) )
v1 = obs_data[0]
v2 = obs_data[1]
self.assertEqual( v1[1] , std0*10)
self.assertEqual( v2[1] , std0*10 )
actl = ActiveList()
obs1.updateStdScaling( 10 , actl)
obs2.updateStdScaling( 20 , actl)
meas_data = MeasData(mask)
obs_data = ObsData( )
obs.getObservationAndMeasureData( fs , local_obsdata , EnkfStateType.FORECAST , active_list , meas_data , obs_data )
self.assertEqual( 2 , len(obs_data) )
v1 = obs_data[0]
v2 = obs_data[1]
self.assertEqual( v1[1] , std0*10)
self.assertEqual( v2[1] , std0*20)
示例2: test_range
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import initRange [as 别名]
def test_range(self):
v = IntVector( )
v[10] = 99
with self.assertRaises(ValueError):
v.initRange(1,2,0)
self.range_test(v , 0 , 5 , 1)
self.range_test(v , 0,100,3)
self.range_test(v,0,100,-3)
示例3: test_obs_block_scale_std
# 需要导入模块: from ert.util import IntVector [as 别名]
# 或者: from ert.util.IntVector import initRange [as 别名]
def test_obs_block_scale_std(self):
with ErtTestContext("obs_test_scale", self.config_file) as test_context:
ert = test_context.getErt()
fs = ert.getEnkfFsManager().getCurrentFileSystem()
active_list = IntVector( )
active_list.initRange(0 , ert.getEnsembleSize() , 1 )
obs = ert.getObservations()
obs_data = LocalObsdata( "OBSxx" , obs )
obs_vector = obs["WWCT:OP_1"]
obs_data.addObsVector( obs_vector )
scale_factor = obs.scaleCorrelatedStd( fs , obs_data , active_list )
for obs_node in obs_vector:
for index in range(len(obs_node)):
self.assertEqual( scale_factor , obs_node.getStdScaling( index ))