Changeset 890
- Timestamp:
- Apr 18, 2015, 11:03:01 PM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 2 added
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/find_field_cells.m
r809 r890 210 210 % 2)the coordinate variable contains only two elements, representing the coordinate bounds for the dimension with the same name as the cordinate 211 211 ivar_remain=find(~check_select);% indices of remaining variables, not already taken into account 212 ListVarName=Data.ListVarName(~check_select);%list of remaining variables212 ListVarName=Data.ListVarName(~check_select);%list of names of remaining variables 213 213 VarDimName=Data.VarDimName(~check_select);%dimensions of remaining variables 214 214 check_coord_select= cellfun(@numel,VarDimName)==1|cellfun(@ischar,VarDimName)==1;% find remaining variables with a single dimension 215 215 check_coord_select=check_coord_select & ~strcmp('ancillary',Role(~check_select));% do not select ancillary variables as coordinates 216 %check_coord(~check_select)=check_coord_select;217 216 ListCoordIndex=ivar_remain(check_coord_select);% indices of remaining variables with a single dimension 218 217 ListCoordName=ListVarName(check_coord_select);% corresponding names of remaining variables with a single dimension … … 220 219 221 220 %remove redondant variables -> keep only one variable per dimension 222 check_keep= logical(ones(size(ListDimName)));221 check_keep=true(size(ListDimName)); 223 222 for idim=1:numel(ListDimName) 224 prev_ind= strcmp(ListDimName{idim},ListDimName(1:idim-1));% check whether the dimension is already taken into account225 if ~isempty(prev_ind) 223 prev_ind=find(strcmp(ListDimName{idim},ListDimName(1:idim-1)));% check whether the dimension is already taken into account 224 if ~isempty(prev_ind)% in case of multiple coord variable 226 225 if strcmp(ListCoordName{idim},ListDimName{idim}) %variable with the same name as the coordinate taken in priority 227 check_keep(prev_ind)=0; 226 check_keep(prev_ind)=0;% choose a variable with the same name as coordinate in priority 228 227 else 229 check_keep(idim)=0; 228 check_keep(idim)=0; %keep the first coordiante variable found 230 229 end 231 230 end … … 256 255 NewCellDimIndex={}; 257 256 NewNbDim=[]; 258 for ivardim=1:numel(VarDimName) % loop at the list of remaining variables257 for ivardim=1:numel(VarDimName) % loop at the list of dimensions for the remaining variables 259 258 DimCell=VarDimName{ivardim};% dimension names of the current variable 260 259 if ischar(DimCell), DimCell={DimCell}; end %transform char to cell if needed -
trunk/src/get_field.m
r879 r890 951 951 % --- Executes on button press in CheckDimensionY. 952 952 function CheckDimensionX_Callback(hObject, eventdata, handles) 953 FieldList=get(handles.FieldOption,'String'); 954 FieldOption=FieldList{get(handles.FieldOption,'Value')}; 955 switch FieldOption 956 case '1D plot' 957 958 case {'scalar'} 959 scalar_Callback(hObject, eventdata, handles) 960 case 'vectors' 961 end 953 CheckDimensionX=get(handles.CheckDimensionX,'value') 954 if CheckDimensionX 955 set(handles.Coordinates,'visible','off') 956 else 957 set(handles.Coordinates,'visible','on') 958 end 959 % FieldList=get(handles.FieldOption,'String'); 960 % FieldOption=FieldList{get(handles.FieldOption,'Value')}; 961 % switch FieldOption 962 % case '1D plot' 963 % 964 % case {'scalar'} 965 % scalar_Callback(hObject, eventdata, handles) 966 % case 'vectors' 967 % end 962 968 963 969 % % --- Executes on button press in CheckDimensionY. -
trunk/src/proj_field.m
r888 r890 123 123 end 124 124 125 % %% take the difference of projected input fields if relevant126 % [CellInfo,NbDim,errormsg]=find_field_cells(ProjData);127 % ind_remove=zeros(size(ProjData.ListVarName));128 % ivar=[];129 % ivar_1=[];130 % for icell=1:numel(CellInfo)131 % if ~isempty(CellInfo{icell})132 % % if two scalar are in the same cell133 % if isfield(CellInfo{icell},'VarIndex_scalar') && numel(CellInfo{icell}.VarIndex_scalar)==2 && ProjData.VarAttribute{CellInfo{icell}.VarIndex_scalar(2)}.CheckSub;134 % ivar=[ivar CellInfo{icell}.VarIndex_scalar(1)];135 % ivar_1=[ivar_1 CellInfo{icell}.VarIndex_scalar(2)];136 % end137 % % if two vector u components are in the same cell138 % if isfield(CellInfo{icell},'VarIndex_vector_x') && numel(CellInfo{icell}.VarIndex_vector_x)==2 && ProjData.VarAttribute{CellInfo{icell}.VarIndex_vector_x(2)}.CheckSub;139 % ivar=[ivar CellInfo{icell}.VarIndex_vector_x(1)];140 % ivar_1=[ivar_1 CellInfo{icell}.VarIndex_vector_x(2)];141 % end142 % % if two vector v components are in the same cell143 % if isfield(CellInfo{icell},'VarIndex_vector_y') && numel(CellInfo{icell}.VarIndex_vector_y)==2 && ProjData.VarAttribute{CellInfo{icell}.VarIndex_vector_y(2)}.CheckSub;144 % ivar=[ivar CellInfo{icell}.VarIndex_vector_y(1)];145 % ivar_1=[ivar_1 CellInfo{icell}.VarIndex_vector_y(2)];146 % end147 % end148 % end149 % % subtract fields if relevant150 % for imod=1:numel(ivar)151 % VarName=ProjData.ListVarName{ivar(imod)};152 % VarName_1=ProjData.ListVarName{ivar_1(imod)};153 % ProjData.(VarName)=double(ProjData.(VarName))-double(ProjData.(VarName_1));154 % ind_remove(ivar_1(imod))=1;155 % end156 % ProjData.ListVarName(find(ind_remove))=[];157 % ProjData.VarDimName(find(ind_remove))=[];158 % ProjData.VarAttribute(find(ind_remove))=[];159 160 125 %----------------------------------------------------------------- 161 126 %project on a set of points … … 1143 1108 end 1144 1109 [XI,YI]=meshgrid(coord_x_proj,coord_y_proj);%grid in the new coordinates 1110 ProjData.VarDimName={AYName,AXName}; 1145 1111 % XI=ObjectData.Coord(1,1)+(X)*cos(PlaneAngle(3))-YI*sin(PlaneAngle(3));%corresponding coordinates in the original system 1146 1112 % YI=ObjectData.Coord(1,2)+(X)*sin(PlaneAngle(3))+YI*cos(PlaneAngle(3)); … … 1149 1115 AYName=FieldData.ListVarName{CellInfo{icell_grid}.CoordIndex(NbDim-1)};%name of input x coordinate (name preserved on projection) 1150 1116 AXName=FieldData.ListVarName{CellInfo{icell_grid}.CoordIndex(NbDim)};%name of input y coordinate (name preserved on projection) 1117 AYDimName=FieldData.VarDimName{CellInfo{icell_grid}.CoordIndex(NbDim-1)};% 1118 AXDimName=FieldData.VarDimName{CellInfo{icell_grid}.CoordIndex(NbDim)};% 1119 ProjData.VarDimName={AYDimName,AXDimName}; 1151 1120 ProjData.(AYName)=FieldData.(AYName); % new (projected ) y coordinates 1152 1121 ProjData.(AXName)=FieldData.(AXName); % new (projected ) y coordinates 1153 1122 end 1154 1123 ProjData.ListVarName={AYName,AXName}; 1155 ProjData.VarDimName={AYName,AXName};1124 1156 1125 ProjData.VarAttribute={[],[]}; 1157 1126 end -
trunk/src/read_field.m
r880 r890 80 80 case 'civdata'% new format for civ results 81 81 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType); 82 if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end 83 % if ~isempty(strcmp('C',ParamIn.FieldName))% if C image correlation is requested as field (not color visu) 84 % ScalarIndex=strcmp('C',Field.ListVarName); 85 % Field.VarAttribute{ScalarIndex}.Role='scalar';%put role as 'scalar' instead of ancillary 86 % end 82 if ~isempty(errormsg),errormsg=['read_civdata / ' errormsg];return,end 87 83 ParamOut.CivStage=Field.CivStage; 88 84 case 'civx'% old (obsolete) format for civ results … … 128 124 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 129 125 ListInputField=[ListInputField InputField(ilist)]; 130 %ListOperator=[ListOperator {[r.Operator '_U']}];131 126 else 132 127 checkU=1; … … 137 132 ProjModeRequest=[ProjModeRequest {ProjModeRequestVar}]; 138 133 ListInputField=[ListInputField InputField(ilist)]; 139 %ListInputField=[ListInputField {''}];134 140 135 else 141 136 checkV=1; … … 211 206 end 212 207 end 208 % insert coordinates as indices in case of plots vs matrix index 209 if isfield(ParamIn,'CheckCoordIndex') && ParamIn.CheckCoordIndex 210 Field.ListVarName=[Field.ListDimName Field.ListVarName]; 211 Field.VarDimName=[Field.ListDimName Field.VarDimName]; 212 for idim=1:numel(Field.ListDimName) 213 CoordName=Field.ListDimName{idim}; 214 Field.(CoordName)=1:Field.DimValue(idim); 215 end 216 Field.VarAttribute=[cell(1,numel(Field.ListDimName)) Field.VarAttribute] 217 end 213 218 case 'video' 214 219 if strcmp(class(ParamIn),'VideoReader') -
trunk/src/uvmat.m
r874 r890 3249 3249 ParamIn.Coord_y=get(handles.Coord_y,'String'); 3250 3250 ParamIn.Coord_z=get(handles.Coord_z,'String'); 3251 ParamIn.CheckCoordIndex=strcmp(get(handles.SwitchCoordIndex,'String'),'dim'); 3251 3252 TimeName=get(handles.TimeName,'String'); 3252 3253 r=regexp(TimeName,'^(?<type>(dim:)|(var:))','names');%look for 'var:' or 'dim:' at the beginning of time name … … 3260 3261 end 3261 3262 end 3262 % check_tps = 0; 3263 % if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamIn.FieldName,'velocity')&&~strcmp(ParamIn.FieldName,'get_field...') 3264 % check_tps=1;%tps needed to get the requested field 3265 % end 3263 3266 3264 [Field{1},ParamOut,errormsg] = read_field(FileName,UvData.FileType{1},ParamIn,frame_index); 3267 3265 if ~isempty(errormsg) … … 4270 4268 FieldList={}; 4271 4269 VecColorList={''}; 4270 XName=''; 4271 YName=''; 4272 4272 ZName=''; 4273 4273 switch GetFieldData.FieldOption … … 4275 4275 UName=GetFieldData.PanelVectors.vector_x; 4276 4276 VName=GetFieldData.PanelVectors.vector_y; 4277 YName=GetFieldData.Coordinates.Coord_y; 4278 if isfield(GetFieldData.Coordinates,'Coord_z') 4279 ZName=GetFieldData.Coordinates.Coord_z; 4280 end 4277 if isfield(GetFieldData,'Coordinates') 4278 YName=GetFieldData.Coordinates.Coord_y; 4279 if isfield(GetFieldData.Coordinates,'Coord_z') 4280 ZName=GetFieldData.Coordinates.Coord_z; 4281 end 4282 end 4281 4283 CName=GetFieldData.PanelVectors.vec_color; 4282 4284 FieldList={['vec(' UName ',' VName ')'];... … … 4290 4292 case 'scalar' 4291 4293 AName=GetFieldData.PanelScalar.scalar; 4292 YName=GetFieldData.Coordinates.Coord_y; 4293 if isfield(GetFieldData.Coordinates,'Coord_z') 4294 ZName=GetFieldData.Coordinates.Coord_z; 4294 if isfield(GetFieldData,'Coordinates') 4295 YName=GetFieldData.Coordinates.Coord_y; 4296 if isfield(GetFieldData.Coordinates,'Coord_z') 4297 ZName=GetFieldData.Coordinates.Coord_z; 4298 end 4295 4299 end 4296 4300 FieldList={AName}; … … 4302 4306 % get time as file index, attribute, variable or matrix index 4303 4307 if ~strcmp(GetFieldData.FieldOption,'civdata...') 4304 XName=GetFieldData.Coordinates.Coord_x; 4308 if isfield(GetFieldData,'Coordinates') 4309 XName=GetFieldData.Coordinates.Coord_x; 4310 set(handles.SwitchCoordIndex,'String','var'); % variable used as coordinate 4311 else 4312 set(handles.SwitchCoordIndex,'String','dim'); % matrix index used a coordinate 4313 end 4305 4314 TimeNameStr=GetFieldData.Time.SwitchVarIndexTime; 4306 4315 switch TimeNameStr
Note: See TracChangeset
for help on using the changeset viewer.