Changeset 1194 for trunk/src/series
- Timestamp:
- Feb 23, 2026, 3:58:54 PM (8 days ago)
- Location:
- trunk/src/series
- Files:
-
- 2 edited
-
filter_time_singlefile.m (modified) (5 diffs)
-
merge_proj.m (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/filter_time_singlefile.m
r1181 r1194 119 119 % filecell{iview,fileindex}: 120 120 % 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 123 123 % i1_series(iview,fileindex) expresses the same indices as a 1D array in file indices 124 124 %%%%%%%%%%%% NbView=1 : a single input series … … 141 141 [i1,~,j1,~] = get_file_index(Param.IndexRange.first_i,first_j,PairString); 142 142 [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'; 143 ncfile_out=fullfile_uvmat(OutputPath,OutputDir,Param.InputTable{1,3},'*.nc',NomTypeNc,i1,i2,j1,j2); 148 144 149 145 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 150 disp('loop for filtering started') 151 ncid=[];146 disp('loop for filtering started') 147 ncid=[]; 152 148 for index=1:NbField 153 149 index 154 155 150 [Field,~,errormsg]= read_field(filecell{1,index},'netcdf',Param.InputFields); 156 151 if ~isempty(errormsg) 157 152 disp(errormsg) 158 153 if ~isempty(ncid) 159 netcdf.close(ncid)154 netcdf.close(ncid) 160 155 end 161 156 return … … 179 174 VarDimIndex{ifield+3}=[2 3 1]; 180 175 end 181 182 % VarDimIndex={1,2,3,[1 2 3],[1 2 3]};183 184 176 DataOut.coord_x=Field.coord_x; 185 177 DataOut.coord_y=Field.coord_y; … … 192 184 netcdf.putVar(ncid,1,0,npy,Field.coord_y) 193 185 netcdf.putVar(ncid,2,0,npx,Field.coord_x) 194 % Uvarid=3;195 % Vvarid=4;196 186 TimeBlock=zeros(Param.ActionInput.WindowLength,1); 197 187 Fieldblock=zeros(numel(ListFields),Param.ActionInput.WindowLength,npy,npx); 198 %Vblock=zeros(Param.ActionInput.WindowLength,npy,npx); 199 end 200 188 end 189 201 190 TimeBlock=circshift(TimeBlock,[-1 0 ]); 202 191 TimeBlock(end)=Field.Time; … … 204 193 Timefilter=mean(TimeBlock(end-sumindex:end,:,:));%mid time 205 194 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 index207 195 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 211 198 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 219 200 for ifield=1:numel(ListFields) 220 201 netcdf.putVar(ncid,Field_varid(ifield),[ 0 0 (index-1)],[npy npx 1],squeeze(Fieldfilter(ifield,:,:))) 221 202 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') 203 end 204 240 205 'END' -
trunk/src/series/merge_proj.m
r1152 r1194 223 223 NomTypeOut='_1_1'; 224 224 end 225 %NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series226 225 RootFileOut=RootFile{1}; 227 226 for iview=2:NbView … … 265 264 if ~isempty(j1_series{1}) 266 265 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); 274 269 if ~CheckOverwrite && exist(OutputFile,'file') 275 270 disp(['existing output file ' OutputFile ' already exists, skip to next field'])
Note: See TracChangeset
for help on using the changeset viewer.
