Changeset 1022 for trunk/src/uvmat.m


Ignore:
Timestamp:
Dec 11, 2017, 1:15:03 AM (7 years ago)
Author:
sommeria
Message:

opendap reading intreoduced

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r1010 r1022  
    446446function MenuBrowse_Callback(hObject, eventdata, handles)
    447447[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     448if isempty(regexp(RootPath,'^http://'))%usual files
    448449oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     450else %Opendap
     451    oldfile=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
     452end
    449453if isempty(oldfile) %loads the previously stored file name and set it as default in the file_input box
    450454    oldfile=get(handles.RootPath,'UserData');
     
    452456fileinput=uigetfile_uvmat('pick an input file',oldfile);
    453457hh=dir(fileinput);
    454 if numel(hh)>1fill_GUI
     458if numel(hh)>1
    455459    msgbox_uvmat('ERROR','invalid input, probably a broken link');
    456460else
     
    18001804%% look for the input file existence
    18011805errormsg='';%default
    1802 if ~exist(fileinput,'file')
     1806if isempty(regexp(fileinput,'^http://')) && ~exist(fileinput,'file')
    18031807    errormsg=['input file ' fileinput  ' does not exist'];
    18041808    msgbox_uvmat('ERROR',errormsg)
     
    18411845% detect the file type, get the movie object if relevant, and look for the corresponding file series:
    18421846% the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
     1847% if isempty(regexp(fileinput,'^http://'))
    18431848[RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
     1849% else
     1850%     FileInfo.FileType='netcdf';
     1851%     [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(fileinput);
     1852%     i1_series=[0 i1 i2];
     1853%     i2_series=[];
     1854%     j1_series=[0 j1 j1];
     1855%     j2_series=[0 j1 j1];
     1856%     MovieObject=[];
     1857% %     [RootPath,RootFile]=fileparts(fileinput);
     1858% %     [RootPath,SubDir]=fileparts(RootPath);
     1859% %     NomType='*';
     1860% end
    18441861FileType=FileInfo.FileType;
    18451862if strcmp(FileType,'txt')
     
    18831900        set(handles_SubDir,'String',['/' SubDir]);
    18841901        set(handles_RootFile,'String',['/' RootFile]); %display the separator
    1885         if strcmp(NomType,'level')
    1886             rootname=fullfile(RootPath,SubDir,'level');
    1887             rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
    1888             if ~isempty(rr)
    1889                 set(handles_FileIndex,'String',rr.i);
    1890             end
    1891         else
     1902%         if strcmp(NomType,'level')
     1903%             rootname=fullfile(RootPath,SubDir,'level');
     1904%             rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
     1905%             if ~isempty(rr)
     1906%                 set(handles_FileIndex,'String',rr.i);
     1907%             end
     1908%         else
     1909            if isempty(regexp(RootPath,'^http://'))
    18921910            rootname=fullfile(RootPath,SubDir,RootFile);
     1911            else
     1912                rootname=[RootPath '/' SubDir '/' RootFile];
     1913            end
    18931914            indices=fileinput(length(rootname)+1:end);
    18941915            indices(end-length(FileExt)+1:end)=[]; %remove extension
    18951916            set(handles_FileIndex,'String',indices);
    1896         end
     1917%         end
    18971918        set(handles_NomType,'String',NomType);
    18981919        set(handles_FileExt,'String',FileExt);
     
    31873208if isempty(i2), set(handles.i2,'String',''); end % suppress the second i index display if not used
    31883209if isempty(j2), set(handles.j2,'String',''); end % suppress the second j index display if not used
    3189 if strcmp(get(handles.NomType,'String'),'level')
    3190     jindex=str2num(get(handles.j1,'String'));
    3191     filename=[fullfile(RootPath,SubDir,['level' num2str(jindex)],RootFile) FileIndex FileExt];% build the input file name (first line)
    3192 else
     3210% if strcmp(get(handles.NomType,'String'),'level')
     3211%     jindex=str2num(get(handles.j1,'String'));
     3212%     filename=[fullfile(RootPath,SubDir,['level' num2str(jindex)],RootFile) FileIndex FileExt];% build the input file name (first line)
     3213% else
     3214if isempty(regexp(RootPath,'^http://'))
    31933215filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
     3216else
     3217    filename=[RootPath '/' SubDir '/' RootFile FileIndex FileExt];%
    31943218end
    31953219filename_1='';%default second file name
     
    32473271
    32483272%% determine the main input file information for action
    3249 if ~exist(FileName,'file')
     3273if isempty(regexp(FileName,'^http://')) &&~exist(FileName,'file')
    32503274    errormsg=['input file ' FileName ' does not exist'];
    32513275    return
     
    43404364field= list_fields{index_fields(1)}; % selected string
    43414365[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     4366if isempty(regexp(RootPath,'^http://'))
    43424367FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     4368else
     4369    FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
     4370end
    43434371[tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
    43444372
     
    43854413        %read selection from get_field
    43864414        [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     4415        if isempty(regexp(RootPath,'^http://'))
    43874416        FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
     4417        else
     4418            FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
     4419        end
    43884420        GetFieldData=get_field(FileName,ParamIn);% inport field names from the GUI get_field
    43894421        FieldList={};
Note: See TracChangeset for help on using the changeset viewer.