Changeset 389 for trunk/src/plot_field.m


Ignore:
Timestamp:
Apr 8, 2012, 11:11:38 PM (12 years ago)
Author:
sommeria
Message:

several bugs corrected: object managing, tps filter...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/plot_field.m

    r388 r389  
    156156        set(htext,'String',{''})
    157157    else
    158         [errormsg]=plot_text(Data,CellVarIndex(index_0D),htext);
     158        [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext);
    159159    end
    160160    haxes=[];
     
    244244            set(htext,'String',{''})
    245245        else
    246             [errormsg]=plot_text(Data,CellVarIndex(index_0D),htext);
     246            [errormsg]=plot_text(Data,CellVarIndex(index_0D),VarType(index_0D),htext);
    247247        end
    248248    end
     
    276276
    277277%-------------------------------------------------------------------
    278 function errormsg=plot_text(FieldData,CellVarIndex,htext)
     278function errormsg=plot_text(FieldData,CellVarIndex,VarTypeCell,htext)
    279279%-------------------------------------------------------------------
    280280errormsg=[];
     
    283283    VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list data.ListVarName
    284284    for ivar=1:length(VarIndex)
    285          VarName=FieldData.ListVarName{VarIndex(ivar)};
    286          VarValue=FieldData.(VarName);
    287          if size(VarValue,1)~=1
    288              VarValue=VarValue';
    289          end
    290          txt=[VarName '=' num2str(VarValue)];
    291          txt_cell=[txt_cell;{txt}];
     285        checkancillary=0;
     286        if length(FieldData.VarAttribute)>=VarIndex(ivar)
     287            VarAttribute=FieldData.VarAttribute{VarIndex(ivar)};
     288            if isfield(VarAttribute,'Role')&&strcmp(VarAttribute.Role,'ancillary')
     289                checkancillary=1;
     290            end
     291        end
     292        if ~checkancillary% does not display variables with attribute '.Role=ancillary'
     293            VarName=FieldData.ListVarName{VarIndex(ivar)};
     294            VarValue=FieldData.(VarName);
     295            if size(VarValue,1)~=1
     296                VarValue=VarValue';
     297            end
     298            txt=[VarName '=' num2str(VarValue)];
     299            txt_cell=[txt_cell;{txt}];
     300        end
    292301    end
    293302end
     
    11781187siz2=1;
    11791188while siz2<2
    1180 %     values=[-9:div:9];
    11811189    values=-10:div:10;
    11821190    ind=find((ord*values-MaxA)<0 & (ord*values-MinA)>0);%indices of 'values' such that MinA<ord*values<MaxA
     
    11871195    end
    11881196    siz2=size(ind,2);
    1189 %     siz2=siz(2)
    11901197    div=div/10;
    11911198end
     
    11931200end
    11941201
    1195 %'proj_grid': project  fields with unstructured coordinantes on a regular grid
    11961202% -------------------------------------------------------------------------
    1197 % function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in)
    1198 
    1199 
     1203% --- 'proj_grid': project  fields with unstructured coordinantes on a regular grid
    12001204function [A,rangx,rangy]=proj_grid(vec_X,vec_Y,vec_A,rgx_in,rgy_in,npxy_in)
     1205% -------------------------------------------------------------------------
    12011206if length(vec_Y)<2
    12021207    msgbox_uvmat('ERROR','less than 2 points in proj_grid.m');
     
    12121217        rangx=rgx_in; % first and last positions
    12131218        rangy=rgy_in;
    1214 %             npxy=npxy_in;
    12151219        dxy(1)=1/(npxy_in(1)-1);%grid mesh in y
    12161220        dxy(2)=1/(npxy_in(2)-1);%grid mesh in x
     
    12271231    xi=[rangx(1):dxy(2):rangx(2)];
    12281232    yi=[rangy(1):dxy(1):rangy(2)];
    1229     [XI,YI]=meshgrid(xi,yi);% creates the matrix of regular coordinates
    12301233    A=griddata_uvmat(vec_X,vec_Y,vec_A,xi,yi');
    12311234    A=reshape(A,length(yi),length(xi));
     
    12351238    ymax=vec_Y(indexend+1);% y coordinate AFTER line change
    12361239    ymin=vec_Y(index(1));
    1237     %y=[vec_Y(index) ymax]; % the set of y ordinates including the last one
    12381240    y=vec_Y(index);
    12391241    y(length(y)+1)=ymax;
     
    12521254    else       
    12531255        rangx=[vec_X(1) vec_X(nx)];% first and last position found for x
    1254 %             rangy=[ymin ymax];
    12551256          rangy=[max(ymax,ymin) min(ymax,ymin)];
    12561257        if max(nx,ny) <= 64 & isequal(npxy_in,'np>256')
     
    12721273    else %no interpolation for a resolution higher than 256
    12731274        A=B;
    1274         XI=X;
    1275         YI=Y;
    1276     end
    1277 end
     1275    end
     1276end
Note: See TracChangeset for help on using the changeset viewer.