Changeset 1181 for trunk/src/series
- Timestamp:
- May 21, 2025, 6:14:05 PM (9 months ago)
- Location:
- trunk/src/series
- Files:
-
- 5 edited
-
check_data_files.m (modified) (1 diff)
-
civ_input.fig (modified) (previous)
-
civ_input.m (modified) (6 diffs)
-
civ_series.m (modified) (4 diffs)
-
filter_time_singlefile.m (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series/check_data_files.m
r1164 r1181 176 176 end 177 177 else 178 datnum=datnum(datnum );%keep the non zero values corresponding to existing files179 filefound=filefound(datnum );178 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 179 filefound=filefound(datnum~=0); 180 180 [first,ind]=min(datnum); 181 181 [last,indlast]=max(datnum); -
trunk/src/series/civ_input.m
r1180 r1181 91 91 if isfield(SeriesData,'FileInfo') 92 92 FileType=SeriesData.FileInfo{1}.FileType;% info on the first input file series 93 FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series93 %FieldType=SeriesData.FileInfo{1}.FieldType;% info on the first input file series 94 94 else 95 95 set(hhseries.REFRESH,'BackgroundColor',[1 0 1])% indicate that the file input in series needs to be refreshed … … 207 207 set(handles.TimeSource,'String',Param.IndexRange.TimeSource); 208 208 else 209 msgbox_uvmat('WARNING','timing not defined (check xml file), default values used') 209 210 set(handles.TimeSource,'String',''); %xml file not used for timing 210 211 TimeUnit='frame'; … … 377 378 %% list the possible index pairs, depending on the option set in ListPairMode 378 379 ListPairMode_Callback([], [], handles) 379 380 if isfield(Param,'ActionInput')&& isfield(Param.ActionInput,'PairIndices') 381 if isfield(Param.ActionInput.PairIndices,'ListPairCiv1') 382 PairChoiceCiv1=find(strcmp(Param.ActionInput.PairIndices.ListPairCiv1,get(handles.ListPairCiv1,'String'))); 383 if ~isempty(PairChoiceCiv1) 384 set(handles.ListPairCiv1,'Value',PairChoiceCiv1) 385 end 386 end 387 if isfield(Param.ActionInput.PairIndices,'ListPairCiv2') 388 PairChoiceCiv2=find(strcmp(Param.ActionInput.PairIndices.ListPairCiv2,get(handles.ListPairCiv2,'String'))); 389 if ~isempty(PairChoiceCiv2) 390 set(handles.ListPairCiv2,'Value',PairChoiceCiv2) 391 end 392 end 393 end 394 380 395 %% set the GUI to modal: wait for OK to close 381 396 set(handles.civ_input,'WindowStyle','modal')% Make the GUI modal … … 810 825 %reproduce by default the chosen pair in the checkciv2 menu 811 826 set(handles.ListPairCiv2,'Value',get(handles.ListPairCiv1,'Value'))%civ2 selection the same as civ1 by default 812 ListPairCiv2_Callback(hObject, eventdata, handles)813 814 % ------------------------------------------------------------------------815 % --- Executes on selection change in ListPairCiv2.816 function ListPairCiv2_Callback(hObject, eventdata, handles)817 % ------------------------------------------------------------------------827 %ListPairCiv2_Callback(hObject, eventdata, handles) 828 829 % %------------------------------------------------------------------------ 830 % % --- Executes on selection change in ListPairCiv2. 831 % function ListPairCiv2_Callback(hObject, eventdata, handles) 832 % %------------------------------------------------------------------------ 818 833 819 834 %------------------------------------------------------------------------ … … 1527 1542 set(obj,'Visible','off') 1528 1543 end 1544 set(handles.ConfigSource,'String','NEW') 1545 set(handles.OK,'BackgroundColor',[1 0 1]) 1546 1547 1548 %------------------------------------------------------------------------ 1549 % --- Executes on button press in CheckRescale. 1550 function CheckRescale_Callback(hObject, eventdata, handles) 1551 %------------------------------------------------------------------------ 1552 huipanel=get(hObject,'parent'); 1553 obj(1)=findobj(huipanel,'Tag','num_Maxtanh'); 1554 obj(2)=findobj(huipanel,'Tag','title_Maxtanh'); 1555 if get(hObject,'Value')% if chck box has been selected 1556 set(obj,'Visible','on') 1557 else 1558 set(obj,'Visible','off') 1559 end 1560 set(handles.ConfigSource,'String','NEW') 1561 set(handles.OK,'BackgroundColor',[1 0 1]) 1562 1563 %------------------------------------------------------------------------ 1564 % --- synchronise the image threshold for civ1 and civ2 1565 function num_MaxIma_Callback(hObject, eventdata, handles) 1566 MaxIma_string=get(hObject,'String'); 1567 set(handles.num_MaxIma,'String',MaxIma_string); 1568 set(handles.num_MaxIma,'Visible','on'); 1569 set(handles.title_Threshold,'Visible','on'); 1570 set(handles.CheckThreshold,'Value',true); 1571 1572 set(handles.ConfigSource,'String','NEW') 1573 set(handles.OK,'BackgroundColor',[1 0 1]) 1574 1575 %------------------------------------------------------------------------ 1576 % --- synchronise the image rescaling threshold for civ1 and civ2 1577 function num_Maxtanh_Callback(hObject, eventdata, handles) 1578 Maxtanh_string=get(hObject,'String'); 1579 set(handles.num_Maxtanh,'String',Maxtanh_string); 1580 set(handles.num_Maxtanh,'Visible','on'); 1581 set(handles.title_Maxtanh,'Visible','on'); 1582 set(handles.CheckRescale,'Value',true); 1583 1529 1584 set(handles.ConfigSource,'String','NEW') 1530 1585 set(handles.OK,'BackgroundColor',[1 0 1]) … … 1952 2007 1953 2008 1954 function edit108_Callback(hObject, eventdata, handles)1955 % hObject handle to edit108 (see GCBO)1956 % eventdata reserved - to be defined in a future version of MATLAB1957 % handles structure with handles and user data (see GUIDATA)1958 1959 % Hints: get(hObject,'String') returns contents of edit108 as text1960 % str2double(get(hObject,'String')) returns contents of edit108 as a double1961 1962 1963 2009 % --- Executes on button press in CheckBackground. 1964 2010 function CheckBackground_Callback(hObject, eventdata, handles) -
trunk/src/series/civ_series.m
r1180 r1181 69 69 Data.VelType='off';% menu for selecting the velocity type (options 'off'/'one'/'two', 'off' by default) 70 70 Data.FieldName='on';% menu for selecting the field (s) in the input file(options 'off'/'one'/'two', 'off' by default) 71 Data.FieldTransform = 'o n';%can use a transform function71 Data.FieldTransform = 'off';%can use a transform function 72 72 Data.ProjObject='off';%can use projection object(option 'off'/'on', 73 73 Data.Mask='off';%can use mask option (option 'off'/'on', 'off' by default) … … 258 258 CheckRelabel=isfield(Param,'FileSeries' );%=true for index relabeling (PCO) 259 259 260 % % introduce input image transform261 transform_fct=[];%default, no transform262 if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName)263 currentdir=pwd;264 cd(Param.FieldTransform.TransformPath)265 transform_fct=str2func(Param.FieldTransform.TransformName);266 cd (currentdir)267 end260 % %% introduce input image transform 261 % transform_fct=[];%default, no transform 262 % if isfield(Param,'FieldTransform')&&~isempty(Param.FieldTransform.TransformName) 263 % currentdir=pwd; 264 % cd(Param.FieldTransform.TransformPath) 265 % transform_fct=str2func(Param.FieldTransform.TransformName); 266 % cd (currentdir) 267 % end 268 268 269 269 %%%%% MAIN LOOP %%%%%% … … 445 445 end 446 446 447 448 %% user defined image transform449 if ~isempty(transform_fct)450 par_civ1 =transform_fct(par_civ1,Param);447 % case of image luminosity rescaling 448 if par_civ1.CheckRescale &&~isempty(par_civ1.Maxtanh) 449 par_civ1.ImageA =par_civ1.Maxtanh*tanh(double(par_civ1.ImageA)/par_civ1.Maxtanh); 450 par_civ1.ImageB=par_civ1.Maxtanh*tanh(double(par_civ1.ImageB)/par_civ1.Maxtanh); 451 451 end 452 452 … … 672 672 end 673 673 674 %% user defined image transform 675 if ~isempty(transform_fct) 676 par_civ2 =transform_fct(par_civ2,Param); 677 end 678 674 % %% user defined image transform 675 % if ~isempty(transform_fct) 676 % par_civ2 =transform_fct(par_civ2,Param); 677 % end 678 %% case of image luminosity rescaling 679 if par_civ2.CheckRescale &&~isempty(par_civ2.Maxtanh) 680 par_civ2.ImageA =par_civ2.Maxtanh*tanh(double(par_civ2.ImageA)/par_civ2.Maxtanh); 681 par_civ2.ImageB=par_civ2.Maxtanh*tanh(double(par_civ2.ImageB)/par_civ2.Maxtanh); 682 end 679 683 680 684 % get the guess from patch1 or patch2 (case 'CheckCiv3') -
trunk/src/series/filter_time_singlefile.m
r1158 r1181 1 %'filter_time_single': apply a a sliding filter in a time series, put the time series in a single netcdf file (problematic...) 2 %------------------------------------------------------------------------ 1 %'filter_time_single': apply a a sliding filter to a time series and concatene the result in a single netcdf file 3 2 % function ParamOut=filter_time(Param) 4 3 % … … 149 148 150 149 %%%%%%%%%%%%%%%% loop on field indices %%%%%%%%%%%%%%%% 151 disp('loop for filtering started') 152 tstart = tic; 153 telapsed(zeros,1,NbField) 150 disp('loop for filtering started') 151 ncid=[]; 154 152 for index=1:NbField 155 153 index 156 157 Field= read_field(filecell{1,index},'netcdf',Param.InputFields); 158 154 155 [Field,~,errormsg]= read_field(filecell{1,index},'netcdf',Param.InputFields); 156 if ~isempty(errormsg) 157 disp(errormsg) 158 if ~isempty(ncid) 159 netcdf.close(ncid) 160 end 161 return 162 end 159 163 %%%%%%%%%%% MAIN RUNNING OPERATIONS %%%%%%%%%%%% 160 164 if index==1 %first field, initialisation output data 161 165 DataOut.ListGlobalAttribute= {'Conventions'}; 162 166 DataOut.Conventions='uvmat'; 163 DataOut.ListVarName={'Time','coord_y','coord_x','Ufilter','Vfilter'};164 DataOut.VarDimName={'Time','coord_y','coord_x',{'Time','coord_y','coord_x'},{'Time','coord_y','coord_x'}};165 167 npy=numel(Field.coord_y); 166 168 npx=numel(Field.coord_x); 167 169 ListDimName={'Time','coord_y','coord_x'}; 168 170 DimValue=[NbField npy npx]; 169 VarDimIndex={1,2,3,[1 2 3],[1 2 3]}; 171 ListFields=Param.InputFields.FieldName; 172 DataOut.ListVarName=[{'Time','coord_y','coord_x'} ListFields']; 173 %DataOut.VarDimName={'Time','coord_y','coord_x',{'Time','coord_y','coord_x'},{'Time','coord_y','coord_x'}}; 174 DataOut.VarDimName={'Time','coord_y','coord_x'}; 175 VarDimIndex={1,2,3}; 176 for ifield=1:numel(ListFields) 177 DataOut.VarDimName{ifield+3}={'coord_y','coord_x','Time'}; 178 Field_varid(ifield)=ifield+2; 179 VarDimIndex{ifield+3}=[2 3 1]; 180 end 181 182 % VarDimIndex={1,2,3,[1 2 3],[1 2 3]}; 183 170 184 DataOut.coord_x=Field.coord_x; 171 185 DataOut.coord_y=Field.coord_y; 172 186 DataOut.Time=0; 173 DataOut.Ufilter=0; 174 DataOut.Vfilter=0; 187 for ifield=1:numel(ListFields) 188 DataOut.(ListFields{ifield})=0; 189 end 175 190 [errormsg,ncid]=struct2nc(ncfile_out,DataOut,'keep_open',ListDimName,DimValue,VarDimIndex); 176 191 netcdf.putVar(ncid,0,0,1,0) 177 192 netcdf.putVar(ncid,1,0,npy,Field.coord_y) 178 193 netcdf.putVar(ncid,2,0,npx,Field.coord_x) 179 Uvarid=3;180 Vvarid=4;194 % Uvarid=3; 195 % Vvarid=4; 181 196 TimeBlock=zeros(Param.ActionInput.WindowLength,1); 182 Ublock=zeros(Param.ActionInput.WindowLength,npy,npx); 183 Vblock=zeros(Param.ActionInput.WindowLength,npy,npx); 184 end 197 Fieldblock=zeros(numel(ListFields),Param.ActionInput.WindowLength,npy,npx); 198 %Vblock=zeros(Param.ActionInput.WindowLength,npy,npx); 199 end 200 185 201 TimeBlock=circshift(TimeBlock,[-1 0 ]); 186 Ublock=circshift(Ublock,[-1 0 0]); %shift U by ishift along the first index187 Vblock=circshift(Vblock,[-1 0 0]); %shift U by ishift along the first index188 202 TimeBlock(end)=Field.Time; 189 Ublock(end,:,:)=Field.U;190 Vblock(end,:,:)=Field.V;191 203 sumindex=min(index,Param.ActionInput.WindowLength)-1; 192 204 Timefilter=mean(TimeBlock(end-sumindex:end,:,:));%mid time 193 Ufilter=squeeze(mean(Ublock(end-sumindex:end,:,:),1,'omitnan')); 194 Vfilter=squeeze(mean(Vblock(end-sumindex:end,:,:),1,'omitnan')); 205 Fieldblock=circshift(Fieldblock,[0 -1 0 0]); %shift U by ishift along the first index 206 % Vblock=circshift(Vblock,[-1 0 0]); %shift U by ishift along the first index 207 for ifield=1:numel(ListFields) 208 Fieldblock(ifield,end,:,:)=Field.(ListFields{ifield}); 209 end 210 %Vblock(end,:,:)=Field.V; 211 Fieldfilter=squeeze(mean(Fieldblock(:,end-sumindex:end,:,:),2,'omitnan')); 212 % Ufilter=squeeze(mean(Ublock(end-sumindex:end,:,:),1,'omitnan')); 213 % Vfilter=squeeze(mean(Vblock(end-sumindex:end,:,:),1,'omitnan')); 214 % Uerror=Ufilter-Ublock(end-floor(sumindex/2),:,:); 215 % Verror=Ufilter-Vblock(end-floor(sumindex/2),:,:); 195 216 %updating output the netcdf file 217 tstart = tic; 196 218 netcdf.putVar(ncid,0,(index-1),Timefilter) 197 netcdf.putVar(ncid,Uvarid,[(index-1) 0 0],[1 npy npx],Ufilter) 198 netcdf.putVar(ncid,Vvarid,[(index-1) 0 0],[1 npy npx],Vfilter) 199 200 telapsed(index) = toc(tstart); 219 for ifield=1:numel(ListFields) 220 netcdf.putVar(ncid,Field_varid(ifield),[ 0 0 (index-1)],[npy npx 1],squeeze(Fieldfilter(ifield,:,:))) 221 end 222 % netcdf.putVar(ncid,Uvarid,[ 0 0 (index-1)],[npy npx 1],Ufilter) 223 % netcdf.putVar(ncid,Vvarid,[0 0 (index-1)],[npy npx 1],Vfilter) 224 225 telapsed = toc(tstart)% time for writting the field 201 226 % writing the result file as netcdf file 202 227 % i1=i1_series{1}(index)-ceil(NpTime/2); … … 212 237 figure 213 238 plot(telapsed) 239 ylabel('time lapsed computation') 214 240 'END'
Note: See TracChangeset
for help on using the changeset viewer.
