⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lascreator.m

📁 基于matlab的反演程序,用于地球物理勘探中射线追踪及偏移成像程序.
💻 M
📖 第 1 页 / 共 5 页
字号:
    controlout={['Please insert data into blocks before scrolling layers'] [-1]};
end
% Saving data
AllInfo.Data=LayerData;
AllInfo.GeneralData=GeneralData;
AllInfo.BlockHandles=BlockHandles;
AllInfo.BlockButtons=BlockButtons;
AllInfo.FigureHandles=FigureHandles;
set(gcf,'userdata',AllInfo);
% ----------- 
% plotting da junk
lascreator_plot;

%-------------------------------
%----- UNIVERSAL DATA PULL -----
%-------------------------------
% 
% This routine pulls important data out of the various structures and
% exports them in an easy to use structure
% Pulling data out

function datapull=lascreator_datapull(hObject, eventdata, handles)
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');
haxes=getfield(FigureHandles,'Axes');
% -----------
% 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(val,1);
lg=getfield(GeneralData,'LASHeaders');
lg{3}=den{1};
% getting names of fields that are going to be exported.  Eventually rot1
% will be more organized than it presently is, this new organization will
% go hand in hand with lascreators future ability to add more log
% properties.
rot1=getfield(GeneralData,'SendData');
topnames={};
ztops=[];
holdat1=[];
holdat2=[];
holdat3=[];
holdat4=[];
rot2={holdat1 holdat2 holdat3 holdat4};
stploop=[];
kk=1;
for ii=1:size(fieldnames(LayerData),1)-1 % since layers start at 0
    layerdataget=['Layer' num2str(ii)];
    lay=getfield(LayerData,layerdataget);
    for jj=1:size(rot1,2)
        laydat=getfield(lay,rot1{jj});
        if(isempty(laydat)&jj==1)
            % stopping data aquisition on first blank depth
            stploop='stop';
            break
        end
        if(isempty(laydat))
            laydat=str2num(nullval);  % nullval
        end
        rot2{jj}=[rot2{jj};laydat];
    end 
    if(isempty(stploop))
        tpn=getfield(lay,'LayerName');  % aquiring tops names  
        dep=getfield(lay,'Depth');      % acquiring tops depths
        if(isempty(tpn))  
        else
            topnames{kk}=tpn;
            ztops=[ztops;dep];
            kk=kk+1;
        end
    else
        break
    end
end
allwelllogdata=rot2;
datapull={allwelllogdata topnames ztops};   % sending data out

%--------------------------
%----- PLOT WELL LOGS -----
%--------------------------
%
% this routine will plot the well log data on the axes.  Three plots will
% only be seen at once, eventually when more data is added, plots will be
% cycled through.

function lascreator_plot(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');
hmsg=getfield(FigureHandles,'Message');
haxes=getfield(FigureHandles,'Axes');
% -----------
Block1=getfield(BlockHandles,'Block1');
LayerNumber=getfield(Block1,'Number');
nm=get(LayerNumber,'string');
nm=str2num(nm(findstr(' ',nm)+1:end));
nuldat=getfield(GeneralData,'NullValue');
nullval=get(nuldat,'string');
den=getfield(GeneralData,'DensityUnits');
val=get(den,'value');
den=get(den,'string');
den=den(val,1);
dep=getfield(GeneralData,'DepthUnits');
val=get(dep,'value');
dep=get(dep,'string');
dep=dep(val,1);
lasheader=getfield(GeneralData,'LASHeaders');
lasheader{3}=den{1};
% using data pull to aquire data for plotting purposes
datapull=lascreator_datapull;
rot2=datapull{1};   % array of log data, depths is first cell
topnames=datapull{2};
ztops=datapull{3};

alldep=rot2{1};
if(isempty(rot2{2}))
else
    % setting y axis
    cla;
    % creaing a patch to show users where exactly they are on the axis as
    % they cycle through the layers
    alldep=[rot2{1}];
    nm=[nm:1:nm+4];
    nm=nm(find(size(alldep,1)>=nm));
    try
        ydat=[alldep(nm(1)) alldep(nm(end)) alldep(nm(end)) alldep(nm(1))];
    catch
        % ydat=[alldep(nm(1)) alldep(nm(end-1)) alldep(nm(end-1)) alldep(nm(1))];
        % something doesn't work sometimes with the above... so were going
        % with the following
        ydat=[0 0 0 0];
    end
    patch('xdata',[-.25 -.25 3.25 3.25],'ydata',ydat,...
            'facecolor',[.95 .95 .95],'edgecolor','none');
    alldep2=zeros(2*size(alldep,1),1);
    for ii=1:size(alldep,1)
        % this is going to allow for bar graph
        alldep2(2*ii-1)=alldep(ii);
        alldep2(2*ii)=alldep(ii);
    end
    cols={'r-' 'm-' 'g-'};
    for ii=2:size(rot2,2)
        % the following line is for reference purposes, they are being
        % plotted first so information lines are on top
        line([ii-2 ii-2],[alldep2(1) alldep2(end)],'color',[.8 .8 .8],'buttondownfcn',@lascreator_well_lines);
    end
    for ii=2:size(rot2,2)
        dat=rot2{ii};
        if(dat(1)==str2num(nullval))
            dat=dat.*0;
        end
        mx=max(abs(dat));   % shouldn't need to do the abs... but what the hell
        if(mx==0)
        else
            dat=dat/mx;
        end
        dat=dat+ii-2;
        dat2=zeros(2*size(dat,1),1);
        for jj=1:size(dat,1)
            % this is going to allow for bar graph
            dat2(2*jj-1)=dat(jj);
            dat2(2*jj)=dat(jj);
        end
        % the following line shows the normalized values
        welline=plot([dat2],alldep2,cols{ii-1});
        set(welline,'buttondownfcn',@lascreator_well_lines);
    end
    if(alldep(1)==alldep(end))
        % ploting will not occure
    else
        set(haxes,'ylim',[alldep(1) alldep(end)],'ytick',[alldep(1):alldep(end)/20:alldep(end)],...
            'xlim',[-.25 3.25],'xtick',[0:1:3]);
    end
    title('Well Log');
    ylabel(['Depth (' dep{1} ')']);
    % setting tops lines
    xxlim=get(gca,'xlim');
    for ii=1:size(topnames,2)
        % plotting tops with names and depths
        hhtext1(ii)=text(xxlim(1),ztops(ii),['*' topnames{ii} '*'],...	%text on right
            'verticalalignment','baseline',...
            'horizontalalignment','left',...
            'color',[1 .6 0],'fontsize',8);
        lbl=sprintf('%2.3f',ztops(ii));
        hhtext2(ii)=text(xxlim(2),ztops(ii),lbl,...	%Positon 
            'verticalalignment','baseline',...		%One day left
            'horizontalalignment','right',...
            'color',[1 .6 0],'fontsize',8);
        hrl=line(xxlim,[ztops(ii) ztops(ii)],'color',[1 .6 0],...
            'linewidth',[1],'userdata','',...
            'buttondownfcn',@lascreator_well_lines,'linestyle','-.');
    end
    for ii=2:size(rot2,2)
        % text to identify what is being plotted
        newtext(ii)=text([ii-2],[alldep2(1)],lasheader{ii-1},...	%text on right
            'verticalalignment','top',...
            'horizontalalignment','left',...
            'color',[0 0 0],'fontsize',8);
    end
end

%------------------------------
%----- MASTER BLOCK SHIFT -----
%------------------------------
%
% This routine allows for the cycling through of layer data.  New layers
% are created if data is shifted down with no layer data present.

function lascreator_master_move(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');
% -----------
nuldat=getfield(GeneralData,'NullValue');
nullval=get(nuldat,'string');
if(controlout{2}==0)
    stringinfo=controlout{1};
    set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
    lascreator_plot;
    return
end
hdepthunit=getfield(GeneralData,'DepthUnits');
dat=get(hdepthunit,'string');
val=get(hdepthunit,'value');
depthunit=dat(val,:);

Block1=getfield(BlockHandles,'Block1');
LayerNumber=getfield(Block1,'Number');
nm=get(LayerNumber,'string');
nm=str2num(nm(findstr(' ',nm)+1:end));
% the following colours are for the backing of the block, a single
% block is only high lighted when layer selected from well log lines
backingcol={[0.5019 0.5019 0.5019] [0.5019 0.5019 0.5019] [0.5019 0.5019 0.5019],...
        [0.5019 0.5019 0.5019]};
if(isempty(gcbo))
    % this fucntion is being called from a well log line click, the data
    % transfered contains tghe layers that will now show up in the blocks
    % and the layer that has been clicked will be high lighted
    backingdat=hObject;
    nm=backingdat{1};
    backingcol{backingdat{2}}=[1 0.5019 0];
    udat={[] nm};
else
    % function is being called through layer controls
    udat=get(gcbo,'userdata');
    whichbut=get(gcbo,'string');
    switch whichbut
        case 'Up'
            if(nm<=2)
                % taking no action
                stringinfo='Already at the top of section';
                set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
                if(nm==1)
                    return
                else
                    nm=nm-1;
                end
            else
                dat=get(gcbo,'userdata');
                if(controlout{2}==1)
                    stringinfo=controlout{1};
                    col=[1 1 0];
                    set(hmsg,'string',stringinfo,'backgroundcolor',col);
                    return
                else
                    stringinfo='Scrolling Layers';
                    set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
                end
                nm=nm-1;
                for ii=nm-1:nm+2
                    layerdataget=getfield(LayerData,['Layer' num2str(ii)]);
                end
            end
            udat{2}=udat{2}-1;
            if(udat{2}==0)
                udat{2}=4;
            end
        case 'Down'
            h=get(gcf,'userdata');
            LayerData=getfield(h,'Data');
            GeneralData=getfield(h,'GeneralData');
            if(controlout{2}==0)
            elseif(controlout{2}==1|controlout{2}==2|controlout{2}==3)
                stringinfo=controlout{1};
                col=[1 1 0];
                set(hmsg,'string',stringinfo,'backgroundcolor',col);
                return
            end
            stringinfo='Scrolling Layers';
            set(hmsg,'string',stringinfo,'backgroundcolor',[1 1 1]);
            nm=nm+1;
            udat{2}=udat{2}+1;
            if(udat{2}>=5)
                udat{2}=1;
            end
        case 'xxx'
        case 'xxx'
    end
end
h=get(gcf,'userdata');
LayerData=getfield(h,'Data');
checkdep=[];    % as long as checkdep is empty, different colours 
                % will be attempted to be created for blocks
                % No longer blank means that there is an empty 
                % depth, which means subsuqent layers are ignored
for ii=1:4
    % getting block backings for highlight purposes
    BlockBacking=getfield(BlockButtons,['Block' num2str(ii)]);
    hbacking=getfield(BlockBacking,'Backing');
    set(hbacking,'backgroundcolor',backingcol{ii});
    % getting blocks
    blockst=getfield(BlockHandles,['Block' num2str(ii)]);
    % getting handles
    hLayerNumber=getfield(blockst,'Number');
    hLayerName=getfield(blockst,'Name');
    hQuickInfo=getfield(blockst,'Info');
    hheader1=getfield(blockst,'Header1');
    hdata1=getfield(blockst,'Data1');
    hheader2=getfield(blockst,'Header2');
    hdata2=getfield(blockst,'Data2');
    hheader3=getfield(blockst,'Header3');
    hdata3=getfield(blockst,'Data3');
    hheader4=getfield(blockst,'Header4');
    hdata4=getfield(blockst,'Data4');
    % getting data
    try
        lay=getfield(LayerData,['Layer' num2str(nm+ii-1)]);
    catch 
        % need to create a new layer
        layerdataget=getfield(LayerData,'Layer0');
        layerdataget=setfield(layerdataget,'LayerNumber',[nm+ii-1]);
        LayerData=setfield(LayerData,['Layer' num2str(nm+ii-1)],layerdataget);
        lay=getfield(LayerData,['Layer' num2str(nm+ii-1)]);
    end
    lay=getfield(LayerData,['Layer' num2str(nm+ii-1)]);
    num=getfield(lay,'LayerNumber');
    nam=getfield(lay,'LayerName');
    dep=getfield(lay,'Depth');
    depunit=getfield(lay,'DepthUnit');
    Vp=getfield(lay,'Vp');
    Vpunit=getfield(lay,'VpUnit');
    Vs=getfield(lay,'Vs');
    Vsunit=getfield(lay,'VsUnit');
    den=getfield(lay,'Density');
    denunit=getfield(lay,'DensityUnit');
    %     numrotation={[1 2 3 4] [2 3 4 1] [3 4 1 2] [4 1 2 3]};
    %     numrotation=numrotation{udat{2}};
    %     colrotation={[1 1 0] [1 0.5019 0] [1 1 0.5019] [1 0.5019 0.2509]};
    % the above was for none unique colors
    
    % creating unique colors for each layer
    if(dep==str2num(nullval)|~isempty(checkdep))
        col1=0.8;
        col2=0.8;
        col3=0.8;
        checkdep='STOP';
    else
        try
            % this section is creating colours for different depths
            swdat1=sort([(Vp) (dep)]);
            col1=swdat1(1)/swdat1(2);
            col2=1;
            swdat1=sort([(Vp) (Vs)]);
            col3=swdat1(1)/swdat1(2);
            checkcol=[col1 col3];
            for kk=1:2

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -