Changeset 1090 for trunk/src/series.m
- Timestamp:
- Jan 21, 2021, 3:59:54 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r1085 r1090 706 706 707 707 %% get the input root name, indices, file extension and nomenclature NomType 708 if ~exist(fileinput,'file')708 if isempty(regexp(fileinput,'^http')) && ~exist(fileinput,'file') 709 709 errormsg=['input file ' fileinput ' does not exist']; 710 710 msgbox_uvmat('ERROR',errormsg) … … 1601 1601 Param.IndexRange.NbSlice=[]; 1602 1602 end 1603 OutputPath=get(handles.OutputPath,'String'); 1603 1604 1604 1605 %% Look for processing on multiple experiments set by the GUI browse_data … … 1624 1625 for iexp=1:numel(ListExp) 1625 1626 if ~isempty(regexp(ListExp{iexp},'^\+/'))% if it is a folder 1626 if strcmp(get(BrowseData.DataSeries,'enable'),'off') ;%case of a multiple input line for series1627 if strcmp(get(BrowseData.DataSeries,'enable'),'off') %case of a multiple input line for series 1627 1628 NbExp=NbExp+1; 1628 1629 ExpIndex{NbExp}=iexp; … … 1630 1631 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1631 1632 regexprep(ListDevices{idevice},'^\+/','')); 1633 lpathout=fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),... 1634 regexprep(ListDevices{idevice},'^\+/','')); 1632 1635 ldir=regexprep(ListDataSeries{idevice},'^\+/',''); 1633 1636 ListPath{idevice,NbExp}=lpath; 1637 ListPathOut{idevice,NbExp}=lpathout; 1634 1638 ListSubdir{idevice,NbExp}=ldir; 1635 1639 end … … 1641 1645 lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),... 1642 1646 regexprep(ListDevices{idevice},'^\+/','')); 1647 lpathout= fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),... 1648 regexprep(ListDevices{idevice},'^\+/','')); 1643 1649 ldir= regexprep(ListDataSeries{isubdir},'^\+/',''); 1644 1650 if exist(fullfile(lpath,ldir),'dir') … … 1646 1652 ExpIndex{NbExp}=iexp; 1647 1653 ListPath{NbExp}=lpath; 1654 ListPathOut{NbExp}=lpathout; 1648 1655 ListSubdir{NbExp}=ldir; 1649 1656 end … … 1661 1668 end 1662 1669 end 1663 % set(handles.OutputSubDir,'String',SubDir) 1664 % Param.OutputSubDir=SubDir; 1670 1665 1671 %%%%%%%%%%%%%%%%%%% LOOP ON EXPERIMENTS POSSIBLY SET BY THE GUI browse_data, NbExp=1 otherwise %%%%%%%%% 1672 1666 1673 for iexp=1:NbExp 1667 1674 if get(handles.Replicate,'Value') … … 1689 1696 answer=''; 1690 1697 if isfield(Param,'OutputSubDir')% possibly update the output dir if it already exists 1698 PathOut=get(handles.OutputPath,'String'); 1699 if ~exist(PathOut,'dir') % test if the dir already exist 1700 PathOut=uigetdir(PathOut,'pick the output root path') 1701 set(handles.OutputPath,'String',PathOut); 1702 end 1703 PathExpOut=fullfile(PathOut,get(handles.Experiment,'String')); 1704 if ~exist(PathExpOut,'dir') 1705 [tild,msg1]=mkdir(PathExpOut); 1706 if ~strcmp(msg1,'') 1707 errormsg=['cannot create ' PathExpOut ': ' msg1]; % error message for directory creation 1708 return 1709 end 1710 end 1711 PathExpDeviceOut=fullfile(PathExpOut,get(handles.Device,'String')); 1712 if ~exist(PathExpDeviceOut,'dir') 1713 [tild,msg1]=mkdir(PathExpDeviceOut); 1714 if ~strcmp(msg1,'') 1715 errormsg=['cannot create ' PathExpDeviceOut ': ' msg1]; % error message for directory creation 1716 return 1717 end 1718 end 1691 1719 SubDirOut=[Param.OutputSubDir Param.OutputDirExt]; 1692 1720 SubDirOutNew=SubDirOut; 1693 detect=exist(fullfile(Pa ram.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exist1721 detect=exist(fullfile(PathExpDeviceOut,SubDirOutNew),'dir'); % test if the dir already exist 1694 1722 check_create=1; % need to create the result directory by default 1695 1723 CheckOverwrite=1; 1696 1724 if isfield(Param,'CheckOverwrite') 1697 CheckOverwrite=Param.CheckOverwrite; 1725 CheckOverwrite=Param.CheckOverwrite;% will overwrite previous data if it is equal to 1 1698 1726 end 1699 1727 while detect … … 1703 1731 comment=', will complement existing result files (no overwriting)'; 1704 1732 end 1705 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Pa ram.InputTable{1,1},SubDirOutNew) comment]);1733 answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(PathExpDeviceOut,SubDirOutNew) comment]); 1706 1734 if strcmp(answer,'Cancel') 1707 1735 break … … 1716 1744 end 1717 1745 SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; % increment the index by 1 or put 1 1718 detect=exist(fullfile(Pa ram.InputTable{1,1},SubDirOutNew),'dir'); % test if the dir already exists1746 detect=exist(fullfile(PathExpDeviceOut,SubDirOutNew),'dir'); % test if the dir already exists 1719 1747 check_create=1; 1720 1748 end … … 1725 1753 Param.OutputDirExt=regexprep(SubDirOutNew,['^' Param.OutputSubDir],''); 1726 1754 Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output 1727 OutputDir=fullfile(Pa ram.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory1755 OutputDir=fullfile(PathExpDeviceOut,[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory 1728 1756 if check_create % create output directory if it does not exist 1729 1757 [tild,msg1]=mkdir(OutputDir); … … 2445 2473 FieldList=set_field_list('U','V'); % standard menu for civx data 2446 2474 if max(get(handles.FieldName,'Value'))>numel(FieldList) 2447 set(handles.FieldName,'Value',1); % velocity vector choice by default2475 set(handles.FieldName,'Value',1); % velocity vector choice by default 2448 2476 end 2449 2477 if VelTypeRequest_1 && numel(iview_civ)>=2 … … 2500 2528 set(handles_coord,'Visible','on') 2501 2529 if isempty(find(strcmp('add_field...',FieldList))) 2502 FieldList=[FieldList;{'add_field...'}];%add 'add_field...' to the menu FieldName if it is not already2530 FieldList=[FieldList;{'add_field...'}];%add 'add_field...' to the menu FieldName if it is not already 2503 2531 end 2504 2532 if FieldNameRequest_1 && numel(iview_netcdf)>=2 … … 2564 2592 set(handles.MinIndex_j,'Data',MinIndex_j(iview,:)); 2565 2593 set(handles.MaxIndex_i,'Data',MaxIndex_i(iview,:)); 2566 set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:)); ;2594 set(handles.MaxIndex_j,'Data',MaxIndex_j(iview,:)); 2567 2595 TimeTable=get(handles.TimeTable,'Data'); 2568 2596 if size(TimeTable,1)<size(Param.InputTable,1)%if the time table is not complete, copy the missing lines from the previous ones … … 2653 2681 end 2654 2682 set(handles.FieldTransform,'Visible',FieldTransformVisible) 2655 if isfield(ParamOut,'TransformPath') ;% record the path of transform function requested for compilation2683 if isfield(ParamOut,'TransformPath')% record the path of transform function requested for compilation 2656 2684 set(handles.TransformPath,'UserData',ParamOut.TransformPath) 2657 2685 else … … 2684 2712 end 2685 2713 2686 %% definition of the directory containing the output files 2714 %% definition of the path for the output files 2715 InputTable=get(handles.InputTable,'Data'); 2716 [OutputPath,Device,DeviceExt]=fileparts(InputTable{1,1}); 2717 [OutputPath,Experiment,ExperimentExt]=fileparts(OutputPath); 2718 set(handles.Device,'String',[Device DeviceExt]) 2719 set(handles.Device,'Visible','on') 2720 set(handles.Device_title,'Visible','on') 2721 set(handles.Experiment,'String',[Experiment ExperimentExt]) 2722 set(handles.Experiment,'Visible','on') 2723 set(handles.Experiment_title,'Visible','on') 2724 OutputPathOld=get(handles.OutputPath,'String') 2725 if isempty(OutputPathOld) 2726 if ~isempty(regexp(InputTable{1,1},'(^http://)|(^https://)')) 2727 OutputPath=uigetdir(pwd,'pick a root folder for output data'); 2728 end 2729 set(handles.OutputPath,'String',OutputPath) 2730 end 2731 set(handles.Experiment_title,'Visible','on') 2732 set(handles.OutputPath,'Visible','on') 2733 set(handles.OutputPathBrowse,'Visible','on') 2734 2735 %% definition of the subdirectory containing the output files 2736 2687 2737 if ~(isfield(SeriesData,'ActionName') && strcmp(ActionName,SeriesData.ActionName)) 2688 2738 OutputDirExt='.series'; % default … … 2698 2748 OutputSubDirMode=ParamOut.OutputSubDirMode; 2699 2749 end 2700 InputTable=get(handles.InputTable,'Data');2701 2750 switch OutputSubDirMode 2702 case 'auto' ;% default2751 case 'auto' % default 2703 2752 OutputDirVisible='on'; 2704 2753 SubDir=InputTable(1:end,2); % set of subdirectories … … 2727 2776 set(handles.OutputDirExt,'Visible',OutputDirVisible) 2728 2777 set(handles.OutputSubDir,'Visible',OutputDirVisible) 2729 %set(handles.CheckOverwrite,'Visible',OutputDirVisible)2730 2778 set(handles.OutputDir_title,'Visible',OutputDirVisible) 2731 2779 SeriesData.ActionName=ActionName; % record ActionName for next use … … 2810 2858 FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},... 2811 2859 InputTable{LineIndex,5},InputTable{LineIndex,4},i1,i2,j1,j2); 2812 if exist(FirstFileName,'file') 2860 if exist(FirstFileName,'file') || ~isempty(regexp(InputTable{LineIndex,1},'^http')) 2813 2861 ParamIn.Title='get_field: pick input variables and coordinates for series processing'; 2814 2862 ParamIn.SeriesInput=1; … … 3477 3525 drawnow 3478 3526 Param=read_GUI(handles.series); 3479 RootPath= Param.InputTable{1,1};3527 RootPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device); 3480 3528 if ~isfield(Param,'OutputSubDir') 3481 3529 msgbox_uvmat('ERROR','no standard sub-directory definition for output files, use a browser to check the output') … … 3895 3943 end 3896 3944 3945 3946 3947 3948 function OutputPath_Callback(hObject, eventdata, handles) 3949 % hObject handle to OutputPath (see GCBO) 3950 % eventdata reserved - to be defined in a future version of MATLAB 3951 % handles structure with handles and user data (see GUIDATA) 3952 3953 % Hints: get(hObject,'String') returns contents of OutputPath as text 3954 % str2double(get(hObject,'String')) returns contents of OutputPath as a doubl 3955 3956 3957 3958 function Experiment_Callback(hObject, eventdata, handles) 3959 % hObject handle to Experiment (see GCBO) 3960 % eventdata reserved - to be defined in a future version of MATLAB 3961 % handles structure with handles and user data (see GUIDATA) 3962 3963 % Hints: get(hObject,'String') returns contents of Experiment as text 3964 % str2double(get(hObject,'String')) returns contents of Experiment as a double 3965 3966 3967 function Device_Callback(hObject, eventdata, handles) 3968 % hObject handle to Device (see GCBO) 3969 % eventdata reserved - to be defined in a future version of MATLAB 3970 % handles structure with handles and user data (see GUIDATA) 3971 3972 3973 3974 % --- Executes on button press in OutputPathBrowse. 3975 function OutputPathBrowse_Callback(hObject, eventdata, handles) 3976 OutputPath=uigetdir(get(handles.OutputPath,'String')); 3977 set(handles.OutputPath,'String',OutputPath)
Note: See TracChangeset
for help on using the changeset viewer.