Changeset 1090 for trunk/src/series.m


Ignore:
Timestamp:
Jan 21, 2021, 3:59:54 PM (4 years ago)
Author:
sommeria
Message:

system of mirror output path introduced, and series/sliding_average added

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r1085 r1090  
    706706   
    707707%% get the input root name, indices, file extension and nomenclature NomType
    708 if ~exist(fileinput,'file')
     708if isempty(regexp(fileinput,'^http')) && ~exist(fileinput,'file')
    709709    errormsg=['input file ' fileinput  ' does not exist'];
    710710    msgbox_uvmat('ERROR',errormsg)
     
    16011601    Param.IndexRange.NbSlice=[];
    16021602end
     1603OutputPath=get(handles.OutputPath,'String');
    16031604
    16041605%% Look for processing on multiple experiments set by the GUI browse_data
     
    16241625        for iexp=1:numel(ListExp)
    16251626            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 series
     1627                if strcmp(get(BrowseData.DataSeries,'enable'),'off') %case of a multiple input line for series
    16271628                    NbExp=NbExp+1;
    16281629                    ExpIndex{NbExp}=iexp;
     
    16301631                        lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
    16311632                            regexprep(ListDevices{idevice},'^\+/',''));
     1633                        lpathout=fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),...
     1634                            regexprep(ListDevices{idevice},'^\+/',''));
    16321635                        ldir=regexprep(ListDataSeries{idevice},'^\+/','');
    16331636                        ListPath{idevice,NbExp}=lpath;
     1637                        ListPathOut{idevice,NbExp}=lpathout;
    16341638                        ListSubdir{idevice,NbExp}=ldir;
    16351639                    end
     
    16411645                                    lpath= fullfile(SourceDir,regexprep(ListExp{iexp},'^\+/',''),...
    16421646                                        regexprep(ListDevices{idevice},'^\+/',''));
     1647                                    lpathout= fullfile(OutputPath,regexprep(ListExp{iexp},'^\+/',''),...
     1648                                        regexprep(ListDevices{idevice},'^\+/',''));
    16431649                                    ldir= regexprep(ListDataSeries{isubdir},'^\+/','');
    16441650                                    if exist(fullfile(lpath,ldir),'dir')
     
    16461652                                        ExpIndex{NbExp}=iexp;
    16471653                                        ListPath{NbExp}=lpath;
     1654                                        ListPathOut{NbExp}=lpathout;
    16481655                                        ListSubdir{NbExp}=ldir;
    16491656                                    end
     
    16611668    end
    16621669end
    1663 %      set(handles.OutputSubDir,'String',SubDir)
    1664 %      Param.OutputSubDir=SubDir;
     1670
    16651671%%%%%%%%%%%%%%%%%%% LOOP ON EXPERIMENTS POSSIBLY SET BY THE GUI browse_data, NbExp=1 otherwise %%%%%%%%%
     1672
    16661673for iexp=1:NbExp
    16671674    if get(handles.Replicate,'Value')
     
    16891696    answer='';
    16901697    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
    16911719        SubDirOut=[Param.OutputSubDir Param.OutputDirExt];
    16921720        SubDirOutNew=SubDirOut;
    1693         detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if  the dir  already exist
     1721        detect=exist(fullfile(PathExpDeviceOut,SubDirOutNew),'dir'); % test if  the dir  already exist
    16941722        check_create=1; % need to create the result directory by default
    16951723        CheckOverwrite=1;
    16961724        if isfield(Param,'CheckOverwrite')
    1697             CheckOverwrite=Param.CheckOverwrite;
     1725            CheckOverwrite=Param.CheckOverwrite;% will overwrite previous data if it is equal to 1
    16981726        end
    16991727        while detect
     
    17031731                comment=', will complement existing result files (no overwriting)';
    17041732            end
    1705             answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(Param.InputTable{1,1},SubDirOutNew) comment]);
     1733            answer=msgbox_uvmat('INPUT_Y-N-Cancel',['use existing ouput directory: ' fullfile(PathExpDeviceOut,SubDirOutNew) comment]);
    17061734            if strcmp(answer,'Cancel')
    17071735                break
     
    17161744                end
    17171745                SubDirOutNew=[r(1).root num2str(str2num(r(1).num1)+1)]; % increment the index by 1 or put 1
    1718                 detect=exist(fullfile(Param.InputTable{1,1},SubDirOutNew),'dir'); % test if  the dir  already exists
     1746                detect=exist(fullfile(PathExpDeviceOut,SubDirOutNew),'dir'); % test if  the dir  already exists
    17191747                check_create=1;
    17201748            end
     
    17251753        Param.OutputDirExt=regexprep(SubDirOutNew,['^' Param.OutputSubDir],'');
    17261754        Param.OutputRootFile=Param.InputTable{1,3}; % the first sorted RootFile taken for output
    1727         OutputDir=fullfile(Param.InputTable{1,1},[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
     1755        OutputDir=fullfile(PathExpDeviceOut,[Param.OutputSubDir Param.OutputDirExt]); % full name (with path) of output directory
    17281756        if check_create    % create output directory if it does not exist
    17291757            [tild,msg1]=mkdir(OutputDir);
     
    24452473    FieldList=set_field_list('U','V'); % standard menu for civx data
    24462474    if max(get(handles.FieldName,'Value'))>numel(FieldList)
    2447     set(handles.FieldName,'Value',1); % velocity vector choice by default
     2475        set(handles.FieldName,'Value',1); % velocity vector choice by default
    24482476    end
    24492477    if  VelTypeRequest_1 && numel(iview_civ)>=2
     
    25002528    set(handles_coord,'Visible','on')
    25012529    if isempty(find(strcmp('add_field...',FieldList)))
    2502     FieldList=[FieldList;{'add_field...'}];%add 'add_field...' to the menu FieldName if it is not already
     2530        FieldList=[FieldList;{'add_field...'}];%add 'add_field...' to the menu FieldName if it is not already
    25032531    end
    25042532    if FieldNameRequest_1 && numel(iview_netcdf)>=2
     
    25642592    set(handles.MinIndex_j,'Data',MinIndex_j(iview,:));
    25652593    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,:));
    25672595    TimeTable=get(handles.TimeTable,'Data');
    25682596    if size(TimeTable,1)<size(Param.InputTable,1)%if the time table is not complete, copy the missing lines from the previous ones
     
    26532681end
    26542682set(handles.FieldTransform,'Visible',FieldTransformVisible)
    2655 if isfield(ParamOut,'TransformPath');% record the path of transform function requested for compilation
     2683if isfield(ParamOut,'TransformPath')% record the path of transform function requested for compilation
    26562684    set(handles.TransformPath,'UserData',ParamOut.TransformPath)
    26572685else
     
    26842712end
    26852713
    2686 %% definition of the directory containing the output files
     2714%% definition of the path for the output files
     2715InputTable=get(handles.InputTable,'Data');
     2716[OutputPath,Device,DeviceExt]=fileparts(InputTable{1,1});
     2717[OutputPath,Experiment,ExperimentExt]=fileparts(OutputPath);
     2718set(handles.Device,'String',[Device DeviceExt])
     2719set(handles.Device,'Visible','on')
     2720set(handles.Device_title,'Visible','on')
     2721set(handles.Experiment,'String',[Experiment ExperimentExt])
     2722set(handles.Experiment,'Visible','on')
     2723set(handles.Experiment_title,'Visible','on')
     2724OutputPathOld=get(handles.OutputPath,'String')
     2725if 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)
     2730end
     2731set(handles.Experiment_title,'Visible','on')
     2732set(handles.OutputPath,'Visible','on')
     2733set(handles.OutputPathBrowse,'Visible','on')
     2734   
     2735%% definition of the subdirectory containing the output files
     2736
    26872737if  ~(isfield(SeriesData,'ActionName') && strcmp(ActionName,SeriesData.ActionName))
    26882738    OutputDirExt='.series'; % default
     
    26982748    OutputSubDirMode=ParamOut.OutputSubDirMode;
    26992749end
    2700 InputTable=get(handles.InputTable,'Data');
    27012750switch OutputSubDirMode
    2702     case 'auto'; % default
     2751    case 'auto' % default
    27032752        OutputDirVisible='on';
    27042753        SubDir=InputTable(1:end,2); % set of subdirectories
     
    27272776set(handles.OutputDirExt,'Visible',OutputDirVisible)
    27282777set(handles.OutputSubDir,'Visible',OutputDirVisible)
    2729 %set(handles.CheckOverwrite,'Visible',OutputDirVisible)
    27302778set(handles.OutputDir_title,'Visible',OutputDirVisible)
    27312779SeriesData.ActionName=ActionName; % record ActionName for next use
     
    28102858    FirstFileName=fullfile_uvmat(InputTable{LineIndex,1},InputTable{LineIndex,2},InputTable{LineIndex,3},...
    28112859        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'))
    28132861        ParamIn.Title='get_field: pick input variables and coordinates for series processing';
    28142862        ParamIn.SeriesInput=1;
     
    34773525    drawnow
    34783526    Param=read_GUI(handles.series);
    3479     RootPath=Param.InputTable{1,1};
     3527    RootPath=fullfile(Param.OutputPath,Param.Experiment,Param.Device);
    34803528    if ~isfield(Param,'OutputSubDir')   
    34813529        msgbox_uvmat('ERROR','no standard sub-directory definition for output files, use a browser to check the output')
     
    38953943end
    38963944
     3945
     3946
     3947
     3948function 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
     3958function 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
     3967function 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.
     3975function OutputPathBrowse_Callback(hObject, eventdata, handles)
     3976OutputPath=uigetdir(get(handles.OutputPath,'String'));
     3977set(handles.OutputPath,'String',OutputPath)
Note: See TracChangeset for help on using the changeset viewer.