Ignore:
Timestamp:
Jul 15, 2013, 2:50:47 PM (11 years ago)
Author:
sommeria
Message:

a few bugs corrected.
multimask introduced in merge_proj
displ_uvmat transformed into disp_uvmat

File:
1 edited

Legend:

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

    r642 r668  
    111111for iview=1:NbView
    112112    if ~exist(filecell{iview,1}','file')
    113         displ_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)
     113        disp_uvmat('ERROR',['the first input file ' filecell{iview,1} ' does not exist'],checkrun)
    114114        return
    115115    end
     
    129129    diff_time=max(max(diff(time)));
    130130    if diff_time>0
    131         displ_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)
     131        disp_uvmat('WARNING',['times of series differ by (max) ' num2str(diff_time)],checkrun)
    132132    end   
    133133end
     
    150150    FileExtOut='.nc';% write result as .nc files for netcdf inputs
    151151else
    152     displ_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun)
     152    disp_uvmat('ERROR',['invalid file type input ' FileType{1}],checkrun)
    153153    return
    154154end
    155155for iview=1:NbView
    156156    if ~isequal(CheckImage{iview},CheckImage{1})||~isequal(CheckNc{iview},CheckNc{1})
    157         displ_uvmat('ERROR','input set of input series: need  either netcdf either image series',checkrun)
     157        disp_uvmat('ERROR','input set of input series: need  either netcdf either image series',checkrun)
    158158        return
    159159    end
     
    162162
    163163%% mask (TODO: case of multilevels)
     164MaskData=cell(NbView,1);
    164165if Param.CheckMask
    165     MaskData=cell(NbView,1);
    166     MaskSubDir=regexprep(Param.InputTable{iview,2},'\..*','');%take the root part of SubDir, before the first dot '.'
    167     MaskName=fullfile(Param.InputTable{iview,1},[MaskSubDir '.mask'],'mask_1.png');
    168     if exist(MaskName,'file')
    169         [MaskData{iview},tild,errormsg] = read_field(MaskName,'image');
     166    for iview=1:numel(Param.MaskTable)
     167%     MaskData=cell(NbView,1);
     168%     MaskSubDir=regexprep(Param.InputTable{iview,2},'\..*','');%take the root part of SubDir, before the first dot '.'
     169%     MaskName=fullfile(Param.InputTable{iview,1},[MaskSubDir '.mask'],'mask_1.png');
     170%     if exist(MaskName,'file')
     171        [MaskData{iview},tild,errormsg] = read_field(Param.MaskTable{iview},'image');
    170172        if ~isempty(transform_fct) && nargin(transform_fct)>=2
    171             MaskData{iview}=transform_fct(MaskData,XmlData{iview});
     173            MaskData{iview}=transform_fct(MaskData{iview},XmlData{iview});
    172174        end
    173175    end
     
    301303        GeometryCal.Tx_Ty_Tz=[T_x T_y 1];
    302304        ImaDoc.GeometryCalib=GeometryCal;
    303         %             t=struct2xml(ImaDoc);
    304         %             t=set(t,1,'name','ImaDoc');
    305         %             save(t,[filebase_merge '.xml'])
    306         %             display([filebase_merge '.xml saved'])
    307305    else
    308306        MergeData.ListGlobalAttribute={'Conventions','Project','InputFile_1','InputFile_end','nb_coord','nb_dim','dt','Time','civ'};
     
    351349
    352350%% group the variables (fields of 'Data') in cells of variables with the same dimensions
    353 [CellVarIndex,NbDim,VarTypeCell]=find_field_cells(Data{1});
     351[CellInfo,NbDim,errormsg]=find_field_cells(Data{1});
    354352%LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
    355353% CellVarIndex=cells of variable index arrays
    356 for icell=1:length(CellVarIndex)
     354for icell=1:length(CellInfo)
    357355    if NbDim(icell)==1
    358         continue
    359     end
    360     VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
    361     VarType=VarTypeCell{icell};
    362     ivar_X=VarType.coord_x;
    363     ivar_Y=VarType.coord_y;
    364     ivar_FF=VarType.errorflag;
     356        continue% skip field cells which are of dim 1
     357    end
     358    VarIndex=CellInfo{icell}.VarIndex;%  indices of the selected variables in the list FieldData.ListVarName
     359%     VarType=VarTypeCell{icell};
     360    ivar_X=CellInfo{icell}.CoordIndex(1);
     361    ivar_Y=CellInfo{icell}.CoordIndex(2);
     362%     ivar_Y=VarType.coord_y;
     363    ivar_FF=CellInfo{icell}.VarIndex_errorflag;
    365364    if isempty(ivar_X)
    366365        test_grid=1;%test for input data on regular grid (e.g. image)coordinates
    367366    else
    368367        if length(ivar_Y)~=1
    369                 displ_uvmat('ERROR','y coordinate missing in proj_field.m',checkrun)
     368                disp_uvmat('ERROR','y coordinate missing in proj_field.m',checkrun)
    370369                return
    371370        end
     
    373372    end
    374373    %case of input fields with unstructured coordinates
    375     if ~test_grid
     374    if isequal(CellInfo{icell}.CoordType,'scattered')
    376375        for ivar=VarIndex
    377376            VarName=MergeData.ListVarName{ivar};
Note: See TracChangeset for help on using the changeset viewer.