Changeset 158 for trunk/src/proj_field.m
- Timestamp:
- Dec 22, 2010, 5:12:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/proj_field.m
r156 r158 87 87 end 88 88 %introduce default field properties (reading old standards) 89 if ~isfield(ObjectData,'Style')||~isfield(ObjectData,' Coord')||~isfield(ObjectData,'ProjMode')89 if ~isfield(ObjectData,'Style')||~isfield(ObjectData,'ProjMode') 90 90 ProjData=FieldData; 91 91 return 92 92 end 93 93 if ~isfield(ObjectData,'Coord') 94 if strcmp(ObjectData.Style,'plane') 95 ObjectData.Coord=[0 0 0];%default 96 else 97 ProjData=FieldData; 98 return 99 end 100 end 101 94 102 % OBSOLETE 95 103 if isfield(ObjectData,'XMax') && ~isempty(ObjectData.XMax) … … 112 120 end 113 121 %%%%%%%%%% 114 115 % FieldData=document_field(FieldData);%transform FieldData to the standard format116 % if ~isfield(FieldData,'VarAttribute')117 % FieldData.VarAttribute={};118 % end119 122 switch ObjectData.Style 120 123 case 'points' … … 138 141 [ProjData,errormsg] = proj_volume(FieldData,ObjectData); 139 142 end 140 % if exist('IndexObj','var') 141 % ProjData.IndexObj=IndexObj;%transfer object index 142 % end 143 143 144 144 145 %----------------------------------------------------------------- … … 1004 1005 1005 1006 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 1006 % group the variables (fields of 'FieldData') in cells of variables with the same dimensions1007 %% group the variables (fields of 'FieldData') in cells of variables with the same dimensions 1007 1008 %----------------------------------------------------------------- 1008 1009 idimvar=0; … … 1012 1013 return 1013 1014 end 1014 %LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS 1015 1016 % LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS 1015 1017 % CellVarIndex=cells of variable index arrays 1016 1018 ivar_new=0; % index of the current variable in the projected field … … 1036 1038 ivar_FF=VarType.errorflag; 1037 1039 testX=~isempty(ivar_X) && ~isempty(ivar_Y); 1038 %DimIndices=FieldData.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)1039 1040 DimCell=FieldData.VarDimName{VarIndex(1)}; 1040 1041 if ischar(DimCell) … … 1042 1043 end 1043 1044 1044 % case of input fields with unstructured coordinates1045 %% case of input fields with unstructured coordinates 1045 1046 if testX 1046 1047 XName=FieldData.ListVarName{ivar_X}; … … 1066 1067 indcut=find(abs(fieldZ) <= width); 1067 1068 for ivar=VarIndex 1068 VarName=FieldData.ListVarName{ivar}; 1069 % eval(['size(FieldData.' VarName ')']) 1070 eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);']) 1071 % end 1069 VarName=FieldData.ListVarName{ivar}; 1070 eval(['FieldData.' VarName '=FieldData.' VarName '(indcut);']) 1072 1071 % A VOIR : CAS DE VAR STRUCTUREE MAIS PAS GRILLE REGULIERE : INTERPOLER SUR GRILLE REGULIERE 1073 1072 end … … 1217 1216 end 1218 1217 end 1219 %case of input fields defined on a structured grid 1218 1219 %% case of input fields defined on a structured grid 1220 1220 else 1221 1221 AYName=FieldData.ListVarName{VarType.coord(1)};%name of input x coordinate (name preserved on projection) … … 1256 1256 DCoord_max=max(DCoord); 1257 1257 % test_direct(idim)=DCoord_max>0;% =1 for increasing values, 0 otherwise 1258 if ~isequal(DCoord_max,DCoord_min(idim)>0)1258 if abs(DCoord_max-DCoord_min(idim))>abs(DCoord_max/1000) 1259 1259 msgbox_uvmat('ERROR',['non monotonic dimension variable # ' num2str(idim) ' in proj_field.m']) 1260 1260 return … … 1367 1367 ProjData.ListVarName=[ProjData.ListVarName VarName]; 1368 1368 ProjData.VarDimName=[ProjData.VarDimName {DimCell}]; 1369 if length(FieldData.VarAttribute)>=ivar1369 if isfield(FieldData,'VarAttribute') && length(FieldData.VarAttribute)>=ivar 1370 1370 ProjData.VarAttribute{length(ProjData.ListVarName)}=FieldData.VarAttribute{ivar}; 1371 1371 end 1372 1372 eval(['ProjData.' VarName '=FieldData.' VarName '(min_ind1:max_ind1,min_ind2:max_ind2) ;']); 1373 end 1373 end 1374 eval(['ProjData.' AYName '=FieldData.' AYName ';']) %record the new (projected ) y coordinates 1375 eval(['ProjData.' AXName '=FieldData.' AXName ';']) %record the new (projected ) x coordinates 1374 1376 else % case with rotation and/or interpolation 1375 1377 if isempty(Coord_z) %2D case … … 1452 1454 end 1453 1455 end 1454 %projection of velocity components in the rotated coordinates 1456 1457 %% projection of velocity components in the rotated coordinates 1455 1458 if ~isequal(Phi,0) && length(ivar_U)==1 1456 1459 if isempty(ivar_V) … … 2082 2085 end 2083 2086 end 2084 if isfield(FieldData,'Coord Type')2085 if isfield(ObjectData,'Coord Type')&~isequal(FieldData.CoordType,ObjectData.CoordType)2086 errormsg=[ObjectData.Style ' in ' ObjectData.Coord Type ' coordinates, while field in ' FieldData.CoordType ' coordinates'];2087 if isfield(FieldData,'CoordUnit') 2088 if isfield(ObjectData,'CoordUnit')&~isequal(FieldData.CoordUnit,ObjectData.CoordUnit) 2089 errormsg=[ObjectData.Style ' in ' ObjectData.CoordUnit ' coordinates, while field in ' FieldData.CoordUnit ]; 2087 2090 return 2088 2091 else 2089 ProjData.Coord Type=FieldData.CoordType;2092 ProjData.CoordUnit=FieldData.CoordUnit; 2090 2093 end 2091 2094 end
Note: See TracChangeset
for help on using the changeset viewer.