Ignore:
Timestamp:
Jul 25, 2024, 8:36:17 PM (7 months ago)
Author:
sommeria
Message:

SearchBoxSize? changed to SearchRange? in civ, possibility of a grid set by a netcdf file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series/civ_3D.m

    r1161 r1163  
    190190Data.VarAttribute{7}.Role='ancillary';
    191191Data.VarAttribute{8}.Role='errorflag';
    192 Data.Coord_z=j1_series_Civ1;
     192% Data.Coord_z=j1_series_Civ1;
    193193% path for output nc file
    194194OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device),[Param.OutputSubDir Param.OutputDirExt]);
     
    230230    par_civ1.ImageHeight=FileInfo.Height;npy=FileInfo.Height;
    231231    par_civ1.ImageWidth=FileInfo.Width;npx=FileInfo.Width;
    232 SearchRange_z=floor(Param.ActionInput.Civ1.SearchBoxSize(3)/2);
     232SearchRange_z=Param.ActionInput.Civ1.SearchRange(3);
    233233    par_civ1.Dz=Param.ActionInput.Civ1.Dz;
    234234    par_civ1.ImageA=zeros(2*SearchRange_z+1,npy,npx);
     
    296296        par_civ1.ImageA=zeros(2*SearchRange_z+1,npy,npx);%image block initiation
    297297        par_civ1.ImageB=zeros(2*SearchRange_z+1,npy,npx);
    298        
     298        Data.Coord_z=SearchRange_z+1:par_civ1.Dz:NbSlice-1;
    299299        z_index=1;%first vertical block centered at image index z_index=SearchRange_z+1
    300300        for iz=1:2*SearchRange_z+1
     
    315315        end
    316316     % loop on slices
     317
    317318        for z_index=2:floor((NbSlice-SearchRange_z)/par_civ1.Dz)% loop on slices
    318319            par_civ1.ImageA=circshift(par_civ1.ImageA,-par_civ1.Dz,1);%shift the indices in the image block upward by par_civ1.Dz
    319320            par_civ1.ImageB=circshift(par_civ1.ImageB,-par_civ1.Dz,1);
    320321            for iz=1:par_civ1.Dz %read the new images at the end of the image block
     322                image_index=z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz+1;
     323                if image_index<=size(j1_series_Civ1,1)
    321324                j_image_index=j1_series_Civ1(z_index*par_civ1.Dz+SearchRange_z-par_civ1.Dz+iz+1,1)
    322                 ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j_image_index);%
     325                ImageName_A=fullfile_uvmat(RootPath_A,SubDir_A,RootFile_A,FileExt_A,NomType_A,i1_series_Civ1(1,ifield),[],j_image_index);%           
    323326                A= read_image(ImageName_A,FileType_A);
    324327                ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ1(1,ifield),[],j_image_index);
    325328                B= read_image(ImageName_B,FileType_B);
     329                else
     330                    A=zeros(1,size(par_civ1.ImageA,2),size(par_civ1.ImageA,3));
     331                    B=zeros(1,size(par_civ1.ImageA,2),size(par_civ1.ImageA,3));
     332                end
    326333                par_civ1.ImageA(2*SearchRange_z+1-par_civ1.Dz+iz,:,:) = A;
    327334                par_civ1.ImageB(2*SearchRange_z+1-par_civ1.Dz+iz,:,:) = B;
     
    338345        Data.Civ1_Y=npy-Data.Civ1_Y+1;%reverse y
    339346        [npz,npy,npx]=size(Data.Civ1_X);
    340         Data.Coord_z=SearchRange_z+1:par_civ1.Dz:NbSlice-1;
     347       
    341348      %  Data.Coord_y=flip(1:npy);
    342349       % Data.Coord_x=1:npx;
     
    422429        % list the variables to record
    423430        nbvar=length(Data.ListVarName);
    424         Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_SubRange','Civ1_NbCentres','Civ1_Coord_tps','Civ1_U_tps','Civ1_V_tps'}];
    425         Data.VarDimName=[Data.VarDimName {'nb_vec_1','nb_vec_1',{'nb_coord','nb_bounds','nb_subdomain_1'},'nb_subdomain_1',...
    426             {'nb_tps_1','nb_coord','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'},{'nb_tps_1','nb_subdomain_1'}}];
     431        Data.ListVarName=[Data.ListVarName {'Civ1_U_smooth','Civ1_V_smooth','Civ1_W_smooth'}];
     432        Data.VarDimName=[Data.VarDimName {{'npz','npy','npx'},{'npz','npy','npx'},{'npz','npy','npx'}}];
    427433        Data.VarAttribute{nbvar+1}.Role='vector_x';
    428434        Data.VarAttribute{nbvar+2}.Role='vector_y';
    429         Data.VarAttribute{nbvar+5}.Role='coord_tps';
    430         Data.VarAttribute{nbvar+6}.Role='vector_x';
    431         Data.VarAttribute{nbvar+7}.Role='vector_y';
    432         Data.Civ1_U_smooth=Data.Civ1_U; % zeros(size(Data.Civ1_X));
    433         Data.Civ1_V_smooth=Data.Civ1_V; %zeros(size(Data.Civ1_X));
     435        Data.VarAttribute{nbvar+5}.Role='vector_z';     
     436        Data.Civ1_U_smooth=Data.Civ1_U;
     437        Data.Civ1_V_smooth=Data.Civ1_V;
     438        Data.Civ1_W_smooth=Data.Civ1_W;
    434439        if isfield(Data,'Civ1_FF')
    435440            ind_good=find(Data.Civ1_FF==0);
    436441        else
    437             ind_good=1:numel(Data.Civ1_X);
     442            disp_uvmat('ERROR','detection of error vectors (FIX operation) needed before PATCH' ,checkrun)
     443            return
    438444        end
    439445        if isempty(ind_good)
     
    443449
    444450        % perform Patch calculation using the UVMAT fct 'filter_tps'
    445 
    446         [Data.Civ1_SubRange,Data.Civ1_NbCentres,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,~,Ures, Vres,~,FFres]=...
    447             filter_tps([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),[],Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff);
    448         Data.Civ1_U_smooth(ind_good)=Ures;% take the interpolated (smoothed) velocity values for good vectors, keep civ1 data for the other
    449         Data.Civ1_V_smooth(ind_good)=Vres;
     451Civ1_Z=0.5*Data.Civ1_W(ind_good);
     452for iz=1:numel(Data.Coord_z)
     453    Civ1_Z(iz,:,:)=Civ1_Z(iz,:,:)+Data.Coord_z(iz);
     454end
     455        [Data.Civ1_SubRange,Data.Civ1_NbCentres,Data.Civ1_Coord_tps,Data.Civ1_U_tps,Data.Civ1_V_tps,Data.Civ1_W_tps,...
     456            Data.Civ1_U_smooth(ind_good),Data.Civ1_V_smooth(ind_good),Data.Civ1_V_smooth(ind_good),FFres]=...
     457            filter_tps_3D([Data.Civ1_X(ind_good) Data.Civ1_Y(ind_good)],Civ_1_Z,Data.Civ1_U(ind_good),Data.Civ1_V(ind_good),Data.Civ1_W(ind_good),Data.Patch1_SubDomainSize,Data.Patch1_FieldSmooth,Data.Patch1_MaxDiff);
    450458        Data.Civ1_FF(ind_good)=uint8(FFres);
    451459        time_patch1=toc(tstart_patch1);
     
    778786ibx2=floor(par_civ.CorrBoxSize(1)/2);
    779787iby2=floor(par_civ.CorrBoxSize(2)/2);
    780 isx2=floor(par_civ.SearchBoxSize(1)/2);
    781 isy2=floor(par_civ.SearchBoxSize(2)/2);
    782 isz2=floor(par_civ.SearchBoxSize(3)/2);
     788isx2=par_civ.SearchRange(1);
     789isy2=par_civ.SearchRange(2);
     790isz2=par_civ.SearchRange(3);
    783791kref=isz2+1;%middle index of the z slice
    784792shiftx=round(par_civ.SearchBoxShift(:,1));%use the input shift estimate, rounded to the next integer value
     
    891899                    % end
    892900
    893                     npxycorr=par_civ.SearchBoxSize(1:2)-par_civ.CorrBoxSize(1:2)+1;
    894                     result_conv=zeros([par_civ.SearchBoxSize(3) npxycorr]);%initialise the conv product
    895                     max_xy=zeros(par_civ.SearchBoxSize(3),1);%initialise the max correlation vs z
     901                    npxycorr=2*par_civ.SearchRange(1:2)+1;
     902                    result_conv=zeros([2*par_civ.SearchRange(3)+1 npxycorr]);%initialise the conv product
     903                    max_xy=zeros(2*par_civ.SearchRange(3)+1,1);%initialise the max correlation vs z
    896904                    xk=ones(npz,1);%initialise the x displacement corresponding to the max corr
    897905                    yk=ones(npz,1);%initialise the y displacement corresponding to the max corr
Note: See TracChangeset for help on using the changeset viewer.