Changeset 569 for trunk/src/proj_field.m


Ignore:
Timestamp:
Feb 19, 2013, 7:19:07 PM (11 years ago)
Author:
sommeria
Message:

many corrections; introduction of browse_data to scan the whole set of data, used also to replicate data in calibration mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/proj_field.m

    r546 r569  
    887887
    888888%% mesh sizes DX and DY
     889DX=[];
     890DY=[];%default
    889891if isfield(ObjectData,'DX') && ~isempty(ObjectData.DX)
    890892     DX=abs(ObjectData.DX);%mesh of interpolation points
    891 else
    892     DX=FieldData.Mesh;
     893% else
     894%     DX=FieldData.Mesh;
    893895end
    894896if isfield(ObjectData,'DY') && ~isempty(ObjectData.DY)
    895897     DY=abs(ObjectData.DY);%mesh of interpolation points
    896 else
    897     DY=FieldData.Mesh;
    898 end
    899 if  ~strcmp(ObjectData.ProjMode,'projection') && (DX==0||DY==0)
    900         errormsg='DX or DY missing';
    901         display(errormsg)
     898% else
     899%     DY=FieldData.Mesh;
     900end
     901if  ~strcmp(ObjectData.ProjMode,'projection') && (isempty(DX)||isempty(DY))
     902        errormsg='DX or DY not defined';
    902903        return
    903904end
     
    913914        XMax=max(ObjectData.RangeX);
    914915        testXMin=XMax>XMin;
    915         testXMax=1;
     916        testXMax=1;% range restriction along X
    916917else
    917918    XMin=FieldData.XMin;%default
     
    960961ProjData.VarDimName={};
    961962ProjData.VarAttribute={};
    962 if ~isequal(DX,0)&& ~isequal(DY,0)
     963if ~isempty(DX) && ~isempty(DY)
    963964    ProjData.Mesh=sqrt(DX*DY);%define typical data mesh, useful for mouse selection in plots
    964965elseif isfield(FieldData,'Mesh')
     
    12341235           
    12351236            %% case of input fields defined on a structured  grid
    1236         case 'grid'
    1237            
     1237        case 'grid'         
    12381238            VarName=FieldData.ListVarName{VarIndex(1)};%get the first variable of the cell to get the input matrix dimensions
    12391239            DimValue=size(FieldData.(VarName));%input matrix dimensions
     
    12751275            Coord_z=[];
    12761276            Coord_y=[];
    1277             Coord_x=[];
    1278            
     1277            Coord_x=[];     
    12791278            for idim=1:NbDim %loop on space dimensions
    12801279                test_interp(idim)=0;%test for coordiate interpolation (non regular grid), =0 by default
     
    13021301                end
    13031302            end
    1304             if DY==0
     1303            if isempty(DY)
    13051304                DY=abs(DCoord_min(NbDim-1));
    13061305            end
    13071306            npY=1+round(abs(Coord{NbDim-1}(end)-Coord{NbDim-1}(1))/DY);%nbre of points after interpol
    1308             if DX==0
     1307            if isempty(DX)
    13091308                DX=abs(DCoord_min(NbDim));
    13101309            end
     
    13691368                coord_x_proj=linspace(XMax,XMin,npX);%abscissa of the new pixels along the line
    13701369            end
    1371             % case with no  interpolation
     1370            % case with no interpolation
    13721371            if isequal(ProjMode{icell},'projection') && (~testangle || test90y || test90x)
    1373                 if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax
     1372                if  NbDim==2 && ~testXMin && ~testXMax && ~testYMin && ~testYMax% no range restriction
    13741373                    ProjData.ListVarName=[ProjData.ListVarName FieldData.ListVarName(VarIndex)];
    13751374                    ProjData.VarDimName=[ProjData.VarDimName FieldData.VarDimName(VarIndex)]; 
     
    14081407                    end
    14091408                    min_indy=max(min_indy,1);% deals with margin (bound lower than the first index)
    1410                     min_indx=max(min_indx,1);
    1411                    
     1409                    min_indx=max(min_indx,1);                 
    14121410                    if test90y
    14131411                        ind_new=[3 2 1];
    14141412                        DimCell={AYProjName,AXProjName};
    1415                         %                     DimValue=DimValue(ind_new);
    14161413                        iz=ceil((ObjectData.Coord(1,1)-Coord{3}(1))/DX)+1;
    14171414                        for ivar=VarIndex
Note: See TracChangeset for help on using the changeset viewer.