Changeset 351


Ignore:
Timestamp:
Dec 24, 2011, 11:50:22 AM (9 years ago)
Author:
sommeria
Message:

bug corrections to series, introduction of a button BATCH (still under progress)

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/series.m

    r350 r351  
    516516%     SeriesData.j2_series=[SeriesData.j2_series;{j2_series}];
    517517InputTable=get(handles.InputTable,'Data');
    518  InputTable=[{RootPath},{RootFile},{SubDir},{NomType},{FileExt};InputTable];
     518 InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt};InputTable];
    519519%     RootPathCell=[{RootPath}; InputTable{] ;
    520520%     SubDirCell=[{SubDir}; get(handles.SubDir,'String')];
     
    527527% or re-initialise the list of  input  file series   
    528528else
    529     InputTable=[{RootPath},{RootFile},{SubDir},{NomType},{FileExt}];
     529    InputTable=[{RootPath},{SubDir},{RootFile},{NomType},{FileExt}];
    530530end
    531531set(handles.InputTable,'Data',InputTable)
     
    11761176%% read input file parameters and set menus
    11771177Series.PathProject=get(handles.PathCampaign,'String');
    1178 RootPath=get(handles.RootPath,'String');% path of the root name of the first field series
    1179 RootFile=get(handles.RootFile,'String');% root name of the first field series
    1180 SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files
    1181 FileExt=get(handles.FileExt,'String');%file extension
     1178% InputTable=get(handles.InputTable,'Data');
     1179RootPath=Series.InputTable(:,1);
     1180SubDir=Series.InputTable(:,2);
     1181RootFile=Series.InputTable(:,3);
     1182NomType=Series.InputTable(:,4);
     1183FileExt=Series.InputTable(:,5);
     1184% RootPath=get(handles.RootPath,'String');% path of the root name of the first field series
     1185% RootFile=get(handles.RootFile,'String');% root name of the first field series
     1186% SubDir=get(handles.SubDir,'String');% subdirectory for netcdf files
     1187% FileExt=get(handles.FileExt,'String');%file extension
    11821188if isempty(SeriesData)
    11831189    msgbox_uvmat('ERROR','no input file series')
    11841190    return
    11851191end
    1186 NomType=SeriesData.NomType;
     1192% NomType=SeriesData.NomType;
    11871193if length(RootPath)==1 %string character input for user fct
    11881194    Series.RootPath=RootPath{1};
     
    12441250num_i=first_i:incr_i:last_i;
    12451251num_j=first_j:incr_j:last_j;
    1246 nbfield_cell=get(handles.num_MaxIndex_i,'String');
    1247 nbfield=[]; %default
    1248 for iview=1:length(nbfield_cell)
    1249     nb=str2num(nbfield_cell{iview});
    1250     if ~isempty(nb)
    1251         nbfield=[nbfield nb];
    1252     end
    1253 end
    1254 nbfield=min(nbfield);
    1255 nbfield2_cell=get(handles.num_MaxIndex_j,'String');
    1256 nbfield2=[]; %default
    1257 for iview=1:length(nbfield2_cell)
    1258     nb=str2num(nbfield2_cell{iview});
    1259     if ~isempty(nb)
    1260         nbfield2=[nbfield2 nb];
    1261     end
    1262 end
    1263 nbfield2=min(nbfield2);
     1252% nbfield_cell=get(handles.num_MaxIndex_i,'String');
     1253nbfield=cell2mat(Series.IndexRange.MaxIndex);
     1254nb=min(nbfield,1);
     1255nbfield=nb(1);
     1256nbfield2=nb(2);
     1257% nbfield2=cell2mat(Series.IndexRange.MaxIndex);
     1258% nbfield=min(nbfield);
     1259% % nbfield=[]; %default
     1260% % for iview=1:length(nbfield_cell)
     1261% %     nb=nbfield_cell{iview};
     1262% %     if ~isempty(nb)
     1263% %         nbfield=[nbfield nb];
     1264% %     end
     1265% % end
     1266% % nbfield=min(nbfield);
     1267% nbfield2_cell=get(handles.num_MaxIndex_j,'String');
     1268% nbfield2=[]; %default
     1269% for iview=1:length(nbfield2_cell)
     1270%     nb=str2num(nbfield2_cell{iview});
     1271%     if ~isempty(nb)
     1272%         nbfield2=[nbfield2 nb];
     1273%     end
     1274% end
     1275% nbfield2=min(nbfield2);
    12641276
    12651277%get complementary information from the 'series' interface
     
    13631375end
    13641376
    1365 % defining the ACTION function handle
     1377%% defining the ACTION function handle
    13661378path_series=which('series');
    13671379list_path=get(handles.ACTION,'UserData');
     
    13831395end
    13841396
    1385 % RUN ACTION
     1397%% RUN ACTION
    13861398Series.Action=action;%name of the processing programme
    13871399set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
     
    22662278if ~isempty(SeriesData)
    22672279for ilist=1:size(InputTable,1)
     2280    SeriesData.j1_series{ilist}
    22682281    if ~isempty(SeriesData.j1_series{ilist})
    22692282        state_j='on';
     
    25462559set(handles.series,'UserData',SeriesData)
    25472560if testpair
    2548     mode_Callback(hObject, eventdata, handles) 
     2561    mode_Callback([],[], handles) 
    25492562else
    25502563%     set(handles.NomType,'String',NomTypeCell)
     
    25572570end
    25582571
     2572
     2573% --- Executes on button press in BATCH.
     2574function BATCH_Callback(hObject, eventdata, handles)
     2575% hObject    handle to BATCH (see GCBO)
     2576% eventdata  reserved - to be defined in a future version of MATLAB
     2577% handles    structure with handles and user data (see GUIDATA)
     2578Series=read_GUI(handles.series);
     2579t=struct2xml(Series);
     2580save(t); %TODO: determine a xml file name
     2581
     2582% list_action=get(handles.ACTION,'String');% list menu action
     2583% index_action=get(handles.ACTION,'Value');% selected string index
     2584% action= list_action{index_action}; % selected string
     2585
     2586%% defining the ACTION function handle
     2587path_series=which('series');
     2588list_path=get(handles.ACTION,'UserData');
     2589index=get(handles.ACTION,'Value');
     2590fct_path=list_path{index}; %path stored for the function ACTION
     2591if ~isequal(fct_path,path_series)
     2592    eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION
     2593    if ~exist(fct_path,'dir')
     2594        msgbox_uvmat('ERROR',['The prescibed function path ' fct_path ' does not exist'])
     2595        return
     2596    end
     2597    if ~isequal(spath,fct_path)
     2598        addpath(fct_path)% add the prescribed path if not the current one
     2599    end
     2600end
     2601eval(['h_fun=@' action ';'])%create a function handle for ACTION
     2602if ~isequal(fct_path,path_series)
     2603        rmpath(fct_path)% add the prescribed path if not the current one   
     2604end
     2605
     2606h_fun('BATCH');% TODO modify the called function to read the xml file as input parameter
     2607
     2608
Note: See TracChangeset for help on using the changeset viewer.