-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl_rename.m
54 lines (48 loc) · 1.78 KB
/
l_rename.m
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
function wlog=l_rename(wlog,varargin)
% Function replaces one or more curve mnemonics by new ones
% The function also works with structure arrays.
%
% Written by: E. R.: December 24, 2000
% Last updated: November 8, 2004: update also field "curve_types (if it exists).
%
% wlog=l_rename(wlog,varargin)
% INPUT
% wlog log structure or structure array
% varargin two-element cell arrays. The first element is a string representing an existing
% curve mnemonic, the second is the desired curve mnemonic. If S4M.case_sensitive == 0, the
% existing curve mnemonic is not case sensitive.
% OUTPUT
% wlog log structure or structure array with the new header mnemonics
%
% EXAMPLE
% wlog=l_rename(wlog,{'DT','DTP'},{'RHOB','rho'}) % Change 'DT' to 'DTP' and 'RHOB' to 'rho'
%
% See also function "l_curve" with "option" 'rename'
global S4M
for kk=1:length(wlog)
for ii=1:length(varargin)
mnems=varargin{ii};
if size(mnems) ~= 2
disp(mnems)
error(' Input arguments: old and new header mnemonic must be represented as a two-element cell')
end
idx=curve_index1(wlog(kk),mnems{1});
% Check if new mnemonic already exists
wlog(kk).curve_info(idx,1)=mnems(2);
wlog(kk).curve_info=description_substitution(wlog(kk).curve_info);
if isfield(wlog(kk),'curve_types')
if S4M.case_sensitive
idx=find(ismember(wlog(kk).curve_types(:,1),mnems{1}));
else
idx=find(ismember(lower(wlog(kk).curve_types(:,1)),lower(mnems{1})));
end
if ~isempty(idx)
wlog(kk).curve_types(idx,1)=mnems(2);
end
end
ier=l_check(wlog(kk));
if ier
alert('Possible inconsistency in the well log')
end
end
end