📄 lascreator.m
字号:
if(isinf(checkcol(kk))|isnan(checkcol(kk)))
col1=0.8;
col2=0.8;
col3=0.8;
break
end
end
catch
col1=0.8;
col2=0.8;
col3=0.8;
end
end
col=[col1 col2 col3];
set(hLayerNumber,'string',['Layer: ' num2str(nm+ii-1)],'backgroundcolor',col);
set(hLayerName,'string',nam);
set(hdata1,'string',num2str(dep));
set(hdata2,'string',num2str(Vp));
set(hdata3,'string',num2str(Vs));
set(hdata4,'string',num2str(den));
x1=[num2str(dep) ' ' depthunit{1}];
x2=['Vp: ' num2str(Vp) ' Vs: ' num2str(Vs)];
x3=['Density: ' num2str(den)];
set(hQuickInfo,'string',{x1;x2;x3},'backgroundcolor',col);
set(hheader1,'backgroundcolor',col);
set(hheader2,'backgroundcolor',col);
set(hheader3,'backgroundcolor',col);
set(hheader4,'backgroundcolor',col);
end
nms=fieldnames(LayerData);
for ii=val:val+3
end
% Saving data
dat=get(hMainOneUp,'userdata');
dat{2}=udat{2};
set(hMainOneUp,'userdata',dat);
dat=get(hMainOneDown,'userdata');
dat{2}=udat{2};
set(hMainOneDown,'userdata',dat);
AllInfo.Data=LayerData;
AllInfo.GeneralData=GeneralData;
AllInfo.BlockHandles=BlockHandles;
AllInfo.BlockButtons=BlockButtons;
AllInfo.FigureHandles=FigureHandles;
set(gcf,'userdata',AllInfo);
lascreator_plot;
%------------------------
%----- MASTER RESET -----
%------------------------
%
% This routine is resetting all block data to empty strings as well as
% clearing all stored data. A question is of course possed before clearing
% all data is done.
function lascreator_master_reset(hObject, eventdata, handles)
% -------------
% Pulling data out
h=get(gcf,'userdata');
LayerData=getfield(h,'Data');
GeneralData=getfield(h,'GeneralData');
BlockHandles=getfield(h,'BlockHandles');
BlockButtons=getfield(h,'BlockButtons');
FigureHandles=getfield(h,'FigureHandles');
MiscPull=getfield(GeneralData,'MiscPull');
hmsg=getfield(FigureHandles,'Message');
hMainOneUp=getfield(FigureHandles,'OneUp');
hMainOneDown=getfield(FigureHandles,'OneDown');
% -----------
stringinfo='Clear and reset all layer data?';
set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
welldat=getfield(GeneralData,'Name');
wellname=get(welldat,'string');
% Checking name to see if testing.
if(findstr(wellname,'LASTEST:'))
addon='LASTEST ';
else
addon='Reseting data ';
% checking data
controlout=lascreator_datacheck;
end
qststring={[addon ' will reset all general well log info'],...
'as well clear all layer data.',...
'Do you want to continue?'};
button = questdlg(qststring,'Reset?','Continue','Cancel','Continue');
switch button
case 'Continue'
case 'Cancel'
stringinfo='Action canceled';
set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
return
end
LayerData=[];
% creating structure for data
% layer zero is a template for all subsuquent layers and for future layers
defaultlayersource={'LayerNumber' 'LayerName' 'Depth' 'DepthUnit' 'Vp' 'VpUnit',...
'Vs' 'VsUnit' 'Density' 'DensityUnit'};
defaultlayerdata={0 [] [] [] [] [] [] [] [] [] };
Layer0=[];
for ii=1:length(defaultlayersource)
% this is creating the default layer zero
Layer0=setfield(Layer0,defaultlayersource{ii},defaultlayerdata{ii});
end
LayerData=[];
for ii=1:5
% this is putting Layers into LayerData, with Layer0 at the start
newlayername=['Layer' num2str(ii-1)];
Layer0=setfield(Layer0,'LayerNumber',[ii-1]);
LayerData=setfield(LayerData,['Layer' num2str(ii-1)],Layer0);
end
% reseting general data
rot1={'Name' 'Location' 'DepthUnits' 'NullValue' 'DensityUnits'};
dep={ 'Meters' 'Feet' 'Seconds' };
den={ 'RHOB' 'RHGF' 'RHGA' 'PHID' 'DPHI' 'DPSS' };
rot2={'' '' dep '-999.25' den};
for ii=1:size(rot1,2)
rot1name=rot1{ii};
hndle=getfield(GeneralData,rot1name);
rot2name=rot2{ii};
set(hndle,'string',rot2{ii},'value',1);
end
fnames=getfield(MiscPull,'FieldNames');
dfault=getfield(MiscPull,'Default');
for ii=1:size(fnames,2)
df=dfault{ii};
checkdf=1;
while checkdf==1
if(iscell(df))
df=df{1};
else
checkdf=0;
end
end
GeneralData=setfield(GeneralData,fnames{ii},df);
end
% reseting all block handles
for ii=1:4
% getting blocks
blockst=getfield(BlockHandles,['Block' num2str(ii)]);
rot1={'Number' 'Name' 'Info'};
rot2={'hLayerNumber' 'hLayerName' 'hQuickInfo'};
x1=[' Meters'];
x2=['Vp: ' ' Vs: '];
x3=['Density: '];
x4={x1 x2 x3};
lay=['Layer: ' num2str(ii)];
rot3={lay '' {x1 x2 x3}};
rot4={[.8 .8 .8] [1 1 1] [.8 .8 .8]};
for jj=1:size(rot1,2)
rotdataset=getfield(blockst,rot1{jj});
set(rotdataset,'string',rot3{jj},'backgroundcolor',rot4{jj});
end
rot5=getfield(GeneralData,'SendData');
for jj=1:4
hheaderget=getfield(blockst,['Header' num2str(jj)]);
hdataget=getfield(blockst,['Data' num2str(jj)]);
set(hheaderget,'string',rot5{jj},'backgroundcolor',[.8 .8 .8]);
set(hdataget,'string',[],'backgroundcolor',[1 1 1]);
end
end
stringinfo='Data has been reset and cleared';
set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
% almost forgot to clear gca
cla;
% Saving data
AllInfo.Data=LayerData;
AllInfo.GeneralData=GeneralData;
AllInfo.BlockHandles=BlockHandles;
AllInfo.BlockButtons=BlockButtons;
AllInfo.FigureHandles=FigureHandles;
set(gcf,'userdata',AllInfo);
% -----------
%---------------------------
%----- GENERAL BUTTONS -----
%---------------------------
%
% This routine at present is only responsible for two buttons, those being
% the depth units and density units.
function lascreator_general_buttons(hObject, eventdata, handles)
% checking data
controlout=lascreator_datacheck;
% -------------
% Pulling data out
h=get(gcf,'userdata');
LayerData=getfield(h,'Data');
GeneralData=getfield(h,'GeneralData');
BlockHandles=getfield(h,'BlockHandles');
BlockButtons=getfield(h,'BlockButtons');
FigureHandles=getfield(h,'FigureHandles');
hmsg=getfield(FigureHandles,'Message');
hMainOneUp=getfield(FigureHandles,'OneUp');
hMainOneDown=getfield(FigureHandles,'OneDown');
% -----------
dat=get(gcbo,'userdata');
val=get(gcbo,'value');
str=get(gcbo,'string');
str=str{val};
col=[1 1 1];
if(dat==2)
stringinfo=['Density units have been changed to ' str '. Please ensure layer values are correct.'];
elseif(dat==1)
stringinfo=['Depth units have been changed to ' str '. Please ensure layer values are correct.'];
% if depth is changed, need to set kelly bushing and zstep to default for
% respective depth units
MiscPull=getfield(GeneralData,'MiscPull');
fnames=getfield(MiscPull,'FieldNames');
default=getfield(MiscPull,'Default');
% any celled default data needs changing due to change in depth units
for ii=1:size(fnames,2)
checkdefault=default{ii};
if(iscell(checkdefault))
switch str
case 'Meters'
dat=checkdefault{1};
case 'Feet'
dat=checkdefault{2};
case 'Seconds'
dat=checkdefault{3};
end
GeneralData=setfield(GeneralData,fnames{ii},dat);
end
end
else
strinfinfo='Something is wrong';
col=[1 1 0];
end
set(hmsg,'string',stringinfo,'backgroundcolor',col);
% Saving data
AllInfo.Data=LayerData;
AllInfo.GeneralData=GeneralData;
AllInfo.BlockHandles=BlockHandles;
AllInfo.BlockButtons=BlockButtons;
AllInfo.FigureHandles=FigureHandles;
set(gcf,'userdata',AllInfo);
% -----------
%----------------------------
%---- SAVE / EXPORT LAS -----
%----------------------------
%
% This routine is called both when saveing or exporting data. When saving
% routine simply asks where the user wants to save LAS data. Export is
% mainly used inconjuction with other programs and uses uiresume to allow
% for data to be sent out.
function lascreator_save(hObject, eventdata, handles)
% checking data
controlout=lascreator_datacheck;
% -------------
% Pulling data out
h=get(gcf,'userdata');
LayerData=getfield(h,'Data');
GeneralData=getfield(h,'GeneralData');
BlockHandles=getfield(h,'BlockHandles');
BlockButtons=getfield(h,'BlockButtons');
FigureHandles=getfield(h,'FigureHandles');
hmsg=getfield(FigureHandles,'Message');
hMainOneUp=getfield(FigureHandles,'OneUp');
hMainOneDown=getfield(FigureHandles,'OneDown');
% -----------
if(controlout{2}==1)
% saving or exporting will not occure if something is not right with
% the data.
stringinfo=[controlout{1} ' before saving can continue.'];
col=[1 1 0];
set(hmsg,'string',stringinfo,'backgroundcolor',col);
return
end
% General Data
welldat=getfield(GeneralData,'Name');
wellname=get(welldat,'string');
locdat=getfield(GeneralData,'Location');
lc=get(locdat,'string');
nuldat=getfield(GeneralData,'NullValue');
nullval=get(nuldat,'string');
unitdat=getfield(GeneralData,'DepthUnits');
val=get(unitdat,'value');
units=get(unitdat,'string');
units=units(1,1);
den=getfield(GeneralData,'DensityUnits');
val=get(den,'value');
den=get(den,'string');
den=den(1,1);
logtypes=getfield(GeneralData,'LASHeaders');
logtypes{3}=den{1};
rot1=getfield(GeneralData,'SendData');
datapull=lascreator_datapull;
rot2=datapull{1};
topnames=datapull{2};
ztops=datapull{3};
holdat1=rot2{1};
if(isempty(holdat1))
exp=get(gcbo,'string');
stringinfo=['There is no data to be ' exp 'ed.'];
set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 0]);
return
end
zstart=holdat1(1);
zend=holdat1(end);
zstep=getfield(GeneralData,'ZStep');
if(ischar(zstep))
zstep=str2num(zstep);
end
% acquiring
MiscPull=getfield(GeneralData,'MiscPull');
fnames=getfield(MiscPull,'FieldNames');
LasID=getfield(MiscPull,'LasID');
% setting structure
exportstruct=struct;
for ii=1:size(fnames,2)
dat=getfield(GeneralData,fnames{ii});
if(iscell(dat))
% When this loop occures, zstep is being checked for, whether its
% meters, feet or seconds.
switch units
case 'M'
dat=dat{1};
case 'F'
dat=dat{2};
case 'S'
dat=dat{3};
end
end
exportstruct=setfield(exportstruct,LasID{ii},dat);
end
srvdate=date; % Date
% setting up structure for export.
exportstruct.zstart=zstart;
exportstruct.zend=zend;
exportstruct.nullval=nullval;
exportstruct.units=units;
exportstruct.topnames=topnames;
exportstruct.ztops=ztops;
exportstruct.wellname=wellname;
exportstruct.lc=lc;
exportstruct.srvdate=srvdate;
% creating depths for logmat
%holdat1=[0;holdat1];
holdat1=[holdat1;holdat1(end)+100];
dt=[];
for ii=1:length(holdat1)-1
% finding smallest layer thickness
try
% Just a quick fix 'cause really... this might blow up, I am not
% sure
dt=min([dt holdat1(ii+1)-holdat1(ii)]);
catch
end
end
% checking to make sure
while (dt<zstep)
stringinfo='Your depth step is too big for one or more of your layer thicknesses';
col=[1 1 0];
set(hmsg,'string',stringinfo,'backgroundcolor',col);
qst={['Depth Step must be less then: ' num2str(dt),...
' or cancel and fix your depths']};
a={''};
flags=[1];
titlestr=['Present Depth Step: ' num2str(zstep)];;
ansfini=askthingsle(gcf,qst,a,flags,titlestr);
if(isempty(ansfini))
stringinfo='Action Canceled';
col=[1 1 0];
set(hmsg,'string',stringinfo,'backgroundcolor',col);
return
end
zstep=str2num(ansfini{1});
end
exportstruct.zstep=zstep;
dep=[];
rot3={};
for ii=1:size(rot1,2)-1
% building a cell to hold data for acquiring
rot3{ii}=[];
end
logmathold=[];
% the following loop seems to be broken at this point. Gary Margrave put
% in the loop after this, and it fixed the problem. For now... I am
% leaving this 'cause in all truth, unless more values are added, there is
% no need to find the exact problem in the loop. Love.. Chris.
for ii=1:size(holdat1,1)-1
% first part here is creating properly stepped depths
xx=[holdat1(ii):zstep:holdat1(ii+1)]';
dep=[dep;xx(1:e
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -