📄 lascreator.m
字号:
function dataout=lascreator(arg1,arg2,arg3,arg4);
%-------------------------------
%--------- Las Creator ---------
%-------------------------------
%
% lascreator
% dataout=lascreator(Anything);
%
% LASCREATOR allows users to create their own VS, VP and density well logs.
% The VS and VP is converted to slowness when saving to exporting the
% created file. Future releases may include more properties able to be
% exported. Exported files are Version 2.0 LAS files.
%
% LASCREATOR can be called in two ways. Simply typing lascreator will pop
% up the lascretor figure allowing for las files to be created and saved.
% The second way is to add a string or number as the the only arguement in
% to the routine. This last way is best used in conjuction with other
% programs and utilizes. This way uses uiwait and releases dataout in the
% following way.
%
% dataout={lasheader logdata};
%
% C.B. Harrison 2003
%
% NOTE: It is illegal for you to use this software for a purpose other
% than non-profit education or research UNLESS you are employed by a CREWES
% Project sponsor. By using this software, you are agreeing to the terms
% detailed in this software's Matlab source file.
if(nargin<1)
action='init';
elseif(nargin==1)
action='two';
elseif(nargin==2)
action='init';
elseif(nargin==3)
action='init';
end
switch action
case 'init'
lascreator_figure_init;
controlout=lascreator_datacheck; % checking data
case 'two'
lascreator_figure_init('EXPORT');
controlout=lascreator_datacheck; % checking data
uiwait;
% Pulling data out
h=get(gcf,'userdata');
if(~isstruct(h))
return
end
LayerData=getfield(h,'Data');
GeneralData=getfield(h,'GeneralData');
BlockHandles=getfield(h,'BlockHandles');
BlockButtons=getfield(h,'BlockButtons');
FigureHandles=getfield(h,'FigureHandles');
hmsg=getfield(FigureHandles,'Message');
%--------------------------------------
hSend=getfield(FigureHandles,'Save');
dataout=get(hSend,'userdata');
dataout={dataout{2} dataout{3}};
delete(gcf);
case 'three'
case 'four'
end
function lascreator_figure_init(hObject, eventdata, handles)
% this was a guide generated code with modifications made
hfig=figcent(811,570,'pixels');
set(hfig,...
'Name','LAS Creator',...
'menu','none','numbertitle','off',...
'closerequestfcn',@lascreator_cancel,'units','normalized',...
'windowbuttondownfcn','');
cmenu=uicontextmenu;
haxes = axes(...
'Color',get(0,'defaultaxesColor'),...
'Position',[0.5881 0.1192 0.4069 0.7894],...
'Tag','axes1','xtick',[],'ytick',[]);
title('Well Log');
ylabel('Depth');
flipy;
hold;
% Message Handle
%----------------
hmsg = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0 0 1 0.0350],...
'String','Figure Message Bar',...
'Style','text',...
'Tag','text3');
% Main Figure Applications
%--------------------------
hmainbacking = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.5019 0.5019 0.5019],...
'Position',[.402 0.114 0.1 0.679],...
'String',{ 'Layer Controls' },'tooltipstring','',...
'Style','text',...
'foregroundcolor',[1 1 1],...
'userdata',[1]);
hMainUpDate = uicontrol(...
'Units','normalized','position',[.408 .723 .086 .04],...
'Callback',@lascreator_datacheck,'string','Update',...
'tooltipstring','Updating will occure when any action is taken');
hMainHiddenData = uicontrol(...
'Units','normalized','position',[.408 .677 .086 .04],...
'Callback',@lascreator_gcfcontextmenu,'string','Hidden Data',...
'tooltipstring','Edit Company, Field, Service, Country, ZStep, KB, UWID');
hMainScrollText = uicontrol('style','text',...
'Units','normalized','position',[.402 .611 .1 .026],...
'string','Scroll Layers');
hMainOneUp = uicontrol(...
'Units','normalized','position',[.408 .561 .086 .04],...
'Callback',@lascreator_master_move,'string','Up','userdata',{'oneup' 1});
hMainOneDown = uicontrol(...
'Units','normalized','position',[.408 .511 .086 .04],...
'Callback',@lascreator_master_move,'string','Down','userdata',{'onedown' 1});
hmainreset = uicontrol(...
'Units','normalized','position',[.408 .123 .086 .04],...
'Callback',@lascreator_master_reset,'string','Reset All','userdata',[]);
% checking number of arguments, if there is one agrument, that means
% lascreator is being called from another program or routine so instead
if(nargin==1)
snd='Done';
vis='on';
exp=[1];
else
snd='Save';
vis='off';
exp=[2];
end
set(hfig,'uicontextmenu',cmenu)
m1=uimenu(cmenu,'label','Change Hidden Data','callback',@lascreator_gcfcontextmenu);
m1=uimenu(cmenu,'label',snd,'callback',@lascreator_save,'separator','on');
m1=uimenu(cmenu,'label','Cancel','callback',@lascreator_cancel,'visible',vis);
hSend = uicontrol(...
'Units','normalized',...
'Callback',@lascreator_save,...
'Position',[0.2207 0.0385 0.1331 0.0438],...
'String',snd,...
'Tag','pushbutton2','userdata',{exp [] []});
hCancel = uicontrol(...
'Units','normalized',...
'Callback',@lascreator_cancel,...
'Position',[0.3834 0.0385 0.1331 0.0438],...
'String','Cancel',...
'Tag','pushbutton3','userdata',[1],...
'visible',vis);
FigureHandles.Axes=haxes;
FigureHandles.Message=hmsg;
FigureHandles.OneUp=hMainOneUp;
FigureHandles.OneDown=hMainOneDown;
FigureHandles.Save=hSend;
FigureHandles.Cancel=hCancel;
% General Las Info
%-------------------
hWellName = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 0.5019 0],...
'Position',[0.0308 0.9543 0.1541 0.0368],...
'String','Well Name',...
'Style','text',...
'Tag','text4');
hWellNameData = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1948 0.9543 0.2983 0.0368],...
'String','',...
'Style','edit',...
'Tag','edit1');
hLocation = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 0.5019 0],...
'Position',[0.0308 0.9087 0.1541 0.0368],...
'String','Location',...
'Style','text',...
'Tag','text5');
hLocationData = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1948 0.9070 0.2983 0.0368],...
'String','',...
'Style','edit',...
'Tag','edit2');
hDepthUnits = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 0.5019 0],...
'Position',[0.0320 0.8666 0.0912 0.0333],...
'String','Depth Units',...
'Style','text',...
'Tag','text6');
hDepthUnitsData = uicontrol(...
'Units','normalized',...
'Callback',@lascreator_general_buttons,...
'Position',[0.1319 0.8596 0.1146 0.0438],...
'String',{ 'Meters' 'Feet' 'Seconds' },...
'Style','popupmenu','userdata',[1],...
'Value',1,...
'Tag','popupmenu1');
hNullValue= uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 0.5019 0],...
'Position',[0.0320 0.8210 0.09129 0.0333],...
'String','Null Value',...
'Style','text',...
'Tag','text7');
hNullValueData = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1331 0.8210 0.0912 0.0333],...
'String','-999.25',...
'Style','edit',...
'Tag','text8');
hDensity = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 0.5019 0],...
'Position',[0.2577 0.8649 0.0912 0.0333],...
'String','Density Units',...
'Style','text',...
'Tag','text30');
hDensityUnits = uicontrol(...
'Units','normalized',...
'Callback',@lascreator_general_buttons,...
'Position',[0.3551 0.8578 0.1146 0.0438],...
'String',{ 'RHOB' 'RHGF' 'RHGA' 'PHID' 'DPHI' 'DPSS' },...
'Style','popupmenu','userdata',[2],...
'Value',1,...
'Tag','popupmenu2');
GeneralData.Name=hWellNameData;
GeneralData.Location=hLocationData;
GeneralData.DepthUnits=hDepthUnitsData;
GeneralData.NullValue=hNullValueData;
GeneralData.DensityUnits=hDensityUnits;
% SendData is to identify what data is being saved or exported, this also
% identifies the headers of the block data. Expansion here to identify new
% data to be exported
GeneralData.SendData={'Depth' 'Vp' 'Vs' 'Density'};
% This data is telling LASCREATOR what the files are goign to be when
% saving to the las header. The blank values show that the export is
% dependant on a unit that is controled with either presently in general
% data or somehwere else inthe future
GeneralData.LASHeaders={'VP' 'VS' []};
% MiscPull is the field names of data that is included in the exported las
% file but not intergral to the LASCREATOR. This data can be accessed
% using the contextmenu of the figure. There are 5 sections described
% belew that are integral
FieldNames={'Company' 'Field' 'Service' 'Country' 'ZStep' 'KB' 'UWID'};
MiscPull.FieldNames=FieldNames;
% The Field names in GeneralData where data is going ot be stored
defaultdat={'Unspecified Company' 'Unspecified Field' 'Unspecified Service Company',...
'Unspecified Country' {'1' '1' '0.01'} '0' '1000001'};
MiscPull.Default=defaultdat;
% Defailt data for when all data is reset by user. Any data that changes
% due to unit changes (depth) needs to have a number of default values
% equal to the number of different depth units. Only 3 at this point
MiscPull.Questions={'Company' 'Field' 'Service Company' 'Country' 'Depth Step (numeric)',...
'Height of Kelly Bushing (numeric)' 'Unique Well ID'};
% Questions to be asked when changing values for askthingsle
MiscPull.AskFlags=[0 0 0 0 1 1 0];
% Flags for askthingsle, see askthingsle for details
MiscPull.Flags=[0 0 0 0 2 2 0];
% Flags for checking data user has finialzed after askthingle has kicked
% in. 0 - Optional Anything 1 - NOT Optional Anything 2 - NOT OPT Number
MiscPull.LasID={'cm' 'fld' 'srv' 'ctr' 'zstep' 'kb' 'uwid'};
% las IDs, this is higly important because they have to match the ones
% recognized by
GeneralData.MiscPull=MiscPull;
% adding to these will allow for more properties to edited.
% the following is creating GeneralData Info
for ii=1:size(FieldNames,2)
dat=defaultdat{ii};
if(iscell(dat))
% this is getting the default unit value
dat=dat{1};
end
GeneralData=setfield(GeneralData,FieldNames{ii},dat);
end
% generalize col
col=[0.8 0.8 0.8];
%----------------------------
%---------- BLOCK1 ----------
%----------------------------
%
% Block Uicontrol
%-----------------
cmenu=uicontextmenu;
m1=uimenu(cmenu,'label','Block 1');
m1=uimenu(cmenu,'label','Shift Data:','separator','on');
m2=uimenu(m1,'label','Up','callback',@lascreator_block_controls,'userdata',[1]);
m2=uimenu(m1,'label','Down','callback',@lascreator_block_controls,'userdata',[1]);
% m2=uimenu(m1,'label','Choose','callback',@lascreator_block_controls,'userdata',[1]);
m1=uimenu(cmenu,'label','Clear Layer','callback',@lascreator_block_controls,'userdata',[1]);
m1=uimenu(cmenu,'label','Delete Layer','callback',@lascreator_block_controls,'userdata',[1]);
m1=uimenu(cmenu,'label','Insert Layer:');
m2=uimenu(m1,'label','Above','callback',@lascreator_block_controls,'userdata',[1]);
m2=uimenu(m1,'label','Below','callback',@lascreator_block_controls,'userdata',[1]);
% Block Buttons
%---------------
hbacking = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.5019 0.5019 0.5019],...
'Position',[0.0123 0.6385 0.385 0.1736],...
'String',{ '' },'tooltipstring','Use mouse button two to activate block buttons.',...
'Style','frame',...
'userdata',[1],'uicontextmenu',cmenu);
hslide = uicontrol(...
'Units','normalized',...
'Callback',@lascreator_layer_slider,...
'Position',[0.3785 0.6403 0.0135 0.1701],...
'String',{ '' },...
'Style','slider',...
'Tag','slider2',...
'UserData',1,...
'Visible','off','uicontextmenu',cmenu);
BlockButtons1.Slide=hslide;
BlockButtons1.Backing=hbacking;
% Block Handles
%---------------
hLayerNumber = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.01602 0.7719 0.0690 0.0333],...
'String','Layer: 1',...
'Style','text',...
'Tag','edit5','uicontextmenu',cmenu);
hLayerName = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.0900 0.7719 0.0850 0.0350],...
'String','',...
'Style','edit',...
'Tag','text1','uicontextmenu',cmenu);
hQuickInfo = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.0147 0.6421 0.1639 0.1245],...
'String',{ '0-1000 Meters' 'Vp: Vs:' 'Density:' },...
'Style','text',...
'Tag','text2','uicontextmenu',cmenu);
hheader1 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[0.8 0.8 0.8],...
'Position',[0.1849 0.7649 0.0924 0.0315],...
'String','Depth',...
'Style','text',...
'Tag','text16','uicontextmenu',cmenu);
hdata1 = uicontrol(...
'Units','normalized',...
'BackgroundColor',[1 1 1],...
'Position',[0.1849 0.7280 0.0924 0.0315],...
'String','',...
'Style','edit',...
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -