- Timestamp:
- Aug 17, 2012, 11:47:16 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/calc_field.m
r515 r517 25 25 % varname_generator.m: determines the field names to read in the netcdf 26 26 % file, depending on the scalar 27 28 function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp)27 function [FieldOptions,ColorList]=calc_field 28 %function [DataOut,errormsg]=calc_field(FieldList,DataIn,Coord_interp) 29 29 30 30 %list of defined scalars to display in menus (in addition to 'ima_cor'). … … 49 49 'w_normal';... %w velocity component normal to the plane 50 50 'error'}; %error associated to a vector (for stereo or patch) 51 errormsg=[]; %default error message 52 if ~exist('FieldList','var') 53 DataOut=FieldOptions;% gives the list of possible field inputs in the absence of input 54 return 55 end 56 51 ColorList={'C';...%image correlation corresponding to a vel vector 52 'norm(U,V)';...%norm of the velocity 53 'U';... %u velocity component 54 'V';... %v velocity component 55 } 56 % errormsg=[]; %default error message 57 % if ~exist('FieldList','var') 58 % DataOut=FieldOptions;% gives the list of possible field inputs in the absence of input 59 % return 60 % end 61 return 57 62 %% check input 58 63 if ~exist('DataIn','var') -
trunk/src/calc_field_interp.m
r516 r517 1 1 2 %'calc_field': defines fields (velocity, vort, div...) from civ xdata and calculate them2 %'calc_field': defines fields (velocity, vort, div...) from civ data and calculate them 3 3 %--------------------------------------------------------------------- 4 4 % [DataOut,VarAttribute,errormsg]=calc_field_interp(Coord_tps,NbSites,SubRange,FieldVar,Operation,Coord_interp) … … 15 15 % Coord_interp: coordiantes of sites on which the fields need to be calculated 16 16 17 function [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp(Coord, FieldVar,Operation,XI,YI)17 function [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp(Coord,Data,Operation,XI,YI) 18 18 19 19 VarVal=[]; … … 21 21 VarAttribute={}; 22 22 errormsg=''; 23 check_u=0; 24 check_v=0; 25 for ilist=1:length(Operation) 26 switch Operation{ilist} 27 case {'U'} 28 check_u=1; 29 case {'V'} 30 check_v=1; 31 case {'vec(U,V)','norm(U,V)'} 32 check_u=1; 33 check_v=1; 23 InputVarList={}; 24 if ischar(Operation),Operation={Operation};end 25 for ilist=1:numel(Operation) 26 r=regexp(Operation{ilist},'(?<Operator>(^vec|^norm))\((?<UName>.+),(?<VName>.+)\)$','names'); 27 if isempty(r) % the operation is the variable 28 if isempty(find(strcmp(Operation{ilist},InputVarList))); 29 InputVarList=[InputVarList Operation{ilist}]; 30 end 31 Operator{ilist}=''; 32 else 33 UName{ilist}=r.UName; 34 VName{ilist}=r.VName; 35 if isempty(find(strcmp(r.UName,InputVarList))); 36 InputVarList=[InputVarList UName{ilist}]; 37 end 38 if isempty(find(strcmp(r.VName,InputVarList))); 39 InputVarList=[InputVarList VName{ilist}]; 40 end 41 Operator{ilist}=r.Operator; 34 42 end 35 43 end 36 if check_u 37 F_u = TriScatteredInterp(Coord,FieldVar(:,1),'linear'); 44 %create interpolator for linear interpolation 45 if exist('XI','var') 46 for ilist=1:numel(InputVarList) 47 F.(InputVarList{ilist})=TriScatteredInterp(Coord,Data.(InputVarList{ilist}),'linear'); 48 end 38 49 end 39 if check_v 40 F_v = TriScatteredInterp(Coord,FieldVar(:,2),'linear'); 41 end 42 for ilist=1:length(Operation) 50 for ilist=1:numel(Operation) 43 51 nbvar=numel(ListVarName); 44 switch Operation{ilist} 45 case 'vec(U,V)' 46 VarVal{nbvar+1}=F_u(XI,YI); 47 VarVal{nbvar+2}=F_v(XI,YI); 48 ListVarName{nbvar+1}='U'; 49 ListVarName{nbvar+2}='V'; 52 switch Operator{ilist} 53 case 'vec' 54 if exist('XI','var') 55 VarVal{nbvar+1}=F.(UName{ilist})(XI,YI); 56 VarVal{nbvar+2}=F.(VName{ilist})(XI,YI); 57 else 58 VarVal{nbvar+1}=Data.(UName{ilist}); 59 VarVal{nbvar+2}=Data.(VName{ilist}); 60 end 61 ListVarName{nbvar+1}=UName{ilist}; 62 ListVarName{nbvar+2}=VName{ilist}; 50 63 VarAttribute{nbvar+1}.Role='vector_x'; 51 64 VarAttribute{nbvar+2}.Role='vector_y'; 52 case 'U' 53 VarVal{nbvar+1}=F_u(XI,YI); 54 ListVarName{nbvar+1}='U'; 65 % case 'U' 66 % VarVal{nbvar+1}=F_u(XI,YI); 67 % ListVarName{nbvar+1}='U'; 68 % VarAttribute{nbvar+1}.Role='scalar'; 69 % case 'V' 70 % VarVal{nbvar+1}=F_v(XI,YI); 71 % ListVarName{nbvar+1}='V'; 72 % VarAttribute{nbvar+1}.Role='scalar'; 73 case 'norm' 74 if exist('XI','var') 75 U2=F.(UName{ilist})(XI,YI).*F.(UName{ilist})(XI,YI); 76 V2=F.(VName{ilist})(XI,YI).*F.(VName{ilist})(XI,YI); 77 else 78 U2=Data.(UName{ilist}).*Data.(UName{ilist}); 79 V2=Data.(VName{ilist}).*Data.(VName{ilist}); 80 end 81 VarVal{nbvar+1}=sqrt(U2+V2); 82 ListVarName{nbvar+1}='norm'; 55 83 VarAttribute{nbvar+1}.Role='scalar'; 56 case 'V' 57 VarVal{nbvar+1}=F_v(XI,YI); 58 ListVarName{nbvar+1}='V'; 59 VarAttribute{nbvar+1}.Role='scalar'; 60 case 'norm(U,V)' 61 VarVal{nbvar+1}=sqrt(F_u(XI,YI).*F_u(XI,YI)+F_v(XI,YI).*F_v(XI,YI)); 62 ListVarName{nbvar+1}='norm(U,V)'; 63 VarAttribute{nbvar+1}.Role='scalar'; 84 otherwise 85 if ~isempty(Operation{ilist}) 86 if exist('XI','var') 87 VarVal{nbvar+1}=F.(Operation{ilist})(XI,YI); 88 else 89 VarVal{nbvar+1}= Data.(Operation{ilist}); 90 end 91 ListVarName{nbvar+1}=Operation{ilist}; 92 VarAttribute{nbvar+1}.Role='scalar'; 93 end 64 94 end 65 95 end 96 % put an error flag to indicate NaN data 97 if exist('XI','var') 66 98 nbvar=numel(ListVarName); 67 99 ListVarName{nbvar+1}='FF'; 68 100 VarVal{nbvar+1}=isnan(VarVal{nbvar}); 69 101 VarAttribute{nbvar+1}.Role='errorflag'; 102 end 70 103 71 104 % Attr_FF.Role='errorflag'; -
trunk/src/geometry_calib.m
r507 r517 1000 1000 %axes(hhuvmat.axes3) 1001 1001 set(0,'CurrentFigure',huvmat) 1002 set(huvmat,'CurrentAxes',hhuvmat. axes3)1002 set(huvmat,'CurrentAxes',hhuvmat.PlotAxes) 1003 1003 hh=findobj('Tag','calib_points'); 1004 1004 if ~isempty(ObjectData.Coord) && isempty(hh) -
trunk/src/get_field.m
r512 r517 60 60 %% prepare the list of RUN fcts and set their paths 61 61 % functions included by default in 'get_field.m 62 menu_str={'PLOT';'FFT';'filter_band'};63 nb_builtin=numel(menu_str);64 path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat'65 addpath(fullfile(path_uvmat,'get_field'))66 testexist=zeros(size(menu_str'));%default67 for ilist=1:length(menu_str)68 if exist(menu_str{ilist},'file')69 fct_handle{ilist,1}=str2func(menu_str{ilist});70 testexist(ilist)=1;71 else72 fct_handle{ilist,1}=[];73 testexist(ilist)=0;74 end75 end76 rmpath(fullfile(path_uvmat,'get_field'))77 dir_perso=prefdir;62 % menu_str={'PLOT';'FFT';'filter_band'}; 63 % nb_builtin=numel(menu_str); 64 % path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat' 65 % addpath(fullfile(path_uvmat,'get_field')) 66 % testexist=zeros(size(menu_str'));%default 67 % for ilist=1:length(menu_str) 68 % if exist(menu_str{ilist},'file') 69 % fct_handle{ilist,1}=str2func(menu_str{ilist}); 70 % testexist(ilist)=1; 71 % else 72 % fct_handle{ilist,1}=[]; 73 % testexist(ilist)=0; 74 % end 75 % end 76 % rmpath(fullfile(path_uvmat,'get_field')) 77 % dir_perso=prefdir; 78 78 79 79 % look for functions previously used (names and paths saved in the personal file uvmat_perso.mat): 80 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');81 if exist(profil_perso,'file')82 h=load (profil_perso);83 if isfield(h,'get_field_fct') && iscell(h.get_field_fct)84 for ilist=1:length(h.get_field_fct)85 [path,file]=fileparts(h.get_field_fct{ilist});86 addpath(path)87 if exist(file,'file')88 h_func=str2func(file);89 testexist=[testexist 1];90 else91 h_func=[];92 testexist=[testexist 0];93 end94 fct_handle=[fct_handle; {h_func}]; %concatene the list of paths95 rmpath(path)96 menu_str=[menu_str; {file}];97 end98 end99 end100 101 menu_str=menu_str(testexist==1);%=menu_str(testexist~=0)102 fct_handle=fct_handle(testexist==1);103 menu_str=[menu_str;{'more...'}];104 set(handles.ACTION,'String',menu_str)105 set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION106 set(handles.path_action,'String',fullfile(path_uvmat,'get_field'))107 set(handles.ACTION,'Value',1)% PLOT option selected80 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 81 % if exist(profil_perso,'file') 82 % h=load (profil_perso); 83 % if isfield(h,'get_field_fct') && iscell(h.get_field_fct) 84 % for ilist=1:length(h.get_field_fct) 85 % [path,file]=fileparts(h.get_field_fct{ilist}); 86 % addpath(path) 87 % if exist(file,'file') 88 % h_func=str2func(file); 89 % testexist=[testexist 1]; 90 % else 91 % h_func=[]; 92 % testexist=[testexist 0]; 93 % end 94 % fct_handle=[fct_handle; {h_func}]; %concatene the list of paths 95 % rmpath(path) 96 % menu_str=[menu_str; {file}]; 97 % end 98 % end 99 % end 100 101 % menu_str=menu_str(testexist==1);%=menu_str(testexist~=0) 102 % fct_handle=fct_handle(testexist==1); 103 % menu_str=[menu_str;{'more...'}]; 104 % set(handles.ACTION,'String',menu_str) 105 % set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION 106 % set(handles.path_action,'String',fullfile(path_uvmat,'get_field')) 107 % set(handles.ACTION,'Value',1)% PLOT option selected 108 108 109 109 %% settings for 'slave' mode, called by uvamt, or 'master' mode … … 122 122 123 123 %% load the list of previously browsed files for the upper bar menu Open 124 dir_perso=prefdir;125 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');%126 if exist(profil_perso,'file')127 h=load (profil_perso);128 if isfield(h,'MenuFile_1')129 set(handles.MenuFile_1,'Label',h.MenuFile_1);130 end131 if isfield(h,'MenuFile_1')132 set(handles.MenuFile_2,'Label',h.MenuFile_2);133 end134 if isfield(h,'MenuFile_1')135 set(handles.MenuFile_3,'Label',h.MenuFile_3);136 end137 if isfield(h,'MenuFile_1')138 set(handles.MenuFile_4,'Label',h.MenuFile_4);139 end140 if isfield(h,'MenuFile_1')141 set(handles.MenuFile_5,'Label',h.MenuFile_5);142 end143 end124 % dir_perso=prefdir; 125 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% 126 % if exist(profil_perso,'file') 127 % h=load (profil_perso); 128 % if isfield(h,'MenuFile_1') 129 % set(handles.MenuFile_1,'Label',h.MenuFile_1); 130 % end 131 % if isfield(h,'MenuFile_1') 132 % set(handles.MenuFile_2,'Label',h.MenuFile_2); 133 % end 134 % if isfield(h,'MenuFile_1') 135 % set(handles.MenuFile_3,'Label',h.MenuFile_3); 136 % end 137 % if isfield(h,'MenuFile_1') 138 % set(handles.MenuFile_4,'Label',h.MenuFile_4); 139 % end 140 % if isfield(h,'MenuFile_1') 141 % set(handles.MenuFile_5,'Label',h.MenuFile_5); 142 % end 143 % end 144 144 145 145 %% put the GUI on the lower right of the sceen … … 831 831 function RUN_Callback(hObject, eventdata, handles) 832 832 %--------------------------------------------------------- 833 set(handles.RUN,'BackgroundColor',[1 1 0])% mark use of RUN action 834 test_fig=get(handles.SelectFigure,'Value'); 835 836 % plot requested in uvmat 837 if ~test_fig 838 inputfile=get(handles.inputfile,'String'); 839 huvmat=findobj(allchild(0),'tag','uvmat'); 840 if isempty(huvmat) 841 input.InputFile=inputfile; 842 input.FieldsString={'get_field...'}; 843 uvmat(input) 844 else 845 set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) 846 hhuvmat=guidata(huvmat); 847 set(hhuvmat.Fields,'Value',1) 848 set(hhuvmat.Fields,'String',{'get_field...'}) 849 uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 850 end 851 852 % other kind of plot 853 else %TODO: check and update: add plot on an existing axes 854 figcell=get(handles.list_fig,'String'); 855 index=get(handles.list_fig,'value'); 856 figstring=figcell{index}; 857 index=get(handles.ACTION,'Value'); 858 list_func=get(handles.ACTION,'UserData'); 859 h_fun=list_func{index}; 860 set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 861 drawnow 862 SubField=h_fun(handles.get_field);%handles.figure1 =handles of the GUI get_field 863 if ~isempty(SubField) 864 plot_get_field(SubField,handles) 865 end 866 browse_fig(handles.list_fig); %update the list of new existing figures 867 end 868 set(handles.RUN,'BackgroundColor',[1 0 0]) 833 % set(handles.RUN,'BackgroundColor',[1 1 0])% mark use of RUN action 834 % test_fig=get(handles.SelectFigure,'Value'); 835 % 836 % % plot requested in uvmat 837 % if ~test_fig 838 % inputfile=get(handles.inputfile,'String'); 839 % huvmat=findobj(allchild(0),'tag','uvmat'); 840 % if isempty(huvmat) 841 % input.InputFile=inputfile; 842 % input.FieldsString={'get_field...'}; 843 % uvmat(input) 844 % else 845 % set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) 846 % hhuvmat=guidata(huvmat); 847 % set(hhuvmat.Fields,'Value',1) 848 % set(hhuvmat.Fields,'String',{'get_field...'}) 849 % uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 850 % end 851 % 852 % % other kind of plot 853 % else %TODO: check and update: add plot on an existing axes 854 % figcell=get(handles.list_fig,'String'); 855 % index=get(handles.list_fig,'value'); 856 % figstring=figcell{index}; 857 % index=get(handles.ACTION,'Value'); 858 % list_func=get(handles.ACTION,'UserData'); 859 % h_fun=list_func{index}; 860 % set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784]) 861 % drawnow 862 % SubField=h_fun(handles.get_field);%handles.figure1 =handles of the GUI get_field 863 % if ~isempty(SubField) 864 % plot_get_field(SubField,handles) 865 % end 866 % browse_fig(handles.list_fig); %update the list of new existing figures 867 % end 868 % set(handles.RUN,'BackgroundColor',[1 0 0]) 869 huvmat=findobj(allchild(0),'tag','uvmat'); 870 if ~isempty(huvmat) 871 set(huvmat,'Visible','on')%make uvmat visible (bugs can hide it in some cases) 872 hhuvmat=guidata(huvmat); 873 get_field_GUI=read_GUI(handles.get_field); 874 if isfield(get_field_GUI,'PanelVectors') 875 set(hhuvmat.Coord_x,'value',1) 876 set(hhuvmat.Coord_y,'value',1) 877 set(hhuvmat.Coord_x,'String',{get_field_GUI.PanelVectors.coord_x_vectors}) 878 set(hhuvmat.Coord_y,'String',{get_field_GUI.PanelVectors.coord_y_vectors}) 879 UName=get_field_GUI.PanelVectors.vector_x; 880 VName=get_field_GUI.PanelVectors.vector_y; 881 menu_str=[{['vec(' UName ',' VName ')']};{UName};{VName};{['norm(' UName ',' VName ')']};{'get_field...'}]; 882 menu_color=[{''};{UName};{VName};{['norm(' UName ',' VName ')']}]; 883 FieldsMenu=get(hhuvmat.Fields,'String'); 884 Fields=FieldsMenu{get(hhuvmat.Fields,'Value')}; 885 if strcmp(Fields,'get_field...') 886 set(hhuvmat.Fields,'Value',1) 887 set(hhuvmat.Fields,'String',menu_str) 888 else %get_field has been called by Fields_1 889 set(hhuvmat.Fields_1,'Value',1) 890 set(hhuvmat.Fields_1,'String',menu_str) 891 end 892 ind_menu=find(strcmp(get_field_GUI.PanelVectors.vec_color,menu_color)); 893 if ~isempty(ind_menu) 894 set(hhuvmat.ColorScalar,'Value',ind_menu) 895 else 896 set(hhuvmat.ColorScalar,'Value',1) 897 end 898 set(hhuvmat.ColorScalar,'String',menu_color) 899 end 900 end 901 delete(handles.get_field) 902 % set(hhuvmat.Fields,'String',{'get_field...'}) 903 % uvmat('run0_Callback',hObject,eventdata,hhuvmat); % display field in uvmat 904 % end 869 905 870 906 %------------------------------------------------------------------------ -
trunk/src/nc2struct.m
r421 r517 145 145 Data.ListVarName=ListVarNameNetcdf; 146 146 else %select input variables, if requested by the input ListVarName 147 ind_remove=[]; 148 for ivar=1:numel(ListVarName) % check redondancy 149 if ~isempty(find(strcmp(ListVarName{ivar},ListVarName(1:ivar-1)))) 150 ind_remove=[ind_remove ivar]; 151 end 152 end 153 if ~isempty(ind_remove) 154 ListVarName(ind_remove)=[]; 155 end 147 156 sizvar=size(ListVarName); 148 157 testmulti=(sizvar(1)>1);%test for multiple choice of variable ranked by order of priority -
trunk/src/plot_field.m
r515 r517 540 540 for icell=1:length(CellVarIndex) % length(CellVarIndex) =1 or 2 (from the calling function) 541 541 VarType=VarTypeCell{icell}; 542 if ~isempty(VarType.coord_tps) 542 if ~isempty(VarType.coord_tps) %do not plot directly tps data (used for projection only) 543 543 continue 544 544 end … … 566 566 vec_U=Data.(Data.ListVarName{ivar_U}); 567 567 vec_V=Data.(Data.ListVarName{ivar_V}); 568 if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty)568 if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field with unstructured coordinates 569 569 XName=Data.ListVarName{ivar_X}; 570 570 YName=Data.ListVarName{ivar_Y}; 571 eval(['vec_X=reshape(Data.' XName ',[],1);'])572 eval(['vec_Y=reshape(Data.' YName ',[],1);'])571 vec_X=reshape(Data.(XName),[],1); %transform vectors in column matlab vectors 572 vec_Y=reshape(Data.(YName),[],1); 573 573 elseif numel(VarType.coord)==2 && ~isequal(VarType.coord,[0 0]);%coordinates defines by dimension variables 574 eval(['y=Data.' Data.ListVarName{VarType.coord(1)} ';'])575 eval(['x=Data.' Data.ListVarName{VarType.coord(2)} ';'])574 y=Data.(Data.ListVarName{VarType.coord(1)}); 575 x=Data.(Data.ListVarName{VarType.coord(2)}); 576 576 if numel(y)==2 % y defined by first and last values on aregular mesh 577 577 y=linspace(y(1),y(2),size(vec_U,1)); … … 585 585 return 586 586 end 587 if ~isempty(ivar_C) 588 eval(['vec_C=Data.' Data.ListVarName{ivar_C} ';']) ; 589 vec_C=reshape(vec_C,1,numel(vec_C)); 587 if isfield(PlotParam.Vectors,'ColorScalar') && ~isempty(PlotParam.Vectors.ColorScalar) 588 [VarVal,ListVarName,VarAttribute,errormsg]=calc_field_interp([],Data,PlotParam.Vectors.ColorScalar); 589 % if ~isempty(ivar_C) 590 %vec_C=Data.(Data.ListVarName{ivar_C}); 591 if ~isempty(VarVal) 592 vec_C=reshape(VarVal{1},1,numel(VarVal{1})); 590 593 test_C=1; 594 end 591 595 end 592 596 if ~isempty(ivar_F)%~(isfield(PlotParam.Vectors,'HideWarning')&& isequal(PlotParam.Vectors.HideWarning,1)) -
trunk/src/proj_field.m
r516 r517 1181 1181 FieldVar=FieldData.(VarName_scalar); 1182 1182 end 1183 [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],Field Var,VarType.Operation,XI,YI);1183 [VarVal,ListFieldProj,VarAttribute,errormsg]=calc_field_interp([coord_X coord_Y],FieldData,VarType.Operation,XI,YI); 1184 1184 if isfield(VarType,'CheckSub') && VarType.CheckSub && ~isempty(vector_x_proj) 1185 1185 ProjData.(ProjData.ListVarName{vector_x_proj})=ProjData.(ProjData.ListVarName{vector_x_proj})-VarVal{1}; -
trunk/src/read_GUI.m
r516 r517 60 60 input=listinput; 61 61 else 62 input=listinput{value};62 input=listinput{value}; 63 63 end 64 64 else % multiple selection 65 input=listinput(value);65 input=listinput(value); 66 66 end 67 67 else -
trunk/src/read_civdata.m
r516 r517 47 47 % 'nc2struct': reads a netcdf file 48 48 49 function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType ,CivStage)49 function [Field,VelTypeOut,errormsg]=read_civdata(filename,FieldNames,VelType) 50 50 51 51 %% default input … … 77 77 78 78 %% reading data 79 [varlist,role,VelTypeOut]=varcivx_generator(FieldRequest,VelType,CivStage); 79 Data=nc2struct(filename,'ListGlobalAttribute','CivStage'); 80 [varlist,role,VelTypeOut]=varcivx_generator(FieldRequest,VelType,Data.CivStage); 80 81 if isempty(varlist) 81 82 erromsg=['error in read_civdata: unknow velocity type ' VelType]; -
trunk/src/read_field.m
r516 r517 42 42 try 43 43 switch FileType 44 case {'civx','civdata','netcdf'} %read the first nc field 45 GUIName='get_field'; %default name of the GUI get_field 46 if isfield(ParamIn,'GUIName') 47 GUIName=ParamIn.GUIName; 48 end 49 CivStage=0; 50 if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data 51 FieldList=calc_field;%list of possible fields for Civx data 52 ParamOut.ColorVar='';%default 53 if ischar(ParamIn.FieldName) 54 FieldName=ParamIn.FieldName; 55 else 56 FieldName=ParamIn.FieldName{1}; 57 end 58 field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 59 if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 60 Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 61 % case of new civdata conventions 62 if isequal(Data.Conventions,'uvmat/civdata') 63 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 64 ParamOut.ColorVar='ima_cor'; 65 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 66 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType,Data.CivStage); 44 case 'civdata' 45 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 46 % ParamOut.ColorVar='ima_cor'; 47 InputField=[{ParamIn.FieldName} {ParamIn.ColorVar}]; 48 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType); 67 49 if ~isempty(errormsg),errormsg=['read_civdata:' errormsg];return,end 68 CivStage=Field.CivStage;69 50 ParamOut.CivStage=Field.CivStage; 70 %case of old civx conventions 71 elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 72 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 51 case 'civx' 52 ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 73 53 ParamOut.ColorVar='ima_cor'; 74 54 InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 75 55 [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 76 56 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 77 CivStage=Field.CivStage;78 57 ParamOut.CivStage=Field.CivStage; 79 % not cvix file, fields will be chosen through the GUI get_field 80 else 81 ParamOut.FieldName='get_field...'; 82 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 83 if ~isempty(hget_field) 84 delete(hget_field)%delete get_field for reinitialisation 85 end 86 end 87 else 88 InputField=ParamOut.FieldName; 89 if ischar(InputField) 90 InputField={InputField}; 91 end 92 if isfield(ParamIn,'ColorVar') 93 ParamOut.ColorVar=ParamIn.ColorVar; 94 InputField=[InputField {ParamOut.ColorVar}]; 95 end 96 [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 97 if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 98 CivStage=Field.CivStage; 99 ParamOut.CivStage=Field.CivStage; 58 case 'netcdf' 59 r=regexp(ParamIn.FieldName,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names'); 60 if isempty(r) 61 ListVar={ParamIn.FieldName}; 62 input='scalar'; 63 else 64 ListVar={r.UName,r.VName}; 65 input='vectors'; 66 end 67 if ~isempty(ParamIn.ColorVar) 68 r=regexp(ParamIn.ColorVar,'(^vec|^norm)\((?<UName>.+),(?<VName>.+)\)$','names'); 69 if isempty(r) 70 ListVar=[ListVar {ParamIn.ColorVar}]; 71 else 72 ListVar=[ListVar {r.UName,r.VName}]; 100 73 end 101 ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}];102 end103 if CivStage==0% read the field names on the interface get_field.104 hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI105 if isempty(hget_field)% open the GUI get_field if it is not found106 hget_field= get_field(FileName);%open the get_field GUI107 set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1)74 end 75 [Field,var_detect,ichoice]=nc2struct(FileName,[ParamIn.CoordName ListVar]); 76 if strcmp(input,'vectors') 77 Field.VarAttribute{3}.Role='vector_x'; 78 Field.VarAttribute{4}.Role='vector_y'; 79 else 80 Field.VarAttribute{3}.Role='scalar'; 108 81 end 109 hhget_field=guidata(hget_field); 110 %% update the get_field GUI 111 set(hhget_field.inputfile,'String',FileName) 112 set(hhget_field.list_fig,'Value',1) 113 if exist('num','var')&&~isnan(num) 114 set(hhget_field.TimeIndexValue,'String',num2str(num)) 115 end 116 % funct_list=get(hhget_field.ACTION,'UserData'); 117 % funct_index=get(hhget_field.ACTION,'Value'); 118 % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 119 % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 120 [Field,errormsg]=read_get_field(hget_field); 121 Tabchar={''};%default 122 Tabcell=[]; 123 set(hhget_field.inputfile,'String',FileName) 124 if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute) 125 for iline=1:length(Field.ListGlobalAttribute) 126 Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 127 if isfield(Field, Field.ListGlobalAttribute{iline}) 128 val=Field.(Field.ListGlobalAttribute{iline}); 129 if ischar(val); 130 Tabcell{iline,2}=val; 131 else 132 Tabcell{iline,2}=num2str(val); 133 end 134 end 135 end 136 if ~isempty(Tabcell) 137 Tabchar=cell2tab(Tabcell,'='); 138 Tabchar=[{''};Tabchar]; 139 end 140 end 141 ParamOut.CivStage=0; 142 ParamOut.VelType=[]; 143 if isfield(Field,'TimeIndex') 144 ParamOut.TimeIndex=Field.TimeIndex; 145 end 146 if isfield(Field,'TimeValue') 147 ParamOut.TimeValue=Field.TimeValue; 148 end 149 ParamOut.FieldList={'get_field...'}; 150 end 82 % GUIName='get_field'; %default name of the GUI get_field 83 % if isfield(ParamIn,'GUIName') 84 % GUIName=ParamIn.GUIName; 85 % end 86 % CivStage=0; 87 % % if ~strcmp(ParamIn.FieldName,'get_field...')% if get_field is not requested, look for Civx data 88 % FieldList=calc_field;%list of possible fields for Civx data 89 % ParamOut.ColorVar='';%default 90 % if ischar(ParamIn.FieldName) 91 % FieldName=ParamIn.FieldName; 92 % else 93 % FieldName=ParamIn.FieldName{1}; 94 % end 95 % field_index=strcmp(FieldName,FieldList);%look for ParamIn.FieldName in the list of possible fields for Civx data 96 % if isempty(find(field_index,1))% ParamIn.FieldName is not in the list, check whether Civx data exist 97 % Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ','CivStage'); 98 % % case of new civdata conventions 99 % if isequal(Data.Conventions,'uvmat/civdata') 100 % 101 % %case of old civx conventions 102 % elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0) 103 % ParamOut.FieldName='velocity';%Civx data found, set .FieldName='velocity' by default 104 % ParamOut.ColorVar='ima_cor'; 105 % InputField=[{ParamOut.FieldName} {ParamOut.ColorVar}]; 106 % [Field,ParamOut.VelType]=read_civxdata(FileName,InputField,ParamIn.VelType); 107 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 108 % CivStage=Field.CivStage; 109 % ParamOut.CivStage=Field.CivStage; 110 % % not cvix file, fields will be chosen through the GUI get_field 111 % else 112 % ParamOut.FieldName='get_field...'; 113 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 114 % if ~isempty(hget_field) 115 % delete(hget_field)%delete get_field for reinitialisation 116 % end 117 % end 118 % else 119 % InputField=ParamOut.FieldName; 120 % if ischar(InputField) 121 % InputField={InputField}; 122 % end 123 % if isfield(ParamIn,'ColorVar') 124 % ParamOut.ColorVar=ParamIn.ColorVar; 125 % InputField=[InputField {ParamOut.ColorVar}]; 126 % end 127 % [Field,ParamOut.VelType,errormsg]=read_civxdata(FileName,InputField,ParamIn.VelType); 128 % if ~isempty(errormsg),errormsg=['read_civxdata:' errormsg];return,end 129 % CivStage=Field.CivStage; 130 % ParamOut.CivStage=Field.CivStage; 131 % end 132 % ParamOut.FieldList=[{'image'};FieldList;{'get_field...'}]; 133 % end 134 % if CivStage==0% read the field names on the interface get_field. 135 % hget_field=findobj(allchild(0),'Name',GUIName);%find the get_field... GUI 136 % if isempty(hget_field)% open the GUI get_field if it is not found 137 % hget_field= get_field(FileName);%open the get_field GUI 138 % set(hget_field,'Name',GUIName)%update the name of get_field (e.g. get_field_1) 139 % end 140 % hhget_field=guidata(hget_field); 141 % %% update the get_field GUI 142 % set(hhget_field.inputfile,'String',FileName) 143 % set(hhget_field.list_fig,'Value',1) 144 % if exist('num','var')&&~isnan(num) 145 % set(hhget_field.TimeIndexValue,'String',num2str(num)) 146 % end 147 % % funct_list=get(hhget_field.ACTION,'UserData'); 148 % % funct_index=get(hhget_field.ACTION,'Value'); 149 % % funct=funct_list{funct_index};%select the current action in get_field, e;g. PLOT 150 % % Field=funct(hget_field); %%activate the current action selected in get_field, e;g.read the names of the variables to plot 151 % [Field,errormsg]=read_get_field(hget_field); 152 % Tabchar={''};%default 153 % Tabcell=[]; 154 % set(hhget_field.inputfile,'String',FileName) 155 % if isfield(Field,'ListGlobalAttribute')&& ~isempty(Field.ListGlobalAttribute) 156 % for iline=1:length(Field.ListGlobalAttribute) 157 % Tabcell{iline,1}=Field.ListGlobalAttribute{iline}; 158 % if isfield(Field, Field.ListGlobalAttribute{iline}) 159 % val=Field.(Field.ListGlobalAttribute{iline}); 160 % if ischar(val); 161 % Tabcell{iline,2}=val; 162 % else 163 % Tabcell{iline,2}=num2str(val); 164 % end 165 % end 166 % end 167 % if ~isempty(Tabcell) 168 % Tabchar=cell2tab(Tabcell,'='); 169 % Tabchar=[{''};Tabchar]; 170 % end 171 % end 172 % ParamOut.CivStage=0; 173 % ParamOut.VelType=[]; 174 % if isfield(Field,'TimeIndex') 175 % ParamOut.TimeIndex=Field.TimeIndex; 176 % end 177 % if isfield(Field,'TimeValue') 178 % ParamOut.TimeValue=Field.TimeValue; 179 % end 180 % ParamOut.FieldList={'get_field...'}; 181 151 182 case 'video' 152 183 if strcmp(class(ParamIn),'VideoReader') -
trunk/src/set_col_vec.m
r405 r517 21 21 % vec_C: matlab vector representing the scalar setting the color 22 22 function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C) 23 col_vec=[]; 23 col_vec=ones(size(vec_C));%all vectors at color#1 by default 24 24 25 if ~isstruct(colcode),colcode=[];end; 25 26 colcode_out=colcode;%default 26 27 if isempty(vec_C) || ~isnumeric(vec_C) 27 28 colorlist=[0 0 1]; %blue 28 col_vec=ones(size(vec_C));29 29 return 30 30 end 31 31 32 33 34 % colcode_out.ColCode1=ColCode1;35 % colcode_out.ColCode2=ColCode2;36 32 %% uniform color plot 37 33 check_multicolors=0; 38 col_vec=ones(size(vec_C));%all vectors at color#1 by default39 34 %default input parameters 40 35 if ~isfield(colcode,'ColorCode') || isempty(colcode.ColorCode) -
trunk/src/uvmat.m
r516 r517 180 180 UvData.OpenParam.PosColorbar=[0.805 0.022 0.019 0.445]; 181 181 UvData.OpenParam.PosSetObject=[-0.05 -0.03 0.3 0.7]; %position for set_object 182 UvData.OpenParam.PosGeometryCali c=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE)182 UvData.OpenParam.PosGeometryCalib=[0.95 -0.03 0.28 1 ];%position for geometry_calib (TO IMPROVE) 183 183 % UvData.OpenParam.CalSize=[0.28 1]; 184 184 % UvData.PlotAxes=[];%initiate the record of plotted field … … 990 990 991 991 %% set default options in menu 'Fields' 992 if ~testima 993 testcivx=0; 994 if isfield(UvData,'FieldsString') && isequal(UvData.FieldsString,{'get_field...'})% field menu defined as input (from get_field) 992 switch FileType 993 case {'civx','civdata'} 994 [FieldList,ColorList]=calc_field; 995 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 996 set(handles_Fields,'Value',2) % set menu to 'velocity 997 % col_vec=FieldList; 998 % col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 999 set(handles.ColorScalar,'Value',1) 1000 set(handles.ColorScalar,'String',ColorList) 1001 set(handles.Coord_x,'Value',1); 1002 set(handles.Coord_x,'String',{'X'}); 1003 set(handles.Coord_y,'Value',1); 1004 set(handles.Coord_y,'String',{'Y'}); 1005 case 'netcdf' 995 1006 set(handles_Fields,'Value',1) 996 1007 set(handles_Fields,'String',{'get_field...'}) 997 UvData=rmfield(UvData,'FieldsString'); 998 else 999 Data=nc2struct(FileName,'ListGlobalAttribute','Conventions','absolut_time_T0','civ'); 1000 if strcmp(Data.Conventions,'uvmat/civdata') ||( ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0))%if the new input is Civx 1001 FieldList=calc_field; 1002 set(handles_Fields,'String',[{'image'};FieldList;{'get_field...'}]);%standard menu for civx data 1003 set(handles_Fields,'Value',2) % set menu to 'velocity' 1004 col_vec=FieldList; 1005 col_vec(1)=[];%remove 'velocity' option for vector color (must be a scalar) 1006 testcivx=1; 1007 end 1008 if ~testcivx 1009 set(handles_Fields,'Value',1) % set menu to 'get_field... 1010 set(handles_Fields,'String',{'get_field...'}) 1011 col_vec={'get_field...'}; 1012 end 1013 set(handles.ColorScalar,'String',col_vec) 1014 end 1008 hget_field=get_field(FileName); 1009 hhget_field=guidata(hget_field); 1010 get_field('RUN_Callback',hhget_field.RUN,[],hhget_field); 1011 % set(handles_Fields,'Value',1) % set menu to 'get_field... 1012 % set(handles_Fields,'String',{'get_field...'}) 1013 % col_vec={'get_field...'}; 1014 % 1015 % set(handles.ColorScalar,'String',col_vec) 1016 otherwise 1017 set(handles_Fields,'Value',1) % set menu to 'image' 1018 set(handles_Fields,'String',{'image'}) 1019 set(handles.Coord_x,'Value',1); 1020 set(handles.Coord_x,'String',{'AX'}); 1021 set(handles.Coord_y,'Value',1); 1022 set(handles.Coord_y,'String',{'AY'}); 1015 1023 end 1016 1024 set(handles.uvmat,'UserData',UvData) … … 2038 2046 end 2039 2047 end 2040 if strcmp(FieldName,'velocity')2048 if ~isempty(regexp(FieldName,'^vec(')) 2041 2049 list_code=get(handles.ColorCode,'String');% list menu fields 2042 2050 index_code=get(handles.ColorCode,'Value');% selected string index … … 2070 2078 end 2071 2079 if isstruct (ParamIn) 2072 ParamIn.FieldName=FieldName; 2073 ParamIn.VelType=VelType; 2074 ParamIn.GUIName='get_field'; 2075 end 2076 check_tps=0; 2080 ParamIn.FieldName=FieldName; 2081 ParamIn.VelType=VelType; 2082 XNameMenu=get(handles.Coord_x,'String'); 2083 ParamIn.CoordName=XNameMenu{get(handles.Coord_x,'Value')}; 2084 YNameMenu=get(handles.Coord_y,'String'); 2085 ParamIn.CoordName={ParamIn.CoordName, YNameMenu{get(handles.Coord_y,'Value')}}; 2086 end 2087 check_tps = 0; 2077 2088 if strcmp(UvData.FileType{1},'civdata')&&~strcmp(ParamIn.FieldName,'velocity')&&~strcmp(ParamIn.FieldName,'get_field...') 2078 2089 check_tps=1;%tps needed to get the requested field … … 2215 2226 end 2216 2227 % display the Fields menu from the input file and pick the selected one: 2217 if isstruct(ParamOut)2218 field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);2219 set(handles.Fields,'String',ParamOut.FieldList); %update the field menu2220 set(handles.Fields,'Value',find(field_index,1))2221 end2228 % if isstruct(ParamOut) 2229 % field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList); 2230 % set(handles.Fields,'String',ParamOut.FieldList); %update the field menu 2231 % set(handles.Fields,'Value',find(field_index,1)) 2232 % end 2222 2233 2223 2234 %% update the display menu for the second velocity type (second menuline) 2224 2235 test_veltype_1=0; 2225 2236 if isempty(FileName_1) 2226 set(handles.Fields_1,'Value',1); %update the field menu2227 if isstruct(ParamOut)2228 set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu2229 end2237 % set(handles.Fields_1,'Value',1); %update the field menu 2238 % if isstruct(ParamOut) 2239 % set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu 2240 % end 2230 2241 elseif ~test_keepdata_1 2231 2242 if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...') … … 2625 2636 PlotParam{1}.Vectors.ColCode1=0.33; 2626 2637 PlotParam{1}.Vectors.ColCode2=0.66; 2627 PlotParam{1}.Vectors.ColorScalar={' ima_cor'};2638 PlotParam{1}.Vectors.ColorScalar={''}; 2628 2639 PlotParam{1}.Vectors.ColorCode= {'rgb'}; 2629 2640 end … … 3082 3093 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles); 3083 3094 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]; 3084 %FileName=read_file_boxes(handles);3085 3095 hget_field=findobj(allchild(0),'name','get_field'); 3086 3096 if ~isempty(hget_field) … … 3088 3098 end 3089 3099 hget_field=get_field(FileName); 3090 set(hget_field,'Name','get_field')3091 hhget_field=guidata(hget_field);3092 set(hhget_field.list_fig,'Value',1)3093 set(hhget_field.list_fig,'String',{'uvmat'})3100 % set(hget_field,'Name','get_field') 3101 % hhget_field=guidata(hget_field); 3102 % set(hhget_field.list_fig,'Value',1) 3103 % set(hhget_field.list_fig,'String',{'uvmat'}) 3094 3104 % set(handles.transform_fct,'Value',1)% no transform by default 3095 3105 % set(handles.path_transform,'String','') 3096 return %no action 3097 end 3098 list_fields=get(handles.Fields_1,'String');% list menu fields 3099 index_fields=get(handles.Fields_1,'Value');% selected string index 3100 field_1= list_fields{index_fields(1)}; % selected string 3106 return %no further action 3107 end 3108 3101 3109 UvData=get(handles.uvmat,'UserData'); 3102 3110 … … 3148 3156 3149 3157 %common to Fields_1_Callback 3158 list_fields_1=get(handles.Fields_1,'String');% list menu fields 3159 field_1=''; 3160 if ~isempty(list_fields_1) 3161 field_1= list_fields_1{get(handles.Fields_1,'Value')}; % selected string 3162 end 3150 3163 if isequal(field,'image')||isequal(field_1,'image') 3151 3164 set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons … … 4669 4682 data.CoordType=UvData.CoordType; 4670 4683 end 4671 pos=get(handles.uvmat,'Position');4672 pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)4673 pos(2)=pos(2)-0.02;4684 % pos=get(handles.uvmat,'Position'); 4685 % pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen) 4686 % pos(2)=pos(2)-0.02; 4674 4687 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles); 4675 4688 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt]; 4676 4689 set(handles.view_xml,'Backgroundcolor',[1 1 0])%indicate the reading of the current xml file by geometry_calib 4677 if isfield(UvData.OpenParam,'CalOrigin') 4678 pos_uvmat=get(handles.uvmat,'Position'); 4679 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3); 4680 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4); 4681 pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4); 4682 end 4690 pos_uvmat=get(handles.uvmat,'Position'); 4691 pos_cal(1)=pos_uvmat(1)+UvData.OpenParam.PosGeometryCalib(1)*pos_uvmat(3); 4692 pos_cal(2)=pos_uvmat(2)+UvData.OpenParam.PosGeometryCalib(2)*pos_uvmat(4); 4693 pos_cal(3:4)=UvData.OpenParam.PosGeometryCalib(3:4).* pos_uvmat(3:4); 4683 4694 geometry_calib(FileName,pos_cal);% call the geometry_calib interface 4684 4695 set(handles.view_xml,'Backgroundcolor',[1 1 1])%indicate the end of reading of the current xml file by geometry_calib … … 4902 4913 ProjectDir = uigetdir(fileparts(fileparts(RootPath)), 'select the project directory'); 4903 4914 datatree_browser(ProjectDir) 4915 4916 4917 % --- Executes on selection change in Coord_y. 4918 function Coord_y_Callback(hObject, eventdata, handles) 4919 4920 % --- Executes on selection change in Coord_x. 4921 function Coord_x_Callback(hObject, eventdata, handles)
Note: See TracChangeset
for help on using the changeset viewer.