Changeset 1194 for trunk/src/series


Ignore:
Timestamp:
Feb 23, 2026, 3:58:54 PM (8 days ago)
Author:
sommeria
Message:

several bugs repaired

Location:
trunk/src/series
Files:
2 edited

Legend:

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

    r1181 r1194  
    119119% filecell{iview,fileindex}:
    120120%        iview: line in the table corresponding to a given file series
    121 %        fileindex: file index within  the file series, 
    122 % i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j 
     121%        fileindex: file index within  the file series,
     122% i1_series(iview,ref_j,ref_i)... are the corresponding arrays of indices i1,i2,j1,j2, depending on the input line iview and the two reference indices ref_i,ref_j
    123123% i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices
    124124%%%%%%%%%%%% NbView=1 : a single input series
     
    141141[i1,~,j1,~] = get_file_index(Param.IndexRange.first_i,first_j,PairString);
    142142[i2,~,j2,~] = get_file_index(Param.IndexRange.last_i,last_j,PairString);
    143 ncfile_out=fullfile_uvmat(OutputPath,OutputDir,Param.InputTable{1,3},'.nc',NomTypeNc,i1,i2,j1,j2);
    144 
    145 % OutputPath=fullfile(Param.OutputPath,num2str(Param.Experiment),num2str(Param.Device));
    146 % RootFileOut=RootFile{1};
    147 % NomTypeOut='_1';
     143ncfile_out=fullfile_uvmat(OutputPath,OutputDir,Param.InputTable{1,3},'*.nc',NomTypeNc,i1,i2,j1,j2);
    148144
    149145%%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%%
    150 disp('loop for filtering started') 
    151  ncid=[];
     146disp('loop for filtering started')
     147ncid=[];
    152148for index=1:NbField
    153149    index
    154    
    155150    [Field,~,errormsg]= read_field(filecell{1,index},'netcdf',Param.InputFields);
    156151    if ~isempty(errormsg)
    157152        disp(errormsg)
    158153        if ~isempty(ncid)
    159         netcdf.close(ncid)
     154            netcdf.close(ncid)
    160155        end
    161156        return
     
    179174            VarDimIndex{ifield+3}=[2 3 1];
    180175        end
    181 
    182 %         VarDimIndex={1,2,3,[1 2 3],[1 2 3]};
    183 
    184176        DataOut.coord_x=Field.coord_x;
    185177        DataOut.coord_y=Field.coord_y;
     
    192184        netcdf.putVar(ncid,1,0,npy,Field.coord_y)
    193185        netcdf.putVar(ncid,2,0,npx,Field.coord_x)
    194 %         Uvarid=3;
    195 %         Vvarid=4;
    196186        TimeBlock=zeros(Param.ActionInput.WindowLength,1);
    197187        Fieldblock=zeros(numel(ListFields),Param.ActionInput.WindowLength,npy,npx);
    198         %Vblock=zeros(Param.ActionInput.WindowLength,npy,npx);
    199     end
    200 
     188    end
     189   
    201190    TimeBlock=circshift(TimeBlock,[-1 0 ]);
    202191    TimeBlock(end)=Field.Time;
     
    204193    Timefilter=mean(TimeBlock(end-sumindex:end,:,:));%mid time
    205194    Fieldblock=circshift(Fieldblock,[0 -1 0 0]); %shift U by ishift along the first index
    206    % Vblock=circshift(Vblock,[-1 0 0]); %shift U by ishift along the first index
    207195    for ifield=1:numel(ListFields)
    208     Fieldblock(ifield,end,:,:)=Field.(ListFields{ifield});
    209     end
    210     %Vblock(end,:,:)=Field.V;
     196        Fieldblock(ifield,end,:,:)=Field.(ListFields{ifield});
     197    end
    211198    Fieldfilter=squeeze(mean(Fieldblock(:,end-sumindex:end,:,:),2,'omitnan'));
    212 %     Ufilter=squeeze(mean(Ublock(end-sumindex:end,:,:),1,'omitnan'));
    213 %     Vfilter=squeeze(mean(Vblock(end-sumindex:end,:,:),1,'omitnan'));
    214 %     Uerror=Ufilter-Ublock(end-floor(sumindex/2),:,:);
    215 %     Verror=Ufilter-Vblock(end-floor(sumindex/2),:,:);
    216     %updating output the netcdf file
    217      tstart = tic;
    218     netcdf.putVar(ncid,0,(index-1),Timefilter)
     199    netcdf.putVar(ncid,0,(index-1),Timefilter)    % update the field in the nc file
    219200    for ifield=1:numel(ListFields)
    220201        netcdf.putVar(ncid,Field_varid(ifield),[ 0 0 (index-1)],[npy npx 1],squeeze(Fieldfilter(ifield,:,:)))
    221202    end
    222 %     netcdf.putVar(ncid,Uvarid,[ 0 0 (index-1)],[npy npx 1],Ufilter)
    223 %      netcdf.putVar(ncid,Vvarid,[0 0 (index-1)],[npy npx 1],Vfilter)
    224 
    225  telapsed = toc(tstart)% time for writting the field
    226     % writing the result file as netcdf file
    227     %     i1=i1_series{1}(index)-ceil(NpTime/2);
    228     %     OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,'.nc',NomTypeOut,i1);
    229     %     errormsg=struct2nc(OutputFile, DataOut);
    230     %     if isempty(errormsg)
    231     %         disp([OutputFile ' written'])
    232     %     else
    233     %         disp(errormsg)
    234     %     end
    235 end
    236 netcdf.close(ncid)
    237 figure
    238 plot(telapsed)
    239 ylabel('time lapsed computation')
     203end
     204
    240205'END'
  • trunk/src/series/merge_proj.m

    r1152 r1194  
    223223    NomTypeOut='_1_1';
    224224end
    225 %NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series
    226225RootFileOut=RootFile{1};
    227226for iview=2:NbView
     
    265264    if ~isempty(j1_series{1})
    266265        j1=j1_series{1}(index);
    267         if ~isempty(j2_series{end})
    268             j2=j2_series{end}(index);
    269         else
    270             j2=j1;
    271         end
    272     end
    273     OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i1,i2,j1,j2);
     266    end
     267    i_out=floor((i1+i2)/2);
     268    OutputFile=fullfile_uvmat(OutputPath,OutputDir,RootFileOut,FileExtOut,NomTypeOut,i_out,[],j1);
    274269    if ~CheckOverwrite && exist(OutputFile,'file')
    275270            disp(['existing output file ' OutputFile ' already exists, skip to next field'])
Note: See TracChangeset for help on using the changeset viewer.