Changeset 822
- Timestamp:
- Oct 10, 2014, 10:11:30 AM (10 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plot_field.m
r811 r822 14 14 % function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,PosColorbar) 15 15 % 16 % OU TPUT:16 % OUPUT: 17 17 % PlotType: type of plot: 'text','line'(curve plot),'plane':2D view,'volume' 18 18 % PlotParamOut: structure, representing the updated plotting parameters, in case of automatic scaling 19 19 % haxes: handle of the plotting axis, when a new figure is created. 20 20 % 21 % INPUT:21 %INPUT 22 22 % Data: structure describing the field to plot 23 23 % (optional) .ListGlobalAttribute: cell listing the names of the global attributes … … 81 81 % expressed in figure relative unit (ex [0.821 0.471 0.019 0.445]) 82 82 83 %======================================================================= 84 % Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France 85 % http://www.legi.grenoble-inp.fr 86 % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr 87 % 83 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 84 % Copyright 2008-2014, LEGI / CNRS UJF G-INP, Joel.Sommeria@legi.grenoble-inp.fr 85 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 88 86 % This file is part of the toolbox UVMAT. 89 % 87 % 90 88 % UVMAT is free software; you can redistribute it and/or modify 91 % it under the terms of the GNU General Public License as published 92 % by the Free Software Foundation; either version 2 of the license,93 % or(at your option) any later version.94 % 89 % it under the terms of the GNU General Public License as published by 90 % the Free Software Foundation; either version 2 of the License, or 91 % (at your option) any later version. 92 % 95 93 % UVMAT is distributed in the hope that it will be useful, 96 94 % but WITHOUT ANY WARRANTY; without even the implied warranty of 97 95 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 98 % GNU General Public License ( see LICENSE.txt) for more details.99 % =======================================================================96 % GNU General Public License (file UVMAT/COPYING.txt) for more details. 97 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 100 98 101 99 function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam) … … 779 777 %% image or scalar plot %%%%%%%%%%%%%%%%%%%%%%%%%% 780 778 if test_ima 781 782 779 % distinguish B/W and color images 783 780 np=size(A);%size of image … … 798 795 end 799 796 800 %set the color map797 %set for grey scale setting 801 798 if isfield(PlotParam.Scalar,'CheckBW') && ~isempty(PlotParam.Scalar.CheckBW) 802 799 BW=PlotParam.Scalar.CheckBW; %BW=0 color imposed, else gray scale imposed. … … 806 803 end 807 804 808 % determine the plot option 'image' or 'contours' 805 % determine the plot option 'image' or 'contours' 806 CheckContour=0; %default 809 807 if isfield(PlotParam.Scalar,'ListContour') 810 808 CheckContour=strcmp(PlotParam.Scalar.ListContour,'contours');% =1 for contour plot option 811 else812 CheckContour=0; %default813 809 end 814 810 815 811 %case of grey level images or contour plot 816 if siz==2 817 if ~isfield(PlotParam.Scalar,'CheckFixScalar') 818 PlotParam.Scalar.CheckFixScalar=0;% free scalar threshold value scale (from min to max) by default 819 end 820 if ~isfield(PlotParam.Scalar,'MinA') 821 PlotParam.Scalar.MinA=[];%no min scalar threshold value set 822 end 823 if ~isfield(PlotParam.Scalar,'MaxA') 824 PlotParam.Scalar.MaxA=[];%no max scalar threshold value set 812 if ~isfield(PlotParam.Scalar,'CheckFixScalar') 813 PlotParam.Scalar.CheckFixScalar=0;% free scalar threshold value scale (from min to max) by default 814 end 815 if ~isfield(PlotParam.Scalar,'MinA') 816 PlotParam.Scalar.MinA=[];%no min scalar threshold value set 817 end 818 if ~isfield(PlotParam.Scalar,'MaxA') 819 PlotParam.Scalar.MaxA=[];%no max scalar threshold value set 820 end 821 822 % determine the min scalar value 823 if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MinA) && isnumeric(PlotParam.Scalar.MinA) 824 MinA=double(PlotParam.Scalar.MinA); % min value set as input 825 else 826 MinA=double(min(min(min(A)))); % min value set as min of non NaN scalar values 827 end 828 829 % error if the input scalar is NaN everywhere 830 if isnan(MinA) 831 errormsg='NaN input scalar or image in plot_field'; 832 return 833 end 834 835 % determine the max scalar value 836 CheckFixScalar=0; 837 if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MaxA) && isnumeric(PlotParam.Scalar.MaxA) 838 MaxA=double(PlotParam.Scalar.MaxA); % max value set as input 839 CheckFixScalar=1; 840 else 841 MaxA=double(max(max(max(A)))); % max value set as min of non NaN scalar values 842 end 843 844 PlotParamOut.Scalar.MinA=MinA; 845 PlotParamOut.Scalar.MaxA=MaxA; 846 PlotParamOut.Scalar.Npx=size(A,2); 847 PlotParamOut.Scalar.Npy=size(A,1); 848 % if siz==2 849 % case of contour plot 850 if CheckContour 851 if ~isempty(hima) && ishandle(hima) 852 delete(hima) % delete existing image 825 853 end 826 854 827 % determine the min scalar value 828 if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MinA) && isnumeric(PlotParam.Scalar.MinA) 829 MinA=double(PlotParam.Scalar.MinA); % min value set as input 830 else 831 MinA=double(min(min(A))); % min value set as min of non NaN scalar values 832 end 855 % set the contour values 856 if ~isfield(PlotParam.Scalar,'IncrA') 857 PlotParam.Scalar.IncrA=[];% automatic contour interval 858 end 859 if ~isempty(PlotParam.Scalar.IncrA) && isnumeric(PlotParam.Scalar.IncrA) 860 interval=PlotParam.Scalar.IncrA; 861 else % automatic contour interval 862 cont=colbartick(MinA,MaxA); 863 interval=cont(2)-cont(1);%default 864 PlotParamOut.Scalar.IncrA=interval;% set the interval as output for display on the GUI 865 end 866 abscontmin=interval*floor(MinA/interval); 867 abscontmax=interval*ceil(MaxA/interval); 868 contmin=interval*floor(min(min(A))/interval); 869 contmax=interval*ceil(max(max(A))/interval); 870 cont_pos_plus=0:interval:contmax;% zero and positive contour values (plotted as solid lines) 871 cont_pos_min=double(contmin):interval:-interval;% negative contour values (plotted as dashed lines) 872 cont_pos=[cont_pos_min cont_pos_plus];% set of all contour values 833 873 834 % error if the input scalar is NaN everywhere 835 if isnan(MinA) 836 errormsg='NaN input scalar or image in plot_field'; 837 return 838 end 874 sizpx=(Coord_x(end)-Coord_x(1))/(np(2)-1); 875 sizpy=(Coord_y(1)-Coord_y(end))/(np(1)-1); 876 x_cont=Coord_x(1):sizpx:Coord_x(end); % pixel x coordinates for image display 877 y_cont=Coord_y(1):-sizpy:Coord_y(end); % pixel x coordinates for image display 839 878 840 % determine the max scalar value 841 if PlotParam.Scalar.CheckFixScalar && ~isempty(PlotParam.Scalar.MaxA) && isnumeric(PlotParam.Scalar.MaxA) 842 MaxA=double(PlotParam.Scalar.MaxA); % max value set as input 843 else 844 MaxA=double(max(max(A))); % max value set as min of non NaN scalar values 845 end 879 %axes(haxes)% set the input axes handle as current axis 846 880 847 PlotParamOut.Scalar.MinA=MinA; 848 PlotParamOut.Scalar.MaxA=MaxA; 849 PlotParamOut.Scalar.Npx=size(A,2); 850 PlotParamOut.Scalar.Npy=size(A,1); 881 % colormap(map); 882 tag_axes=get(haxes,'Tag');% axes tag 883 Opacity=1; 884 if isfield(PlotParam.Scalar,'Opacity')&&~isempty(PlotParam.Scalar.Opacity) 885 Opacity=PlotParam.Scalar.Opacity; 886 end 887 % fill the space between contours if opacity is undefined or =1 888 if isequal(Opacity,1) 889 [var,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours 890 set(hcontour,'Fill','on')% fill the space between contours 891 set(hcontour,'LineStyle','none') 892 hold on 893 end 894 [var_p,hcontour_p]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines 895 hold on 896 [var_m,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines 897 if isequal(Opacity,1) 898 set(hcontour_m,'LineColor',[1 1 1])% draw negative contours in white (better visibility in dark background) 899 end 900 set(haxes,'Tag',tag_axes);% restore axes tag (removed by the matlab fct contour !) 901 hold off 851 902 852 % case of contour plot 853 if CheckContour 854 if ~isempty(hima) && ishandle(hima) 855 delete(hima) % delete existing image 856 end 857 858 % set the contour values 859 if ~isfield(PlotParam.Scalar,'IncrA') 860 PlotParam.Scalar.IncrA=[];% automatic contour interval 861 end 862 if ~isempty(PlotParam.Scalar.IncrA) && isnumeric(PlotParam.Scalar.IncrA) 863 interval=PlotParam.Scalar.IncrA; 864 else % automatic contour interval 865 cont=colbartick(MinA,MaxA); 866 interval=cont(2)-cont(1);%default 867 PlotParamOut.Scalar.IncrA=interval;% set the interval as output for display on the GUI 868 end 869 %B=A; 870 abscontmin=interval*floor(MinA/interval); 871 abscontmax=interval*ceil(MaxA/interval); 872 contmin=interval*floor(min(min(A))/interval); 873 contmax=interval*ceil(max(max(A))/interval); 874 cont_pos_plus=0:interval:contmax;% zero and positive contour values (plotted as solid lines) 875 cont_pos_min=double(contmin):interval:-interval;% negative contour values (plotted as dashed lines) 876 cont_pos=[cont_pos_min cont_pos_plus];% set of all contour values 877 878 sizpx=(Coord_x(end)-Coord_x(1))/(np(2)-1); 879 sizpy=(Coord_y(1)-Coord_y(end))/(np(1)-1); 880 x_cont=Coord_x(1):sizpx:Coord_x(end); % pixel x coordinates for image display 881 y_cont=Coord_y(1):-sizpy:Coord_y(end); % pixel x coordinates for image display 882 883 %axes(haxes)% set the input axes handle as current axis 884 885 % colormap(map); 886 tag_axes=get(haxes,'Tag');% axes tag 887 Opacity=1; 888 if isfield(PlotParam.Scalar,'Opacity')&&~isempty(PlotParam.Scalar.Opacity) 889 Opacity=PlotParam.Scalar.Opacity; 890 end 891 % fill the space between contours if opacity is undefined or =1 892 if isequal(Opacity,1) 893 [var,hcontour]=contour(haxes,x_cont,y_cont,A,cont_pos);% determine all contours 894 set(hcontour,'Fill','on')% fill the space between contours 895 set(hcontour,'LineStyle','none') 896 hold on 897 end 898 [var_p,hcontour_p]=contour(haxes,x_cont,y_cont,A,cont_pos_plus,'k-');% draw the contours for positive values as solid lines 899 hold on 900 [var_m,hcontour_m]=contour(haxes,x_cont,y_cont,A,cont_pos_min,'--');% draw the contours for negative values as dashed lines 901 if isequal(Opacity,1) 902 set(hcontour_m,'LineColor',[1 1 1])% draw negative contours in white (better visibility in dark background) 903 end 904 set(haxes,'Tag',tag_axes);% restore axes tag (removed by the matlab fct contour !) 905 hold off 906 907 %determine the color scale and map 908 caxis([abscontmin abscontmax]) 909 if BW 910 vec=linspace(0,1,(abscontmax-abscontmin)/interval);%define a greyscale colormap with steps interval 911 map=[vec' vec' vec']; 912 colormap(map); 903 %determine the color scale and map 904 caxis([abscontmin abscontmax]) 905 if BW 906 vec=linspace(0,1,(abscontmax-abscontmin)/interval);%define a greyscale colormap with steps interval 907 map=[vec' vec' vec']; 908 colormap(map); 909 else 910 colormap('default'); % default matlab colormap ('jet') 911 end 912 913 if isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1) 914 set(haxes,'DataAspectRatioMode','manual') 915 if isfield(PlotParam.Axes,'AspectRatio') 916 set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1]) 913 917 else 914 colormap('default'); % default matlab colormap ('jet') 915 end 916 917 if isfield(PlotParam.Axes,'CheckFixAspectRatio') && isequal(PlotParam.Axes.CheckFixAspectRatio,1) 918 set(haxes,'DataAspectRatioMode','manual') 919 if isfield(PlotParam.Axes,'AspectRatio') 920 set(haxes,'DataAspectRatio',[PlotParam.Axes.AspectRatio 1 1]) 921 else 922 set(haxes,'DataAspectRatio',[1 1 1]) 923 end 924 end 925 else 918 set(haxes,'DataAspectRatio',[1 1 1]) 919 end 920 end 921 else %usual images (no contour) 926 922 % set colormap for image display 927 % rescale the grey levels with min and max, put a grey scale colorbar 928 % B=A; 929 if BW 930 vec=linspace(0,1,255);%define a linear greyscale colormap 931 map=[vec' vec' vec']; 932 colormap(map); %grey scale color map 933 else 934 colormap('default'); % standard false colors for div, vort , scalar fields 935 end 923 if BW 924 vec=linspace(0,1,255);%define a linear greyscale colormap 925 map=[vec' vec' vec']; 926 colormap(map); %grey scale color map 927 if siz==3% true color images visualized in BW 928 A=uint16(sum(A,3));%sum the three color components for color images displayed with BW option 929 end 930 else 931 if siz==3 && CheckFixScalar % true color images rescaled by MaxA 932 A=uint8(255*double(A)/double(MaxA)); 933 end 934 colormap('default'); % standard false colors for div, vort , scalar fields 936 935 end 937 936 938 % case of color images939 else940 if BW941 A=uint16(sum(A,3));942 else943 A=uint8(A);944 end945 MinA=0;946 MaxA=255;947 end948 949 % display usual image950 if ~CheckContour951 937 % interpolate field to increase resolution of image display 952 938 test_interp=0; 953 if size(A,3)==1 % scalar o fB/W image939 if size(A,3)==1 % scalar or B/W image 954 940 test_interp=1; 955 941 if max(np) <= 64 … … 1014 1000 %display the colorbar code for B/W images if Poscolorbar not empty 1015 1001 if ~isempty(PosColorbar) 1016 if siz ==2&& exist('PosColorbar','var')1002 if size(A,3)==1 && exist('PosColorbar','var') 1017 1003 if isempty(hcol)||~ishandle(hcol) 1018 1004 hcol=colorbar;%create new colorbar -
trunk/src/read_civdata.m
r809 r822 105 105 return 106 106 end 107 % set the list of variables to read and their role 107 108 [varlist,role,VelTypeOut]=varcivx_generator(ProjModeRequest,VelType,Data.CivStage); 108 109 if isempty(varlist) … … 125 126 Field.SubDomain=Field.Patch1_SubDomain; 126 127 Field.ListGlobalAttribute=[Field.ListGlobalAttribute {'SubDomain'}]; 127 end 128 end 128 129 if isfield(Field,'Civ1_Dt') 129 Field.Dt=Field.Civ1_Dt;130 Field.Dt=Field.Civ1_Dt; 130 131 end 131 132 if isfield(Field,'Civ1_Time') 132 Field.Time=Field.Civ1_Time;133 Field.Time=Field.Civ1_Time; 133 134 end 134 135 case{'civ2','filter2'} … … 154 155 if strcmp(role{var_ind(ivar)},'vector_x') 155 156 Field.VarAttribute{ivar}.FieldName=FieldNames; 156 % Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;157 157 ivar_U=ivar; 158 158 end 159 159 if strcmp(role{var_ind(ivar)},'vector_x_tps') 160 160 Field.VarAttribute{ivar}.FieldName=FieldNames; 161 % Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;162 161 ivar_U_tps=ivar; 163 162 end 164 163 if strcmp(role{var_ind(ivar)},'vector_y') 165 164 Field.VarAttribute{ivar}.FieldName=FieldNames; 166 % Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;167 165 ivar_V=ivar; 168 166 end 169 167 if strcmp(role{var_ind(ivar)},'vector_y_tps') 170 168 Field.VarAttribute{ivar}.FieldName=FieldNames; 171 % Field.VarAttribute{ivar}.ProjModeRequest=ProjModeRequest;172 169 ivar_V_tps=ivar; 173 170 end -
trunk/src/read_field.m
r809 r822 81 81 [Field,ParamOut.VelType,errormsg]=read_civdata(FileName,InputField,ParamIn.VelType); 82 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 ancillary86 end83 % 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 87 87 ParamOut.CivStage=Field.CivStage; 88 88 case 'civx'% old (obsolete) format for civ results -
trunk/src/series.m
r817 r822 1992 1992 if FieldNameRequest && numel(iview_netcdf)>=1 1993 1993 set(handles.InputFields,'Visible','on') 1994 % set(handles.FieldName,'Visible','on')1995 1994 if CheckList==0 % not civ input made 1995 if isfield(SeriesData.FileInfo{iview_netcdf(1)},'ListVarName') 1996 1996 ListVarName=SeriesData.FileInfo{iview_netcdf(1)}.ListVarName; 1997 1997 ind_var=get(handles.FieldName,'Value');%indices of previously selected variables … … 2049 2049 else 2050 2050 set(handles.FieldName_1,'Visible','off') 2051 end 2051 2052 end 2052 2053 else -
trunk/src/series/civ_input.m
r810 r822 473 473 474 474 handles.output.ActionInput=read_GUI(handles.civ_input); 475 % correct mask or grid name for Windows system (replace '\' by '/') 476 if isfield(handles.output.ActionInput,'Civ1') 477 if isfield(handles.output.ActionInput.Civ1,'Mask') 478 handles.output.ActionInput.Civ1.Mask=regexprep(handles.output.ActionInput.Civ1.Mask,'\','/'); 479 end 480 if isfield(handles.output.ActionInput.Civ1,'Grid') 481 handles.output.ActionInput.Civ1.Grid=regexprep(handles.output.ActionInput.Civ1.Grid,'\','/'); 482 end 483 end 484 if isfield(handles.output.ActionInput,'Civ2') 485 if isfield(handles.output.ActionInput.Civ2,'Mask') 486 handles.output.ActionInput.Civ2.Mask=regexprep(handles.output.ActionInput.Civ2.Mask,'\','/'); 487 end 488 if isfield(handles.output.ActionInput.Civ2,'Grid') 489 handles.output.ActionInput.Civ2.Grid=regexprep(handles.output.ActionInput.Civ2.Grid,'\','/'); 490 end 491 end 475 492 guidata(hObject, handles);% Update handles structure 476 493 uiresume(handles.civ_input); -
trunk/src/series/civ_series.m
r819 r822 78 78 if ischar(Param) 79 79 Param=xml2struct(Param);% read Param as input file (batch case) 80 Param.InputTable{1}81 Param.InputTable{2}82 Param.InputTable{3}83 80 checkrun=0; 84 81 end … … 153 150 [i1_series_Civ2,i2_series_Civ2,j1_series_Civ2,j2_series_Civ2,check_bounds,NomTypeNc]=... 154 151 find_pair_indices(PairCiv2,i1_series{2},j1_series{2},MinIndex_i(2),MaxIndex_i(2),MinIndex_j(2),MaxIndex_j(2)); 155 % check_bounds=check_bounds | check_bounds_Civ2;156 152 end 157 153 end … … 204 200 FrameIndex_A_Civ2=i1_series_Civ2; 205 201 FrameIndex_B_Civ2=i2_series_Civ2; 202 j1_series_Civ2=ones(size(i1_series_Civ2)); 203 j2_series_Civ2=ones(size(i1_series_Civ2)); 206 204 else 207 205 FrameIndex_A_Civ2=j1_series_Civ2; … … 253 251 return 254 252 end 255 [FileType_A,FileInfo_A,VideoObject_A]=get_file_info(ImageName_A); 253 [FileInfo_A,VideoObject_A]=get_file_info(ImageName_A); 254 FileType_A=FileInfo_A.FileType; 256 255 [par_civ1.ImageA,VideoObject_A] = read_image(ImageName_A,FileInfo_A.FileType,VideoObject_A,FrameIndex_A_Civ2(1)); 257 256 ImageName_B=fullfile_uvmat(RootPath_B,SubDir_B,RootFile_B,FileExt_B,NomType_B,i2_series_Civ2(1),[],j2_series_Civ2(1)); … … 264 263 [par_civ1.ImageB,VideoObject_B] = read_image(ImageName_B,FileType_B,VideoObject_B,FrameIndex_B_Civ2(1)); 265 264 NbField=numel(i1_series_Civ2); 265 else 266 NbField=numel(i1_series_Civ1);% no image used (only fix or patch) TO CHECK 266 267 end 267 268 catch ME … … 280 281 Data.Program='civ_series'; 281 282 Data.CivStage=0;%default 282 % ListVarCiv1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F'}; %variables to read283 % ListVarFix1={'Civ1_X','Civ1_Y','Civ1_U','Civ1_V','Civ1_C','Civ1_F','Civ1_FF'};284 % mask='';285 283 maskname='';%default 286 284 check_civx=0;%default 287 % check_civ1=0;%default288 % check_patch1=0;%default289 285 290 286 %% get timing from the ImaDoc file or input video 287 if iview_A~=0 291 288 XmlFileName=find_imadoc(RootPath_A,SubDir_A,RootFile_A,FileExt_A); 292 289 time=[]; … … 316 313 end 317 314 if isempty(time)% time = index i +0.001 index j by default 318 time=(MinIndex_i:MaxIndex_i)'*ones(1,MaxIndex_j-MinIndex_j+1); 319 time=time+0.001*ones(MaxIndex_i-MinIndex_i+1,1)*(MinIndex_j:MaxIndex_j); 320 time=[zeros(1,MaxIndex_j-MinIndex_j+1);time];% insert a first line of zeros 321 time=[zeros(MaxIndex_i-MinIndex_i+2,1) time];% insert a first column of zeros 315 %MinIndex_i=min(i1_series_Civ1); 316 MaxIndex_i=max(i2_series_Civ1); 317 %MinIndex_j=min(j1_series_Civ1); 318 MaxIndex_j=max(j2_series_Civ1); 319 time=(1:MaxIndex_i)'*ones(1,MaxIndex_j); 320 time=time+0.001*ones(MaxIndex_i,1)*(1:MaxIndex_j); 321 time=[zeros(1,MaxIndex_j);time];% insert a first line of zeros 322 time=[zeros(MaxIndex_i+1,1) time];% insert a first column of zeros 322 323 end 323 324 … … 325 326 nbfield=length(FileInfo_A); 326 327 nbfield_j=1; 328 end 327 329 end 328 330 … … 334 336 break 335 337 end 336 if iview_A==1% if Civ1 is performed 337 Civ1Dir=OutputDir; 338 if iview_A==0 339 ncfile=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},Param.InputTable{1,5},... 340 NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 338 341 else 339 Civ1Dir=Param.InputTable{1,2}; 340 end 341 if strcmp(Param.ActionInput.ListCompareMode,'PIV') 342 ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),... 343 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 344 else 345 ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],... 346 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 347 end 348 342 if iview_A==1% if Civ1 is performed 343 Civ1Dir=OutputDir; 344 else 345 Civ1Dir=Param.InputTable{1,2}; 346 end 347 if strcmp(Param.ActionInput.ListCompareMode,'PIV') 348 ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i1_series_Civ1(ifield),i2_series_Civ1(ifield),... 349 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 350 else 351 ncfile=fullfile_uvmat(RootPath_A,Civ1Dir,RootFile_A,'.nc',NomTypeNc,i2_series_Civ1(ifield),[],... 352 j1_series_Civ1(ifield),j2_series_Civ1(ifield)); 353 end 354 end 349 355 %% Civ1 350 356 % if Civ1 computation is requested … … 466 472 %% Fix1 467 473 if isfield (Param.ActionInput,'Fix1') 474 if ~isfield (Param.ActionInput,'Civ1')% if we use existing Civ1, remove previous data beyond Civ1 475 Fix1_attr=find(strcmp('Fix1',Data.ListGlobalAttribute)); 476 Data.ListGlobalAttribute(Fix1_attr)=[]; 477 for ilist=1:numel(Fix1_attr) 478 Data=rmfield(Data,Data.ListGlobalAttribute{Fix1_attr(ilist)}); 479 end 480 end 468 481 ListFixParam=fieldnames(Param.ActionInput.Fix1); 469 482 for ilist=1:length(ListFixParam) … … 615 628 par_civ2.SearchBoxSize(1)=2*ibx2+9;% search ara +-4 pixels around the guess 616 629 par_civ2.SearchBoxSize(2)=2*iby2+9; 617 % i1=i1_series_Civ2(ifield);618 % i2=i1;619 % if ~isempty(i2_series_Civ2)620 % i2=i2_series_Civ2(ifield);621 % end622 % j1=1;623 % if ~isempty(j1_series_Civ2)624 % j1=j1_series_Civ2(ifield);625 % end626 % j2=j1;627 % if ~isempty(j2_series_Civ1)628 % j2=j2_series_Civ2(ifield);629 % end630 630 Civ2_Dt=time(i2+1,j2+1)-time(i1+1,j1+1); 631 631 par_civ2.SearchBoxShift=(Civ2_Dt/Data.Civ1_Dt)*[Shiftx(nbval>=1)./nbval(nbval>=1) Shifty(nbval>=1)./nbval(nbval>=1)]; … … 693 693 nbvar=length(Data.ListVarName); 694 694 Data.VarAttribute{nbvar}.Role='errorflag'; 695 Data.Civ2_FF= fix(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V);695 Data.Civ2_FF=double(fix(Param.ActionInput.Fix2,Data.Civ2_F,Data.Civ2_C,Data.Civ2_U,Data.Civ2_V)); 696 696 Data.CivStage=Data.CivStage+1; 697 697 end -
trunk/src/tps_coeff_field.m
r809 r822 6 6 % DataOut: output field structure, reproducing the input field structure DataIn and adding the fields: 7 7 % .Coord_tps 8 % .[VarName '_tps'] for each eligible input variable VarName (scalar o fr vector components)8 % .[VarName '_tps'] for each eligible input variable VarName (scalar or vector components) 9 9 % errormsg: error message, = '' by default 10 10 % 11 11 % INPUT: 12 12 % DataIn: intput field structure 13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps is needed), =0 otherwise 13 % checkall:=1 if tps is needed for all fields (a projection mode interp_tps has been chosen), 14 % =0 otherwise (tps only needed to get spatial derivatives of scattered data) 14 15 % 15 16 % called functions: … … 53 54 54 55 for icell=1:numel(CellInfo); 55 if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %%if the coordinates are scattered56 if NbDimArray(icell)>=2 && strcmp(CellInfo{icell}.CoordType,'scattered') %if the coordinates are scattered 56 57 NbCoord=NbDimArray(icell);% dimension of space 57 58 nbtps=nbtps+1;% indicate the number of tps coordinate sets in the field structure (in general =1) 58 59 X=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end)});% value of x coordinate 59 Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of xcoordinate60 Y=DataIn.(DataIn.ListVarName{CellInfo{icell}.CoordIndex(end-1)});% value of y coordinate 60 61 check_interp_tps=false(numel(DataIn.ListVarName),1); 61 %for ivar=1:numel(CellInfo{icell}.VarIndex) 62 Index_interp=[]; 63 if isfield(CellInfo{icell},'VarIndex_scalar') 62 Index_interp=[];% indices of variables to interpolate 63 if isfield(CellInfo{icell},'VarIndex_scalar')%interpolate scalar 64 64 Index_interp=[Index_interp CellInfo{icell}.VarIndex_scalar]; 65 65 end 66 if isfield(CellInfo{icell},'VarIndex_vector_x') 66 if isfield(CellInfo{icell},'VarIndex_vector_x')%interpolate vector x component 67 67 Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_x]; 68 68 end 69 if isfield(CellInfo{icell},'VarIndex_vector_y') 69 if isfield(CellInfo{icell},'VarIndex_vector_y')%interpolate vector y component 70 70 Index_interp=[Index_interp CellInfo{icell}.VarIndex_vector_y]; 71 71 end … … 76 76 end 77 77 end 78 79 %VarIndexInterp=CellInfo{icell}.VarIndex(check_interp_tps);% indices of variables to interpolate through tps80 % if ~isempty(VarIndexInterp)81 78 ListVarInterp=DataIn.ListVarName(check_interp_tps); 82 79 VarIndexInterp=find(check_interp_tps); … … 110 107 DataOut.(['Coord_tps' term])(1:NbCentre(isub),1:2,isub)=[X(ind_sel) Y(ind_sel)]; 111 108 DataOut.(['Coord_tps' term])(NbCentre(isub)+1:NbCentre(isub)+3,1:2,isub)=0;%matrix of zeros to complement the matrix Coord_tps (conveninent for file storage) 112 %fill=zeros(NbCoord+1,NbCoord,size(SubRange,3)); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)113 % fill=zeros(NbCoord+1,NbCoord+1,NbCoord); %matrix of zeros to complement the matrix Data.Civ1_Coord_tps (conveninent for file storage)114 % Coord_tps=cat(1,Coord_tps,fill);115 109 end 116 110 for ivar=1:numel(ListVarInterp) … … 132 126 DataOut.(['SubRange' term])=SubRange; 133 127 DataOut.(['NbCentre' term])=NbCentre; 134 % DataOut.(['Coord_tps' term])=Coord_tps;135 128 for ilist=1:numel(VarIndexInterp) 136 % Var_tps=zeros(size(IndSelSubDomain)+[NbCoord+1 0]);%default spline137 129 for isub=1:size(SubRange,3) 138 130 ind_sel=IndSelSubDomain(1:NbCentre(isub),isub);% array indices selected for the subdomain
Note: See TracChangeset
for help on using the changeset viewer.