Changeset 1001 for trunk/src/plot_field.m
- Timestamp:
- Feb 27, 2017, 9:28:27 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r977 r1001 696 696 vec_U=Data.(Data.ListVarName{CellInfo{icell}.VarIndex_vector_x}); 697 697 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)}; 698 700 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)};701 701 vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors 702 702 vec_Y=reshape(Data.(YName),[],1); 703 703 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); 706 706 if numel(y)==2 % y defined by first and last values on aregular mesh 707 707 y=linspace(y(1),y(2),size(vec_U,1)); … … 744 744 XName=Data.ListVarName{ivar_X}; 745 745 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,[]); 748 748 [A,Coord_x,Coord_y]=proj_grid(Coord_x',Coord_y',A',[],[],'np>256'); % interpolate on a grid 749 749 if isfield(Data,'VarAttribute') … … 757 757 elseif strcmp(CellInfo{icell}.CoordType,'grid')%2D field with structured coordinates 758 758 YName=Data.ListVarName{CellInfo{icell}.CoordIndex(end-1)}; 759 XName=Data.ListVarName{CellInfo{icell}.CoordIndex(end)}; 759 760 Coord_y=Data.(YName); 760 Coord_x=Data.( Data.ListVarName{CellInfo{icell}.CoordIndex(end)});761 Coord_x=Data.(XName); 761 762 test_interp_X=0; %default, regularly meshed X coordinate 762 763 test_interp_Y=0; %default, regularly meshed Y coordinate … … 774 775 DCoord_y_max=max(DCoord_y); 775 776 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 ]; 777 778 return 778 779 end
Note: See TracChangeset
for help on using the changeset viewer.