Ignore:
Timestamp:
Feb 27, 2017, 9:28:27 AM (7 years ago)
Author:
sommeria
Message:

tubcorrelation added, compilation improved to accept tranform fct

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r977 r1001  
    696696            vec_U=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_vector_x});
    697697            vec_V=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_vector_y});
     698            XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
     699            YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    698700            if strcmp(CellInfo{icell}.CoordType,'scattered')%2D field with unstructured coordinates
    699                 XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
    700                 YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
    701701                vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors
    702702                vec_Y=reshape(Data.(YName),[],1);
    703703            elseif strcmp(CellInfo{icell}.CoordType,'grid')%2D field with structured coordinates
    704                 y=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)});
    705                 x=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end)});
     704                y=Data.(YName);
     705                x=Data.(XName);
    706706                if numel(y)==2 % y defined by first and last values on aregular mesh
    707707                    y=linspace(y(1),y(2),size(vec_U,1));
     
    744744            XName=Data.ListVarName{ivar_X};
    745745            YName=Data.ListVarName{ivar_Y};
    746             eval(['Coord_x=reshape(Data.' XName ',1,[]);'])
    747             eval(['Coord_y=reshape(Data.' YName ',1,[]);'])
     746            Coord_x=reshape(Data.(XName),1,[]);
     747            Coord_y=reshape(Data.(YName),1,[]);
    748748            [A,Coord_x,Coord_y]=proj_grid(Coord_x',Coord_y',A',[],[],'np>256');  % interpolate on a grid
    749749            if isfield(Data,'VarAttribute')
     
    757757        elseif strcmp(CellInfo{icell}.CoordType,'grid')%2D field with structured coordinates
    758758            YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)};
     759            XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)};
    759760            Coord_y=Data.(YName);
    760             Coord_x=Data.(Data.ListVarName{CellInfo{icell}.CoordIndex(end)});
     761            Coord_x=Data.(XName);
    761762            test_interp_X=0; %default, regularly meshed X coordinate
    762763            test_interp_Y=0; %default, regularly meshed Y coordinate
     
    774775                DCoord_y_max=max(DCoord_y);
    775776                if sign(DCoord_y_min)~=sign(DCoord_y_max);% =1 for increasing values, 0 otherwise
    776                     errormsg=['errror in plot_field.m: non monotonic dimension variable ' Data.ListVarName{VarRole.coord(1)} ];
     777                    errormsg=['errror in plot_field.m: non monotonic dimension variable ' YName ];
    777778                    return
    778779                end
Note: See TracChangeset for help on using the changeset viewer.