-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathl_itt2vel.m
96 lines (84 loc) · 3.17 KB
/
l_itt2vel.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
function wlog=l_itt2vel(wlog,typ,varargin)
% Compute P-velocity from the sonic curve; if a V-velocity curve already exists
% a message is printed to the command window and "wlog" is returned unchanged.
% To add an additional P-velocity give it a different name (see example below).
%
% Written by: E. Rietsch: April 16, 2006
% Last updated: February 20, 2010; Remove one of the "verbose" options
%
% wlog=l_itt2vel(wlog,typ,varargin)
% INPUT
% wlog log structure with a sonic curve
% typ string with type of interval transit time
% possible values are:
% 'sonic': sonic interval transit time to compressional velocity
% 'shear': shear interval transit time to shear velocity
% varargin new definitions of curve mnemonics of the form {'dtp','DTCO')
% By default, the function uses the mnemonics defined in global structure
% CURVES created in function "systemDefaults".
% 'verbose' specifies if an alert is to be issued if the log already has a
% velocity curve (i.e. if no conversion is performed).
% Possible values are: true ('yes') and false ('no').
% Default: {'verbose',true}
% The other possible "varargin" input can be re-definitions of
% curve mnemonics (see example below).
% OUTPUT
% wlog log structure with all input curves and Vp
%
% EXAMPLE
% wlog=l_data;
% wlog=l_itt2vel(wlog,'sonic',{'vp','new_vp'});
% l_curve(wlog);
% UPDATE HISTORY
% June 6, 2008: Add "verbose" option
% Set default of input argument
param.verbose=true;
% Replace default by actual input arguments
[param,cm]=l_assign_input(param,varargin);
switch lower(typ)
case 'sonic'
alert1=' Well log already has a P-velocity curve.';
alert2=' Log must have a P-sonic (DTp) curve.';
alert3=' Unknown units of sonic log: ';
alert4='Compressional velocity';
mnem4itt=cm.dtp;
mnem4vel=cm.vp;
vel='Vp';
veltype='compressional velocity';
case 'shear'
alert1=' Well log already has an S-velocity curve.';
alert2=' Log must have a shear-sonic (DTs) curve.';
alert3=' Unknown units of shear sonic log: ';
alert4='Shear velocity';
mnem4itt=cm.dts;
mnem4vel=cm.vs;
vel='Vs';
veltype='shear velocity';
otherwise
error(['Unknown type of interval transit time: "',typ,'"'])
end
% Check if log already has a P-velocity curve
[dummy,ier]=curve_index1(wlog,mnem4vel);
if ier == 0
if isyes(param.verbose)
alert(alert1)
end
return
end
[idtp,dummy]=curve_index1(wlog,mnem4itt); %#ok Second output argument influences internal processing
if isempty(idtp)
disp(alert2)
disp([' Curve mnemonics of log: ',cell2str(wlog.curve_info(:,1),', ')])
error(' Abnormal termination')
else
wlog.curves=[wlog.curves,1.0e6./wlog.curves(:,idtp)];
if strcmpi(wlog.curve_info{idtp,2},'us/m')
punits='m/s';
elseif strcmpi(wlog.curve_info{idtp,2},'us/ft')
punits='ft/s';
else
error([alert3,wlog.curve_info{idtp,2}])
end
wlog.curve_info=[wlog.curve_info;{mnem4vel,punits,alert4}];
wlog=add_curve_type(wlog,{mnem4vel,vel,veltype});
end