Ignore:
Timestamp:
Dec 22, 2010, 5:12:31 PM (13 years ago)
Author:
sommeria
Message:

CoordType? not used, replaced by CoordUnit?
bug repair in check_field_structure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/check_field_structure.m

    r140 r158  
    5050nbdim=0;
    5151Data.ListDimName={};
     52
     53%% main loop on the list of variables
    5254for ivar=1:nbfield
    5355    VarName=Data.ListVarName{ivar};
     
    6466        return
    6567    end
    66     nbcoord=numel(sizvar);%nbre of coordiantes for variable named VarName
     68    nbcoord=numel(sizvar);%nbre of coordinates for variable named VarName
     69    testrange=0;
    6770    if numel(DimCell)==0
    6871        errormsg=['empty declared dimension .VarDimName{' num2str(ivar) '} for ' VarName];
     
    7982                return
    8083            end
     84            if sizvar(1)==2 && isequal(VarName,DimCell{1})
     85                testrange=1;% test for a dimension variable representing a range
     86            end
    8187        else
    8288            errormsg=['1 dimension declared in .VarDimName{' num2str(ivar) '} inconsistent with the nbre of dimensions =' num2str(nbcoord) ' of the variable ' VarName];
     
    8591    else
    8692        if numel(DimCell)>nbcoord
    87             DimCell=DimCell(end-nbcoord+1:end);%first singleton diemnsions omitted,
     93            DimCell=DimCell(end-nbcoord+1:end);%first singleton diemensions omitted,
    8894        elseif nbcoord > numel(DimCell)
    8995            errormsg=['nbre of declared dimensions in .VarDimName{' num2str(ivar) '} smaller than the nbre of dimensions =' num2str(nbcoord) ' of the variable ' VarName];
     
    97103        if isempty(iprev)% append the dimension name to the current list
    98104            nbdim=nbdim+1;
     105            RangeTest(nbdim)=0; %default
    99106            if sizvar(idim)==2 && strcmp(DimName,VarName)%case of a coordinate defined by the two end values (regular spacing)
    100107                RangeTest(nbdim)=1; %to be updated for a later variable 
     
    105112        else % DimName is detected in the current list of dimension names
    106113            if ~isequal(Data.DimValue(iprev),sizvar(idim))
     114                        RangeTest(iprev)
     115            Data.DimValue(iprev)
    107116                if isequal(Data.DimValue(iprev),2)&& RangeTest(iprev)  % the dimension has been already detected as a range [min max]
    108117                    Data.DimValue(iprev)=sizvar(idim); %update with actual value
    109                 else
     118                elseif ~testrange               
    110119                    errormsg=['dimension declaration inconsistent with the size =[' num2str(sizvar) '] for ' VarName];
    111120                    return
Note: See TracChangeset for help on using the changeset viewer.