嗨!
我正在處理我數據集中14口井的各種岩石物理測井數據。記錄數據具有在不同間隔中識別的缺失值,並且我想以各種方式估算這些值以查看哪種技術最佳。我一直在使用“探索缺失值”面板來實現從一個存在數據的變量到同一個孔中缺少數據的另一個變量的插補(例如 井中的伽馬射線數據以50英尺的間隔丟失,但存在密度數據)。但是,如果我想在一個井中使用一個記錄變量來在相同的記錄變量中插入缺失值但在附近的另一個井中呢?例如,如果我在4000-6000英尺深處的一口井中有伽瑪射線數據而另一口井在5000-5800英尺深處缺少伽馬射線,我怎樣才能使用相同的變量(同一列)來估算缺失值不同的XY坐標?謝謝!
梅蘭妮
下面是通過將井口圍繞具有缺失值的井口並對其值進行平均,並將具有缺失值的井口設置為平均值來計算井口的值的示例。
Names Default To Here( 1 );
// Create a new table to use
dt = New Table( "Untitled 7",
Add Rows( 2500 ),
New Column( "x", Numeric, "Continuous", Format( "Best", 12 ), Set Display Width( 42 ) ),
New Column( "y", Numeric, "Continuous", Format( "Best", 12 ), Set Display Width( 83 ) ),
New Column( "data", Numeric, "Continuous", Format( "Best", 12 ), )
);
// Populate the data, leaving 2% missing data
theRow = 0;
For( i = 1, i <= 50, i++,
For( k = 1, k <= 50, k++,
theRow = theRow + 1;
:x[theRow] = i;
:y[theRow] = k;
If( Random Integer( 0, 100 ) <= 98,
:data[theRow] = Random Uniform( 800, 1000 ),
:data[theRow] = .;
write("\!nMissing value for row ", therow)
);
)
);
// Impute missing values by averaging the well heads around the missing value
For( theRow = 1, theRow <= N Rows( dt ), theRow++,
If( Is Missing( :data[theRow] ) == 1,
minX = :x[theRow] - 1;
If( minX < 1, minX = 1 );
maxX = :x[theRow] + 1;
If( maxX > 50, maxX = 50 );
minY = :y[theRow] - 1;
If( minY < 1, minY = 1 );
maxY = :y[theRow] + 1;
If( maxY > 50, maxY = 50 );
impute = 0;
count = 0;
For( i = minX, i <= maxX, i++,
For( k = minY, k <= maxY, k++,
theValue = dt:data[dt << get rows where( dt:x == i & dt:y == k )][1];
If( Is Missing( theValue ) == 0,
count
++);
impute = Sum( impute, theValue );
)
);
:Data[theRow] = impute / count;
)
);