Changeset 893 for trunk/src


Ignore:
Timestamp:
Apr 30, 2015, 8:28:58 AM (9 years ago)
Author:
sommeria
Message:

read netcdf fixed

Location:
trunk/src
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/find_field_bounds.m

    r871 r893  
    4141NbDim=max(NbDimArray);% spatial dimension of the input field
    4242imax=find(NbDimArray==NbDim);% indices of field cells to consider
     43Check4D=0;
     44if NbDim>3
     45    NbDim=3;
     46    Check4D=1;
     47end
    4348FieldOut.NbDim=NbDim;
    4449if  NbDim<=1; return; end% stop here for 1D fields
    45 
     50 
    4651%% get bounds and mesh (needed  to propose default options for projection objects)
    4752% if NbDim>1
     
    5762        CoordMin(ind,NbDim-1)=min(min(Field.(CoordName)(1:end-3,2,:),[],1),[],3);% min of y component (2D case)
    5863    else
     64        if Check4D
     65            CellInfo{imax(ind)}.CoordIndex(4:end)=[];
     66        end
    5967        XName=Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end)};
    6068        YName=Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(end-1)};
     
    6674        if NbDim==3
    6775            ZName=Field.ListVarName{CellInfo{imax(ind)}.CoordIndex(1)};
    68             CoordMax(ind,1)=max(max(Field.(ZName)));
    69             CoordMin(ind,1)=min(min(Field.(ZName)));
     76            CoordMax(ind,NbDim-2)=max(max(Field.(ZName)));
     77            CoordMin(ind,NbDim-2)=min(min(Field.(ZName)));
    7078        end
    7179    end
     
    7785        case 'grid'%structured coordinate
    7886            NbPoints=CellInfo{imax(ind)}.CoordSize;% nbre of points in each direction
     87            if Check4D
     88               NbPoints=NbPoints(1:3);
     89            end
    7990            Mesh(ind)=min((CoordMax(ind,:)-CoordMin(ind,:))./(NbPoints-1));
    8091    end
Note: See TracChangeset for help on using the changeset viewer.