Changeset 380
- Timestamp:
- Jan 29, 2012, 2:31:56 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r247 r380 64 64 RoleList={}; 65 65 units_cell={}; 66 % new civ data 66 67 %% interpolation with new civ data 67 68 if isfield(DataIn,'X_SubRange') 68 69 XMax=max(max(DataIn.X_SubRange)); … … 88 89 DataOut.V=zeros(size(XI)); 89 90 DataOut.vort=zeros(size(XI)); 91 90 92 DataOut.div=zeros(size(XI)); 91 93 nbval=zeros(size(XI)); … … 126 128 ListFields={'vort'}; 127 129 VarAttributes{1}.Role='scalar'; 128 % EMX = [DMXY(:,:,1) PM];129 % EMY = [DMXY(:,:,2) PM];130 % DataIn.U_tps(nbvec_sub+1,isub)=0;%constant value suppressed by spatial derivatives131 % DataIn.V_tps(nbvec_sub+1,isub)=0;%constant value suppressed by spatial derivatives132 % DataIn.V_tps(nbvec_sub+2,isub)=0;% X coefficient suppressed for x wise derivatives133 % DataIn.U_tps(nbvec_sub+3,isub)=0;% Y coefficient suppressed for x wise derivatives134 130 DataOut.vort(ind_sel)=DataOut.vort(ind_sel)+EMDY *DataIn.U_tps(1:nbvec_sub+3,isub)-EMDX *DataIn.V_tps(1:nbvec_sub+3,isub); 135 131 case 'div' 136 132 ListFields={'div'}; 137 133 VarAttributes{1}.Role='scalar'; 138 % EMX = [DMXY(:,:,1) PM];139 % EMY = [DMXY(:,:,2) PM];140 % DataIn.U_tps(nbvec_sub+1,isub)=0;%constant value suppressed by spatial derivatives141 % DataIn.V_tps(nbvec_sub+1,isub)=0;%constant value suppressed by spatial derivatives142 % DataIn.V_tps(nbvec_sub+2,isub)=0;% X coefficient suppressed for x wise derivatives143 % DataIn.U_tps(nbvec_sub+3,isub)=0;% Y coefficient suppressed for x wise derivatives144 134 DataOut.div(ind_sel)=DataOut.div(ind_sel)+EMDX*DataIn.U_tps(1:nbvec_sub+3,isub)+EMDY *DataIn.V_tps(1:nbvec_sub+3,isub); 145 135 end … … 161 151 DataOut.VarAttribute={[],[]}; 162 152 DataOut.VarAttribute{3}.Role='errorflag'; 163 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 153 DataOut.VarAttribute=[DataOut.VarAttribute VarAttributes]; 164 154 else 155 156 %% civx data 165 157 DataOut=DataIn; 166 158 for ilist=1:length(FieldName) -
trunk/src/check_files.m
r375 r380 52 52 'editxml.fig';...%interface for editxml 53 53 'fileparts_uvmat';...% extracts the root name,field indexes and nomenclature type from an input filename 54 'fill_GUI';...% fill a GUI with handles 'handles' from input data Param 54 55 'find_field_indices';...% group the variables of a nc-formated Matlab structure into 'fields' with common dimensions 55 56 'find_file_series';...%check the content of an input file and find the corresponding file series … … 59 60 'get_field';...% choose and plot a field from a Netcdf file 60 61 'get_field.fig';...%interface for get_field 62 'get_file_series';...% determine the list of file names and file indices for functions called by 'series'. 63 'get_file_type';...% determine info about a file (image, multimage, civdata,...) . 61 64 'griddata_uvmat';...%make 2D linear interpolation using griddata, with input appropriate for both Matlab 6.5 and 7 62 65 'hist_update';...% update of a current global histogram by inclusion of a new field … … 83 86 'read_GUI';... %read all parameters set by a GUI as a Matlab structure 84 87 'read_imatext';...%read .civ files (obsolete, but can be adapted to other text documentation files) 85 'read_set_object';...%read the data on the set_object interface, TODO: use instead the general function read_GUI86 88 'read_xls';...%read excel files containing the list of the experiments 87 89 'reinit';...% suppress the personal parameter file 'uvmat_perso.mat' -
trunk/src/fill_GUI.m
r379 r380 1 %'fill_GUI': fill a GUI with handles 'handles' from input data Param 1 2 % ----------------------------------------------------------------------- 2 % --- read a GUI with handle 'handle' producing a structure 'struct'3 3 function errormsg=fill_GUI(Param,handles) 4 4 %------------------------------------------------------------------------ -
trunk/src/get_file_type.m
r376 r380 1 %'get_file_series': determine the list of file names and file indices for functions called by 'series'.1 %'get_file_type': determine info about a file (image, multimage, civdata,...) . 2 2 %------------------------------------------------------------------------ 3 % [ filecell,i1_series,i2_series,j1_series,j2_series]=get_file_series(Param)3 % [FileType,FileInfo,Object]=get_file_type(fileinput) 4 4 % 5 5 % OUTPUT: -
trunk/src/read_civdata.m
r379 r380 47 47 % 'nc2struct': reads a netcdf file 48 48 49 function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType, XI,YI)49 function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType,CivStage) 50 50 errormsg=''; 51 51 VelTypeOut=VelType;%default … … 65 65 66 66 %% reading data 67 [varlist,role,units, vel_type_out_cell]=varcivx_generator(FieldNames,VelType);68 [Field,vardetect ,ichoice]=nc2struct(filename,varlist);%read the variables in the netcdf file67 [varlist,role,units,VelTypeOut]=varcivx_generator(FieldNames,VelType,CivStage); 68 [Field,vardetect]=nc2struct(filename,varlist);%read the variables in the netcdf file 69 69 if isfield(Field,'Txt') 70 70 errormsg=Field.Txt; … … 75 75 return 76 76 end 77 switch vel_type_out_cell{ichoice}78 case{'civ1',' fix1','patch1'}79 Field. dt=Field.Civ1_Dt;80 case{'civ2',' fix2','patch2'}81 Field. dt=Field.Civ2_Dt;77 switch VelTypeOut 78 case{'civ1','civ-filter1','filter1'} 79 Field.Dt=Field.Civ1_Dt; 80 case{'civ2','civ-filter2','filter2'} 81 Field.Dt=Field.Civ2_Dt; 82 82 end 83 Field.ListGlobalAttribute=[Field.ListGlobalAttribute {' dt'}];83 Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'Dt'}]; 84 84 var_ind=find(vardetect); 85 85 for ivar=1:min(numel(var_ind),numel(Field.VarAttribute)) … … 88 88 Field.VarAttribute{ivar}.Mesh=0.1;%typical mesh for histograms O.1 pixel 89 89 end 90 if ~isempty(ichoice)91 VelTypeOut=vel_type_out_cell{ichoice};92 end93 90 94 95 %% renaming for standard conventions96 %Field.NbCoord=Field.nb_coord;97 %Field.NbDim=2;%Field.nb_dim;98 99 %% CivStage100 % if isfield(Field,'patch2')&& isequal(Field.patch2,1)101 % Field.CivStage=6;102 % elseif isfield(Field,'fix2')&& isequal(Field.fix2,1)103 % Field.CivStage=5;104 % elseif isfield(Field,'civ2')&& isequal(Field.civ2,1)105 % Field.CivStage=4;106 % elseif isfield(Field,'patch')&& isequal(Field.patch,1)107 % Field.CivStage=3;108 % elseif isfield(Field,'fix')&& isequal(Field.fix,1)109 % Field.CivStage=2;110 % else111 % Field.CivStage=1;112 % end113 91 Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'NbCoord','NbDim','TimeUnit','CoordUnit'}]; 114 % %determine the appropriate constant for time and dt for the PIV pair115 % test_civ1=isequal(VelTypeOut,'civ1')||isequal(VelTypeOut,'interp1')||isequal(VelTypeOut,'filter1');116 % test_civ2=isequal(VelTypeOut,'civ2')||isequal(VelTypeOut,'interp2')||isequal(VelTypeOut,'filter2');117 % Field.Time=0; %default118 % Field.TimeUnit='s';119 % if test_civ1120 % if isfield(Field,'absolut_time_T0')121 % Field.Time=double(Field.absolut_time_T0);122 % Field.dt=double(Field.dt);123 % else124 % Field.Txt='the input file is not civx';125 % Field.CivStage=0;126 % Field.dt=0;127 % end128 % elseif test_civ2129 % Field.Time=double(Field.absolut_time_T0_2);130 % Field.dt=double(Field.dt2);131 % else132 % Field.Txt='the input file is not civx';133 % Field.CivStage=0;134 % Field.dt=0;135 % end136 %137 %138 %139 92 % %% update list of global attributes 140 % List=Field.ListGlobalAttribute;141 % ind_remove=[];142 % for ilist=1:length(List)143 % switch(List{ilist})144 % case {'patch2','fix2','civ2','patch','fix','dt2','absolut_time_T0','absolut_time_T0_2','nb_coord','nb_dim','pixcmx','pixcmy'}145 % ind_remove=[ind_remove ilist];146 % Field=rmfield(Field,List{ilist});147 % end148 % end149 % List(ind_remove)=[];150 % Field.ListGlobalAttribute=[{'NbCoord'},{'NbDim'} List {'Time','TimeUnit','CivStage','CoordUnit'}];151 93 Field.NbCoord=2; 152 94 Field.NbDim=2; … … 157 99 158 100 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 159 % TAKEN FROM read_civxdata NOT USED160 101 % [var,role,units,vel_type_out]=varcivx_generator(FieldNames,vel_type) 161 102 %INPUT: … … 166 107 % 167 108 % vel_type: character string indicating the types of velocity fields to read ('civ1','civ2'...) 168 % if vel_type=[] or'*', a priority choice, given by vel_type_out{1,2}, is done depending 169 % if vel_type='filter'; a structured field is sought (filter2 in priority, then filter1) 109 % if vel_type=[] or'*', a priority choice is done, civ2 considered better than civ1 ) 170 110 171 function [var,role,units,vel_type_out]=varcivx_generator(FieldNames,vel_type )111 function [var,role,units,vel_type_out]=varcivx_generator(FieldNames,vel_type,CivStage) 172 112 173 113 %% default input values … … 187 127 case {'vort','div','strain'} 188 128 testder=1; 129 189 130 end 190 131 end 191 132 end 133 134 if isempty(vel_type) 135 switch CivStage 136 case {6} %filter2 available 137 vel_type='civ2'; 138 case {4,5}% civ2 available but not filter2 139 if testder% derivatives needed 140 vel_type='civ1'; 141 else 142 vel_type='civ2'; 143 end 144 case {1,2,3}% civ1 available but not civ2 145 vel_type='civ1'; 146 end 147 end 148 if strcmp(vel_type,'civ2') && testder 149 vel_type='filter2'; 150 elseif stcmp(vel_type,'civ1') && testder 151 vel_type='filter1'; 152 end 153 192 154 switch vel_type 193 case 'civ1' 194 var={'X','Y','Z','U','V','W','C','F','FF';... 195 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'}; 196 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 197 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 198 case 'interp1' 155 case {'civ1'} 156 var={'X','Y','Z','U','V','W','C','F','FF','X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';... 157 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF',... 158 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'}; 159 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','','',''}; 160 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 161 case 'civ-filter1' 199 162 var={'X','Y','Z','U','V','W','FF';... 200 163 'Civ1_X','Civ1_Y','','Civ1_U_Diff','Civ1_V_Diff','','Civ1_FF'}; … … 207 170 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 208 171 case 'civ2' 209 var={'X','Y','Z','U','V','W','C','F','FF';... 210 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 211 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 212 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 213 case 'interp2' 172 var={'X','Y','Z','U','V','W','C','F','FF','X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';... 173 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF',... 174 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites'}; 175 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag','','','','','','','','',''}; 176 units={'pixel','pixel','pixel','pixel','pixel','pixel','','','','pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 177 % var={'X','Y','Z','U','V','W','C','F','FF';... 178 % 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF'}; 179 % role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'}; 180 % units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]}; 181 case 'civ-filter2' 214 182 var={'X','Y','Z','U','V','W','FF';... 215 183 'Civ2_X','Civ2_Y','','Civ2_U_Diff','Civ2_V_Diff','','Civ2_FF'}; … … 221 189 role={'','','','','','','','',''}; 222 190 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel',''}; 223 otherwise % if VelType=[], choose the best field, civ in priority, or patch2 for derivatives224 if testpatch225 var={'X_tps','Y_tps','Z_tps','U_tps','V_tps','W_tps','X_SubRange','Y_SubRange','NbSites';...226 'Civ2_X_tps','Civ2_Y_tps','','Civ2_U_tps','Civ2_V_tps','','Civ2_X_SubRange','Civ2_Y_SubRange','Civ2_NbSites';...227 'Civ1_X_tps','Civ1_Y_tps','','Civ1_U_tps','Civ1_V_tps','','Civ1_X_SubRange','Civ1_Y_SubRange','Civ1_NbSites'};228 role={'','','','','','','',''};229 units={'pixel','pixel','pixel','pixel','pixel','pixel','pixel','pixel'};230 else231 var={'X','Y','Z','U','V','W','C','F','FF';...232 'Civ2_X','Civ2_Y','Civ2_Z','Civ2_U','Civ2_V','Civ2_W','Civ2_C','Civ2_F','Civ2_FF';...233 'Civ1_X','Civ1_Y','Civ1_Z','Civ1_U','Civ1_V','Civ1_W','Civ1_C','Civ1_F','Civ1_FF'};234 role={'coord_x','coord_y','coord_z','vector_x','vector_y','vector_z','ancillary','warnflag','errorflag'};235 units={'pixel','pixel','pixel','pixel','pixel','pixel',[],[],[]};236 end237 191 end 238 if isempty(vel_type) || isequal(vel_type,'*') %undefined velocity type (civ1,civ2...) 239 if testder 240 vel_type_out{1}='filter2'; %priority to filter2 for scalar reading, filter1 as second 241 vel_type_out{2}='filter1'; 242 else 243 vel_type_out{1}='civ2'; %priority to civ2 for vector reading, civ1 as second priority 244 vel_type_out{2}='civ1'; 245 end 246 elseif isequal(vel_type,'filter') 247 vel_type_out{1}='filter2'; %priority to filter2 for scalar reading, filter1 as second 248 vel_type_out{2}='filter1'; 249 if ~testder 250 vel_type_out{3}='civ1';%civ1 as third priority if derivatives are not needed 251 end 252 elseif testder 253 test_civ1=isequal(vel_type,'civ1')||isequal(vel_type,'interp1')||isequal(vel_type,'filter1'); 254 if test_civ1 255 vel_type_out{1}='filter1'; %switch to filter for reading spatial derivatives 256 else 257 vel_type_out{1}='filter2'; 258 end 259 else 260 vel_type_out{1}=vel_type;%imposed velocity field 261 end 262 vel_type_out=vel_type_out'; 192 vel_type_out=vel_type; 263 193 264 194 … … 266 196 267 197 268 -
trunk/src/read_civxdata.m
r247 r380 49 49 function [Field,VelTypeOut,errormsg]=read_civxdata(filename,FieldNames,VelType) 50 50 errormsg=''; 51 DataTest=nc2struct(filename,'ListGlobalAttribute','Conventions' );51 DataTest=nc2struct(filename,'ListGlobalAttribute','Conventions','CivStage'); 52 52 if isfield(DataTest,'Txt') 53 errormsg=DataTest.Txt; 53 errormsg=DataTest.Txt; 54 return 54 55 elseif isequal(DataTest.Conventions,'uvmat/civdata')%test for new civ format 55 [Field,VelTypeOut]=read_civdata(filename,FieldNames,VelType); 56 [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType,DataTest.CivStage); 57 % if ~isempty(errormsg) 58 % msgbox_uvmat('ERROR',errormsg) 59 % end 56 60 return 57 61 end -
trunk/src/read_field.m
r379 r380 56 56 field_index=strcmp(ParamIn.FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 57 57 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 58 Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ' );58 Data=nc2struct(ObjectName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 59 59 % case of new civdata conventions 60 60 if isequal(Data.Conventions,'uvmat/civdata') … … 62 62 ParamOut.ColorVar='ima_cor'; 63 63 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 64 [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType );64 [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage); 65 65 test_civx=Field.CivStage; 66 66 %case of old civx conventions -
trunk/src/uvmat.m
r379 r380 2103 2103 set(handles.VelType_1,'Visible','on') 2104 2104 set(handles.FixVelType,'Visible','on') 2105 menu=set_veltype_display(ParamOut.CivStage );2105 menu=set_veltype_display(ParamOut.CivStage,FileType); 2106 2106 index_menu=strcmp(ParamOut.VelType,menu);%look for VelType in the menu 2107 2107 index_val=find(index_menu,1); … … 2193 2193 end 2194 2194 end 2195 2196 % menu_transform=get(handles.transform_fct,'String');2197 2195 choice_value=get(handles.transform_fct,'Value'); 2198 2196 transform_list=get(handles.transform_fct,'UserData'); … … 2807 2805 set(handles.VelType_1,'Visible','off') 2808 2806 end 2809 % set_veltype_display([handles.VelType_1 handles.interp1_1 handles.filter1_1 ...2810 % handles.civ2_1 handles.interp2_1 handles.filter2_1],0)2811 2807 if isfield(UvData,'XmlData_1') 2812 2808 UvData=rmfield(UvData,'XmlData_1'); … … 3056 3052 %------------------------------------------------------------------------ 3057 3053 % --- set the visibility of relevant velocity type menus: 3058 function menu=set_veltype_display(Civ )3054 function menu=set_veltype_display(Civ,FileType) 3059 3055 %------------------------------------------------------------------------ 3060 3056 if isequal(Civ,0) … … 3069 3065 imax=6; 3070 3066 end 3067 if ~exist('FileType','var') 3068 FileType='civx'; 3069 end 3070 switch FileType 3071 case 'civx' 3071 3072 menu={'civ1';'interp1';'filter1';'civ2';'interp2';'filter2'}; 3073 case 'civdata' 3074 menu={'civ1';'civ-filter1';'filter1';'civ2';'civ-filter2';'filter2'}; 3075 end 3072 3076 menu=menu(1:imax); 3073 3077
Note: See TracChangeset
for help on using the changeset viewer.