- Timestamp:
- May 27, 2010, 7:25:58 PM (15 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/get_field/FFT.m
r89 r93 6 6 return %exit the function 7 7 end 8 8 GUI_input=[]; 9 9 %initiation 10 10 hhget_field=guidata(hget_field); … … 29 29 % get variable 30 30 eval(['Var= Field.' ordinate_name ';']); 31 np=size(Var) ;31 np=size(Var) 32 32 np_freq=floor(np(1)/2); 33 33 dx=1;%default 34 34 dfreq=1/np(1);%default frequency interval (abscissa= array index) 35 sum_data=sum(Var,2); 35 36 if ~isequal(abscissa_name,'') 36 37 eval(['Coord_x= Field.' abscissa_name ';']); 37 ind_select=find(~isinf(Coord_x) );%detect infinite values38 ind_select=find(~isinf(Coord_x)&~isnan(sum_data));%detect infinite values 38 39 Coord_x=Coord_x(ind_select); 39 40 Var=Var(ind_select,:); -
trunk/src/plot_field.m
r92 r93 172 172 % check the cells of fields : 173 173 % testnbdim=1; 174 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data) ;174 [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data) 175 175 176 176 if ~isempty(errormsg) … … 324 324 coord_x_index=[]; 325 325 test_newplot=1; 326 hh=findobj(haxes,'tag','plot_line');326 % hh=findobj(haxes,'tag','plot_line'); 327 327 % num_curve=numel(hh); 328 icurve=0;328 % icurve=0; 329 329 for icell=1:length(CellVarIndex) 330 330 testfalse=0; … … 362 362 end 363 363 eval(['coord_x{icell}=data.' data.ListVarName{coord_x_index} ';']);%coordinate variable set as coord_x 364 testcoordvar=1;364 % testcoordvar=1; 365 365 testplot(coord_x_index)=0; 366 366 if ~isempty(VarType{icell}.ancillary') … … 425 425 eval(['varmean=mean(double(data.' VarName '));']);%mean value 426 426 textmean=[textmean; {[VarName 'mean= ' num2str(varmean,4)]}]; 427 if nbcomponent1==1| nbcomponent2==1427 if nbcomponent1==1|| nbcomponent2==1 428 428 legend_str=[legend_str {VarName}]; %variable with one component 429 429 else %variable with severals components … … 553 553 VarType.coord=VarType.coord(ind_coord); 554 554 end 555 idim_Y=[];555 % idim_Y=[]; 556 556 test_grid=0; 557 557 if ~isempty(ivar_U) && ~isempty(ivar_V)% vector components detected … … 563 563 eval(['vec_U=Data.' Data.ListVarName{ivar_U} ';']) 564 564 eval(['vec_V=Data.' Data.ListVarName{ivar_V} ';']) 565 'TESTplot'566 VarType.coord567 565 if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty) 568 566 eval(['vec_X=Data.' Data.ListVarName{ivar_X} ';']) … … 748 746 end 749 747 if ~isfield(PlotParam.Scalar,'IncrA') 750 PlotParam.Scalar.IncrA= [];751 end 752 if is empty(PlotParam.Scalar.IncrA)% | PlotParam.Scalar.AutoScal==0748 PlotParam.Scalar.IncrA=NaN; 749 end 750 if isnan(PlotParam.Scalar.IncrA)% | PlotParam.Scalar.AutoScal==0 753 751 cont=colbartick(MinA,MaxA); 754 752 intercont=cont(2)-cont(1);%default … … 767 765 sizpx=(AX(end)-AX(1))/(np(2)-1); 768 766 sizpy=(AY(1)-AY(end))/(np(1)-1); 769 x_cont= [AX(1):sizpx:AX(end)]; % pixel x coordinates for image display767 x_cont=AX(1):sizpx:AX(end); % pixel x coordinates for image display 770 768 y_cont=AY(1):-sizpy:AY(end); % pixel x coordinates for image display 771 769 txt=ver;%version of Matlab … … 857 855 %display the colorbar code for B/W images if Poscolorbar not empty 858 856 if siz==2 && exist('PosColorbar','var')&& ~isempty(PosColorbar) 859 if isempty(hcol)| ~ishandle(hcol)857 if isempty(hcol)||~ishandle(hcol) 860 858 hcol=colorbar;%create new colorbar 861 859 end … … 981 979 end 982 980 nb_sel=length(ind_sel); 983 ind_sel=ind_sel( [1:2:nb_sel]);% take half the points on a line981 ind_sel=ind_sel(1:2:nb_sel);% take half the points on a line 984 982 vec_X=vec_X(ind_sel); 985 983 vec_Y=vec_Y(ind_sel); -
trunk/src/read_civxdata.m
r19 r93 1 1 %'read_civxdata': reads civx data from netcdf files 2 %------------------------------------------------------------------3 % COMBINE ET REMPLACE read_ncfield, read_vel et read_scalar_new4 2 %------------------------------------------------------------------ 5 3 % OUTPUT: … … 20 18 % .CoordType: expresses the type of coordinate ('px' for image, 'sig' for instruments, or 'phys') 21 19 % .dt: time interval for the corresponding image pair 22 % .CivStage: =0, ??? A UTILISER POUR REMPLACER civ23 %=1, civ1 has been performed only24 %=2, fix1 has been performed25 %=3, pacth1 has been performed26 %=4, civ2 has been performed27 %=5, fix2 has been performed28 %=6, pacth2 has been performed20 % .CivStage: =0, 21 % =1, civ1 has been performed only 22 % =2, fix1 has been performed 23 % =3, pacth1 has been performed 24 % =4, civ2 has been performed 25 % =5, fix2 has been performed 26 % =6, pacth2 has been performed 29 27 % .X, .Y, .Z: set of vector coordinates 30 28 % .U,.V,.W: corresponding set of vector components … … 37 35 % .A, .AX, .AY: additional scalar 38 36 % dt:time interval of the image pair red from a single file, or vector with 39 40 37 % pixcmx,pixcmy: scaling factors (from the first file) 41 38 % vel_type_out: string representing the selected velocity type (civ1,civ2,filter1...) … … 68 65 FieldNames=[]; %default 69 66 end 70 71 67 VelTypeOut=VelType;%default 72 68 [var,role,units,vel_type_out_cell]=varcivx_generator(FieldNames,VelType);%determine the names of constants and variables to read … … 76 72 end 77 73 if isequal(vardetect,0) 78 Field.Txt=[ FieldNames' not accessible in ' filename '/' VelType];74 Field.Txt=[reshape(FieldNames,1,numel(FieldNames)) ' not accessible in ' filename '/' VelType]; 79 75 return 80 76 end -
trunk/src/series/merge_proj.m
r89 r93 267 267 Field{iview}.VarAttribute=SubField.VarAttribute; 268 268 end 269 if isfield(Field{iview},'Txt') 270 msgbox_uvmat('ERROR',Field{iview}.Txt) 271 return 272 end 269 273 if isfield(Field{iview},'Time') 270 274 timeread(iview)=Field{iview}.Time; … … 280 284 Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested 281 285 end 282 min(Field{iview}.X)283 286 if testcivx 284 287 Field{iview}=calc_field(FieldName,Field{iview}); 285 288 end 286 min(Field{iview}.X)287 289 288 290 %projection on object (gridded plane) … … 350 352 MergeData.nb_coord=2; 351 353 MergeData.nb_dim=2; 352 MergeData.dt=1; 354 dt=[]; 355 if isfield(Field{1},'dt')&& isnumeric(Field{1}.dt) 356 dt=Field{1}.dt; 357 end 358 for iview =2:numel(Field) 359 if ~(isfield(Field{iview},'dt')&& isequal(Field{iview}.dt,dt)) 360 dt=[];%dt not the same for all fields 361 end 362 end 363 if isempty(dt) 364 MergeData.ListGlobalAttribute(6)=[]; 365 else 366 MergeData.dt=dt; 367 end 368 %MergeData.dt=1; 353 369 MergeData.Time=time_i; 354 370 error=struct2nc(mergename,MergeData); %save result file … … 387 403 return 388 404 end 405 406 407 389 408 390 409 %group the variables (fields of 'FieldData') in cells of variables with the same dimensions … … 412 431 test_grid=0; 413 432 end 414 % DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)415 433 %case of input fields with unstructured coordinates 416 434 if ~test_grid … … 423 441 %case of fields defined on a structured grid 424 442 else 425 % DimValue=MergeData.DimValue(DimIndices);%set of dimension values426 443 testFF=0; 427 444 for iview=2:nbview 428 % if ~isequal(DimValue,Data{iview}.DimValue(DimIndices))429 % MergeData.Txt='ERROR: attempt at merging structured fields with different sizes';430 % return431 % end432 445 for ivar=VarIndex 433 446 VarName=MergeData.ListVarName{ivar}; -
trunk/src/struct2nc.m
r55 r93 1 % 'struct2nc': create a netcdf file from a Matlab structure1 % 'struct2nc': create a netcdf file from a Matlab structure 2 2 %--------------------------------------------------------------------- 3 3 % errormsg=struct2nc(flname,Data) 4 4 % 5 % OUPUT:6 % errormsg=error message, =[]: default, no error5 % OUPUT: 6 % errormsg=error message, =[]: default, no error 7 7 % 8 % INPUT:9 % flname: name of the netcdf file to create (must end with the extension '.nc')8 % INPUT: 9 % flname: name of the netcdf file to create (must end with the extension '.nc') 10 10 % Data: structure containing all the information of the netcdf file (or netcdf object) 11 11 % with fields: 12 % (optional) .ListGlobalAttribute: cell listing the names of the global attributes 13 % .Att_1,Att_2... : values of the global attributes 14 % (requested) .ListVarName: list of variable names to select (cell array of char strings {'VarName1', 'VarName2',...} ) 15 % (requested) .VarDimName: list of dimension names for each element of .ListVarName (cell array of string cells) 16 % (requested) .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName 17 % 12 % (optional) .ListGlobalAttribute: list (cell array of character strings) of the names of the global attributes Att_1, Att_2... 13 % .Att_1,Att_2...: values of the global attributes 14 % (requested) .ListVarName: list of the variable names Var_1, Var_2....(cell array of character strings). 15 % (requested) .VarDimName: list of dimension names for each element of .ListVarName (cell array of string cells) 16 % (optional) .VarAttribute: cell array of structures of the form .VarAttribute{ivar}.key=value, defining an attribute key name and value for the variable #ivar 17 % (requested) .Var1, .Var2....: variables (Matlab arrays) with names listed in .ListVarName 18 18 19 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 19 20 % Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. -
trunk/src/transform_field/im_filter.m
r40 r93 11 11 12 12 DataOut=DataIn; %default 13 14 13 Atype=class(DataIn.A)% detect integer 8 or 16 bits 15 DataOut.A=filter2(Mfiltre,DataIn.A); 16 DataOut.A=feval(Atype,DataOut.A); 14 if numel(size(DataIn.A))==3 15 DataOut.A=filter2(Mfiltre,sum(DataIn.A,3));%filter the input image, after summation on the color component (for color images) 16 DataOut.A=uint16(DataOut.A); %transform to 16 bit images 17 else 18 DataOut.A=filter2(Mfiltre,DataIn.A) 19 DataOut.A=feval(Atype,DataOut.A);%transform to the initial image format 20 end 17 21 -
trunk/src/transform_field/phys_polar.m
r40 r93 28 28 end 29 29 test_1=0; 30 if nargin==4 30 if nargin==4% case of two input fields 31 31 test_1=1; 32 32 Data_1=varargin{3}; … … 65 65 66 66 iscalar=0; 67 %transform first field to cartesian phys coordiantes 67 68 if ~isempty(Calib{1}) 68 69 DataOut=phys_1(Data,Calib{1},origin_xy,radius_offset,angle_offset,angle_scale); … … 80 81 end 81 82 end 82 83 %transform second field (if exists) to cartesian phys coordiantes 83 84 if test_1 84 85 DataOut_1=phys_1(Data_1,Calib{2},origin_xy,radius_offset,angle_offset,angle_scale); … … 153 154 DataOut.V=(-UX.*sin(theta)+VY.*cos(theta));%./(DataOut.X)%+radius_ref);%angular velocity calculated 154 155 %shift and renormalize the angular velocity 156 end 157 end 158 %transform of spatial derivatives 159 if isfield(Data,'X') && ~isempty(Data.X) && isfield(Data,'DjUi') && ~isempty(Data.DjUi)... 160 && isfield(Data,'dt') 161 if ~isempty(Data.dt) 162 % estimate the Jacobian matrix DXpx/DXphys 163 for ip=1:length(Data.X) 164 [Xp1,Yp1]=phys_XYZ(Calib,Data.X(ip)+0.5,Data.Y(ip),Z); 165 [Xm1,Ym1]=phys_XYZ(Calib,Data.X(ip)-0.5,Data.Y(ip),Z); 166 [Xp2,Yp2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)+0.5,Z); 167 [Xm2,Ym2]=phys_XYZ(Calib,Data.X(ip),Data.Y(ip)-0.5,Z); 168 %Jacobian matrix DXpphys/DXpx 169 DjXi(1,1)=(Xp1-Xm1); 170 DjXi(2,1)=(Yp1-Ym1); 171 DjXi(1,2)=(Xp2-Xm2); 172 DjXi(2,2)=(Yp2-Ym2); 173 DjUi(:,:)=Data.DjUi(ip,:,:); 174 DjUi=(DjXi*DjUi')/DjXi;% =J-1*M*J , curvature effects (derivatives of J) neglected 175 DataOut.DjUi(ip,:,:)=DjUi'; 176 end 177 DataOut.DjUi = DataOut.DjUi/Data.dt; % min(Data.DjUi(:,1,1))=DUDX 155 178 end 156 179 end -
trunk/src/uvmat.m
r89 r93 1167 1167 UvData.NewSeries=1; %flag for run0: begin a new series 1168 1168 1169 [FileName,RootPath,FileBase,FileIndices,FileExt ]=read_file_boxes_1(handles);1169 [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes_1(handles); 1170 1170 if ~exist(FileName,'file') 1171 1171 msgbox_uvmat('ERROR',['input file ' FileName ' not found']);
Note: See TracChangeset
for help on using the changeset viewer.