Changeset 464
- Timestamp:
- Jun 21, 2012, 11:39:00 AM (12 years ago)
- Location:
- trunk/src/series
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/aver_stat.m
r462 r464 291 291 for iview=1:nbview 292 292 % reading input file(s) 293 [Data{iview}, ParamOut,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index));293 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},InputFields{iview},frame_index{iview}(index)); 294 294 if ~isempty(errormsg) 295 295 errormsg=['error of input reading: ' errormsg]; -
trunk/src/series/merge_proj.m
r462 r464 2 2 % can be used as a template for applying an operation (here projection and concateantion) on each field of an input series 3 3 %------------------------------------------------------------------------ 4 % function GUI_config=merge_proj(Param)4 % function ParamOut=merge_proj(Param) 5 5 %------------------------------------------------------------------------ 6 6 … … 136 136 NbSlice_calib={}; 137 137 XmlData=cell(1,nbview);%initiate the structures containing the data from the xml file (calibration and timing) 138 138 139 for iview=1:nbview%Loop on views 139 140 SubDirBase=regexprep(SubDir{iview},'\..*','');%take the root part of SubDir, before the first dot '.' … … 162 163 end 163 164 end 165 164 166 165 167 %% check coincidence in time for several input file series … … 214 216 msgbox_uvmat('ERROR','input set of input series: need either netcdf either image series') 215 217 return 218 end 216 219 end 217 220 NomTypeOut=NomType;% output file index will indicate the first and last ref index in the series … … 222 225 %% Initiate output fields 223 226 %initiate the output structure as a copy of the first input one (reproduce fields) 224 [DataOut, ParamOut,errormsg] = read_field(filecell{1,1},FileType{1},Param.InputFields,1);227 [DataOut,tild,errormsg] = read_field(filecell{1,1},FileType{1},Param.InputFields,1); 225 228 if ~isempty(errormsg) 226 229 msgbox_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg]) … … 255 258 nbmissing=0; 256 259 257 %initiate result fields258 259 for ivar=1:length(DataOut.ListVarName)260 DataOut.(DataOut.ListVarName{ivar})=0; % initialise all fields to zero261 end262 260 %initiate result fields 261 262 for ivar=1:length(DataOut.ListVarName) 263 DataOut.(DataOut.ListVarName{ivar})=0; % initialise all fields to zero 264 end 265 263 266 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 264 267 for index=index_slice … … 272 275 %%%%%%%%%%%%%%%% loop on views (input lines) %%%%%%%%%%%%%%%% 273 276 Data=cell(1,nbview);%initiate the set Data 277 nbtime=0; 274 278 for iview=1:nbview 275 279 % reading input file(s) 276 [Data{iview}, ParamOut,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index));280 [Data{iview},tild,errormsg] = read_field(filecell{iview,index},FileType{iview},Param.InputFields,frame_index{iview}(index)); 277 281 if ~isempty(errormsg) 278 282 errormsg=['error of input reading: ' errormsg]; 279 283 break 280 284 end 285 timeread(iview)=0; 286 if isfield(Data{iview},'Time') 287 timeread(iview)=Field{iview}.Time; 288 nbtime=nbtime+1; 289 end 281 290 if ~isempty(NbSlice_calib) 282 291 Data{iview}.ZIndex=mod(i1_series{iview}(index)-1,NbSlice_calib{iview})+1;%Zindex for phys transform 283 292 end 284 %transform the input field (e.g; phys) if requested293 %transform the input field (e.g; phys) if requested 285 294 if ~isempty(transform_fct) 286 295 Data{iview}=transform_fct(Data{iview},XmlData{iview}); %transform to phys if requested 287 296 end 288 289 if strcmp(FileType{ 1},'civx')||strcmp(FileType{1},'civ')297 % field calculation (vort, div...) 298 if strcmp(FileType{iview},'civx')||strcmp(FileType{iview},'civ') 290 299 Data{iview}=calc_field(Param.InputFields.FieldName,Data{iview});%calculate field (vort..) 291 300 end 292 293 %projection on object (gridded plane)294 if test_object295 [Data{iview},errormsg]=proj_field(Data{iview},P rojObject);301 302 %projection on object (gridded plane) 303 if Param.CheckObject 304 [Data{iview},errormsg]=proj_field(Data{iview},Param.ProjObject); 296 305 if ~isempty(errormsg) 297 306 msgbox_uvmat('ERROR',['error in merge_proge/proj_field: ' errormsg]) … … 299 308 end 300 309 end 301 end 310 end 302 311 %----------END LOOP ON VIEWS---------------------- 303 312 304 313 %% merge the nbview fields 305 314 MergeData=merge_field(Data); … … 307 316 msgbox_uvmat('ERROR',MergeData.Txt) 308 317 return 309 end 310 % generating the name of the merged field 311 i1=i1_series{iview}(index); 312 if ~isempty(i2_series{iview}) 313 i2=i2_series{iview}(index); 314 else 315 i2=i1; 316 end 317 j1=1; 318 j2=1; 319 if ~isempty(j1_series{iview}) 320 j1=j1_series{iview}(index); 321 if ~isempty(j2_series{iview}) 322 j2=j2_series{iview}(index); 323 else 324 j2=j1; 325 end 326 end 327 OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomType{1},i1,i2,j1,j2); 328 329 % time of the merged field: 318 end 319 % time of the merged field: 330 320 time_i=0;%default 331 321 if isempty(time)% time from ImaDoc prevails 332 322 time_i=sum(timeread)/nbtime; 333 323 else 334 % time_i=i1;335 324 time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade 336 325 end 326 % generating the name of the merged field 327 i1=i1_series{iview}(index); 328 if ~isempty(i2_series{iview}) 329 i2=i2_series{iview}(index); 330 else 331 i2=i1; 332 end 333 j1=1; 334 j2=1; 335 if ~isempty(j1_series{iview}) 336 j1=j1_series{iview}(index); 337 if ~isempty(j2_series{iview}) 338 j2=j2_series{iview}(index); 339 else 340 j2=j1; 341 end 342 end 343 OutputFile=fullfile_uvmat(RootPath{1},Param.OutputSubDir,RootFile{1},FileExtOut,NomType{1},i1,i2,j1,j2); 337 344 338 % recording the merged field 339 if testima %in case of input images an image is produced 345 % time of the merged field: 346 time_i=0;%default 347 if isempty(time)% time from ImaDoc prevails 348 time_i=sum(timeread)/nbtime; 349 else 350 % time_i=i1; 351 time_i=(time(i1,j1)+time(i2,j2))/2; %TODO: upgrade 352 end 353 354 % recording the merged field 355 if CheckImage{1} %in case of input images an image is produced 340 356 if isa(MergeData.A,'uint8') 341 357 bitdepth=8; … … 343 359 bitdepth=16; 344 360 end 345 imwrite(MergeData.A,OutputFile,'BitDepth',bitdepth); 361 imwrite(MergeData.A,OutputFile,'BitDepth',bitdepth); 346 362 %write xml calibration file 347 363 siz=size(MergeData.A); … … 368 384 t=struct2xml(ImaDoc); 369 385 t=set(t,1,'name','ImaDoc'); 370 save(t,[filebase_merge '.xml']) 386 save(t,[filebase_merge '.xml']) 371 387 display([filebase_merge '.xml saved']) 372 388 else 373 MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'}; 389 MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'}; 374 390 MergeData.Conventions='uvmat'; 375 391 MergeData.nb_coord=2; … … 387 403 MergeData.ListGlobalAttribute(6)=[]; 388 404 else 389 MergeData.dt=dt;405 MergeData.dt=dt; 390 406 end 391 407 MergeData.Time=time_i; -
trunk/src/series/time_series.m
r462 r464 263 263 %% Initiate output fields 264 264 %initiate the output structure as a copy of the first input one (reproduce fields) 265 [DataOut, ParamOut,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1);265 [DataOut,tild,errormsg] = read_field(filecell{1,1},FileType{1},InputFields{1},1); 266 266 if ~isempty(errormsg) 267 267 msgbox_uvmat('ERROR',['error reading ' filecell{1,1} ': ' errormsg])
Note: See TracChangeset
for help on using the changeset viewer.