Index: /trunk/src/dir_uvmat.m
===================================================================
--- /trunk/src/dir_uvmat.m	(revision 1022)
+++ /trunk/src/dir_uvmat.m	(revision 1022)
@@ -0,0 +1,20 @@
+function [ ListFiles ] = dir_uvmat( DirName)
+if regexp(DirName,'^http://')
+    catalog=[DirName,'/catalog.xml'];
+    str=urlread(catalog);
+    ListFiles=(regexp(str,'xlink:title="(?<name>[^"]+)"','names'))';
+    NumDir=numel(ListFiles);
+    ListFiles=[ListFiles;(regexp(str,'dataset name="(?<name>[^"]+)"','names'))'];
+    for ilist=1:numel(ListFiles)
+        ListFiles(ilist).date=0;
+        ListFiles(ilist).bytes=0;
+        ListFiles(ilist).isdir=false;
+        ListFiles(ilist).datenum=0;
+    end
+    for ilist=1:NumDir
+        ListFiles(ilist).isdir=true;
+    end
+else
+    ListFiles=dir(DirName);
+end
+
Index: /trunk/src/fileparts_uvmat.m
===================================================================
--- /trunk/src/fileparts_uvmat.m	(revision 1021)
+++ /trunk/src/fileparts_uvmat.m	(revision 1022)
@@ -138,5 +138,5 @@
         RootFile=regexprep(RootFile,[r.num1 r.end_string '$'],'');
     else % case with separator '_'
-        r=regexp(RootFile,'\D(?<num1>\d+)_(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names');
+        r=regexp(RootFile,'\D*(?<num1>\d+)_(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names');
         if ~isempty(r)
             NomType=['_' get_type(r.end_string)];
Index: /trunk/src/find_file_series.m
===================================================================
--- /trunk/src/find_file_series.m	(revision 1021)
+++ /trunk/src/find_file_series.m	(revision 1022)
@@ -49,32 +49,19 @@
 
 %% get input root name and nomenclature type
+if isempty(regexp(FilePath,'^http://'))
 fullfileinput=fullfile(FilePath,fileinput);% input file name with path
+else
+  fullfileinput=[FilePath '/' fileinput];
+end
 [FileInfo,MovieObject]=get_file_info(fullfileinput);
 
 %% check for particular file types: images, movies, civ data
-%if isfield(FileInfo,'FileIndexing') && strcmp(FileInfo.FileIndexing,'on')
-    [RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
-    %     if ~isempty(regexp(SubDir,'^level\d+$')) && exist([RootPath '.xml'],'file')
-    %         NomType='level';
-    %     end
-    i1_series=zeros(1,1,1);
-    i2_series=zeros(1,1,1);
-    j1_series=zeros(1,1,1);
-    j2_series=zeros(1,1,1);
-    checkfileindexing=1;
-%else % no file indexing
-%     [PathDir,RootFile]=fileparts(fullfileinput);
-%     [RootPath,SubDir,DirExt]=fileparts(PathDir);
-%     SubDir=[SubDir DirExt];% include part after . in the name (considered as a file extension)
-%     NomType='*';
-%     i1_series=[];i2_series=[];j1_series=[];j2_series=[];
-%     i1_input=1;i2_input=[];j1_input=[];j2_input=[];
-%     if exist(fullfileinput,'file')~=2
-%         RootFile='';
-%         return
-%     end
-%     checkfileindexing=0;
-%end
-if ~exist(FilePath,'dir')
+[RootPath,SubDir,RootFile,i1_input,i2_input,j1_input,j2_input,FileExt,NomType]=fileparts_uvmat(fullfileinput);
+i1_series=zeros(1,1,1);
+i2_series=zeros(1,1,1);
+j1_series=zeros(1,1,1);
+j2_series=zeros(1,1,1);
+checkfileindexing=1;
+if isempty(regexp(FilePath,'^http://')) && ~exist(FilePath,'dir')
     return % don't go further if the dir path does not exist
 end
@@ -109,11 +96,4 @@
                         j1_input=[];
                         j2_input=[];
-                    elseif exist([RootPath '.xml'],'file')% new convention with j indices in sub-folders level0, 1...
-                        rj=regexp(SubDir,'^level(?<j1>\d+)$','names');
-                        if ~isempty(rj)
-                            j1_input=rj.j1;
-                            NomType='level';
-                            [RootPath,SubDir]=fileparts(RootPath);
-                        end
                     end
                 end
@@ -134,5 +114,5 @@
         %Look for cases with letter indexing for the second index
         r=regexp(NomType,'^(?<sep1>_?)(?<i1>\d+)(?<sep2>_?)(?<j1>[a|A])(?<j2>[b|B]?)$','names');
-        if ~isempty(r)
+        if ~isempty(r) %indexing image pair with letters
             sep1=r.sep1;
             sep2=r.sep2;
@@ -175,11 +155,19 @@
   
         detect_string=['^' RootFile sep1 i1_str i2_str sep2 j1_str j2_str FileExt '$'];%string used in regexp to detect file indices
+%         if isempty(regexp(FilePath,'^http://'))
         %find the string used to extract the relevant files with the command dir
-        star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
-        wd=pwd;%current working directory
-        cd (FilePath)% move to the local dir to save time in the operation dir.
-        dirpair=dir(star_string);% look for relevant files in the file directory
-        cd(wd)
-        nbpair=numel(dirpair);
+%         star_string=[RootFile sep1 i1_star i2_star sep2 j1_star j2_star FileExt];
+%         wd=pwd;%current working directory
+%         cd (FilePath)% move to the local dir to save time in the operation dir.
+%         dirpair=dir(star_string);% look for relevant files in the file directory
+%         cd(wd)
+%         else
+            ListStruct=dir_uvmat(FilePath);
+            ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
+            ListFiles=ListCells(1,:);%list of file names
+            rr=regexp(ListFiles,detect_string,'names');
+%         end
+%         nbpair=numel(dirpair);
+        nbpair=numel(rr);
         ref_i_list=zeros(1,nbpair);
         ref_j_list=zeros(1,nbpair);
@@ -189,10 +177,10 @@
         % scan the list of relevant files, extract the indices
         for ifile=1:nbpair
-            rr=regexp(dirpair(ifile).name,detect_string,'names');
-            if ~isempty(rr)
-                i1=str2num(rr.i1);
-                i2=str2num(regexprep(rr.i2,'^-',''));
-                j1=stra2num(regexprep(rr.j1,'^_',''));
-                j2=stra2num(regexprep(rr.j2,'^-',''));
+%             rr=regexp(dirpair(ifile).name,detect_string,'names');
+            if ~isempty(rr{ifile})
+                i1=str2num(rr{ifile}.i1);
+                i2=str2num(regexprep(rr{ifile}.i2,'^-',''));
+                j1=stra2num(regexprep(rr{ifile}.j1,'^_',''));
+                j2=stra2num(regexprep(rr{ifile}.j2,'^-',''));
                 ref_i=i1;
                 if isempty(i2_input)
@@ -263,9 +251,9 @@
         if ~isempty(ind_select)
             [tild,ifile_min]=min(ref_ij(ind_select));
-            [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(dirpair(ind_select(ifile_min)).name);% update the representation of indices (number of 0 before the number)
+            [tild,tild,tild,tild,tild,tild,tild,tild,NomType]=fileparts_uvmat(ListFiles{ind_select(ifile_min)});% update the representation of indices (number of 0 before the number)
             NomType=regexprep(NomType,['^' NomTypePref],'');
             %% update the file type if the input file does not exist (pb of 0001)
             if isempty(FileInfo.FileType)
-                [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,dirpair(ifile_min).name));
+                [FileInfo,MovieObject]=get_file_info(fullfile(FilePath,ListFiles(ifile_min)));
             end
         end
Index: /trunk/src/fullfile_uvmat.m
===================================================================
--- /trunk/src/fullfile_uvmat.m	(revision 1021)
+++ /trunk/src/fullfile_uvmat.m	(revision 1022)
@@ -93,7 +93,7 @@
 
 %% look for NomType with pairs (separator '-' or terminasion ab or AB
-if strcmp(NomType,'level')% organisation with a sub-folder for the files of each index i
-    filename=fullfile(RootPath,SubDir,['level' num2str(j1)],[RootFile num2str(i1) FileExt]);
-else
+% if strcmp(NomType,'level')% organisation with a sub-folder for the files of each index i
+%     filename=fullfile(RootPath,SubDir,['level' num2str(j1)],[RootFile num2str(i1) FileExt]);
+% else
     if ~isempty(regexp(NomType,'^_\d'))
         sep1='_';
@@ -136,8 +136,12 @@
         end
     end
+    if isempty(regexp(RootPath,'^http://'))
     filename=fullfile(RootPath,SubDir,RootFile);
+    else
+        filename=[RootPath '/' SubDir '/' RootFile];
+    end
     filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];
     filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension
-end
+% end
 
 function test
Index: /trunk/src/get_file_info.m
===================================================================
--- /trunk/src/get_file_info.m	(revision 1021)
+++ /trunk/src/get_file_info.m	(revision 1022)
@@ -38,5 +38,5 @@
 function [FileInfo,VideoObject]=get_file_info(fileinput)
 VideoObject=[];
-if exist(fileinput,'file')==2
+if ~isempty(regexp(fileinput,'^http://'))|| exist(fileinput,'file')
     FileInfo.FileName=fileinput;
     FileInfo.FileType='txt'; %default
Index: /trunk/src/nc2struct.m
===================================================================
--- /trunk/src/nc2struct.m	(revision 1021)
+++ /trunk/src/nc2struct.m	(revision 1022)
@@ -79,6 +79,11 @@
             end
         else
+            if regexp(nc,'^http://')
+                nc=netcdf.open(nc,'NC_NOWRITE');
+                testfile=1;
+            else
             errormsg=['ERROR:file ' nc ' does not exist'];
             return
+            end
         end
     else
Index: /trunk/src/read_field.m
===================================================================
--- /trunk/src/read_field.m	(revision 1021)
+++ /trunk/src/read_field.m	(revision 1022)
@@ -54,5 +54,5 @@
 ParamOut=ParamIn;%default
 errormsg='';
-if ~exist(FileName,'file')
+if isempty(regexp(FileName,'^http://'))&& ~exist(FileName,'file')
     errormsg=['input file ' FileName ' does not exist'];
     return
Index: /trunk/src/uigetfile_uvmat.m
===================================================================
--- /trunk/src/uigetfile_uvmat.m	(revision 1021)
+++ /trunk/src/uigetfile_uvmat.m	(revision 1022)
@@ -48,24 +48,29 @@
 InputFileName='';%default
 if ischar(InputName)
-    if exist(InputName,'dir')
-        InputDir=InputName;
-        InputFileName='';
-    elseif exist(InputName,'file')
-        [InputDir,InputFileName,Ext]=fileparts(InputName);
-        if isempty(InputFileName)% if InputName is already the root
-            InputFileName=InputDir;
-            if  ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems
-%                 InputDir=[InputDir '\'];% append '\' for a correct action of dir
-                InputFileName=[InputFileName '\'];
+    if isempty(regexp(InputName,'^http://'))%usual files
+        if exist(InputName,'dir')
+            InputDir=InputName;
+            InputFileName='';
+        elseif exist(InputName,'file')
+            [InputDir,InputFileName,Ext]=fileparts(InputName);
+            if isempty(InputFileName)% if InputName is already the root
+                InputFileName=InputDir;
+                if  ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems
+                    %                 InputDir=[InputDir '\'];% append '\' for a correct action of dir
+                    InputFileName=[InputFileName '\'];
+                end
+            end
+            if isdir(InputName)
+                InputFileName=['+/' InputFileName Ext];
             end
         end
-        if isdir(InputName)
-            InputFileName=['+/' InputFileName Ext];
+        if  ismember(computer,{'PCWIN','PCWIN64'})%case of Windows systems
+            InputDir=[InputDir '\'];% append '\' for a correct action of dir
         end
-    end
-end
-if  ismember(computer,{'PCWIN','PCWIN64'})%case of Windows systems
-      InputDir=[InputDir '\'];% append '\' for a correct action of dir
-end
+    else
+        [InputDir,InputFileName,Ext]=fileparts(InputName);
+    end
+end
+
 hfig=findobj(allchild(0),'tag',option);
 if isempty(hfig)
@@ -147,7 +152,4 @@
 htitlebox=findobj(hfig,'tag','titlebox');  % display the current dir name  
 DirName=get(htitlebox,'String');
-if isempty(regexp(DirName,'^http://'))% if the input dir is not a web site (begins by http://)
-%     FullSelectName=DirName;
-% else
 if ~strcmp(filter_ext,'uigetdir')% a file is expected as output, not a dir
     hlist=findobj(hfig,'Tag','list');
@@ -163,8 +165,12 @@
         SelectName=SelectName(1:ind_dot-1);
     end
-    FullSelectName=fullfile(DirName,SelectName);
-    % if regexp(DirName,'^http://')% if the input dir is a web site (begins by http://)
-
-    if exist(FullSelectName,'file')
+    if isempty(regexp(DirName,'^http://'))% if the input dir is not a web site (begins by http://)
+        FullSelectName=fullfile(DirName,SelectName);
+        check_exist=exist(FullSelectName,'file');
+    else
+        FullSelectName=[DirName '/' SelectName];
+        check_exist=1;
+    end
+    if check_exist
         switch option
             case 'browser'
@@ -185,9 +191,8 @@
     end
 end
-end
 set(hObject,'backgroundColor',[0 1 0])% indicate end button activation
 uiresume(get(hObject,'parent'))
 
-%------------------------------------------------------------------------   
+%------------------------------------------------------------------------
 % --- launched by refreshing the display figure
 function refresh_GUI(hObject,InputFileName,FilterExt)
@@ -209,5 +214,6 @@
 DirName=get(htitlebox,'String');
 hsort_option=findobj(hfig,'tag','sort_option');
-if strcmp(get(hfig,'Tag'),'status_display')
+% use with GUI series
+if strcmp(get(hfig,'Tag'),'status_display') % use with GUI series
     hseries=findobj(allchild(0),'tag','series');
     hstatus=findobj(hseries,'tag','status');
@@ -218,5 +224,5 @@
     end
     hlist=findobj(hfig,'tag','list');
-    testrecent=0;   
+    testrecent=0;
     NbOutputFile=[];
     if isfield(StatusData,'NbOutputFile')
@@ -226,5 +232,5 @@
     [ListFiles,NumFiles]=list_files(DirName,1,TimeStart);% list the directory content
     
-    %% update the waitbar
+    % update the waitbar
     hwaitbar=findobj(hfig,'tag','waitbar');
     if ~isempty(NbOutputFile)
@@ -233,5 +239,5 @@
         set(hwaitbar,'Position',BarPosition)
     end
-else
+else  %use as usual browser
     sort_option='name';
     if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2)
@@ -281,4 +287,5 @@
 htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
 DirName=get(htitlebox,'String');
+CheckSubDir=~isempty(regexp(list{index},'^\+'));
 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir
 ind_dot=regexp(SelectName,'\s*\.\.\.');%remove what is beyond  '...'
@@ -289,7 +296,11 @@
     FullSelectName=fileparts(DirName);
 else
-    FullSelectName=fullfile(DirName,SelectName);
-end
-if exist(FullSelectName,'dir')% a directory has been selected
+    if isempty(regexp(DirName,'^http://'))% usual files
+        FullSelectName=fullfile(DirName,SelectName);
+    else
+        FullSelectName=[DirName '/' SelectName];
+    end
+end
+if CheckSubDir%exist(FullSelectName,'dir')% a directory has been selected
     set(hObject,'BackgroundColor',[1 1 0])% paint list in yellow to indicate action
     drawnow
@@ -315,18 +326,18 @@
 function [ListFiles,NumFiles]=list_files(DirName,check_date,sort_option,filter_ext)
 %-------------------------------------------------------------------------
-ListStruct=dir(DirName);% get structure of the current directory
+ListStruct=dir_uvmat(DirName);% get structure of the current directory
 NumFiles=0; %default
 if numel(ListStruct)<1  % case of empty dir
-%     if regexp(DirName,'^http://')% if the input dir is a web site (begins by http://)
-%         web(DirName)
-%     else
     ListFiles={};
     return
-%     end
 end
 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray
 ListFiles=ListCells(1,:);%list of file names
 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files
+% for ilist=1:numel(check_dir)
+%     if check_dir(ilist)
 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display
+%     end
+% end
 if exist('filter_ext','var') && ~strcmp(filter_ext,'*') &&~strcmp(filter_ext,'uigetdir')
     if strcmp(filter_ext,'image')
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 1021)
+++ /trunk/src/uvmat.m	(revision 1022)
@@ -446,5 +446,9 @@
 function MenuBrowse_Callback(hObject, eventdata, handles)
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
+if isempty(regexp(RootPath,'^http://'))%usual files
 oldfile=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+else %Opendap
+    oldfile=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
+end
 if isempty(oldfile) %loads the previously stored file name and set it as default in the file_input box
     oldfile=get(handles.RootPath,'UserData');
@@ -452,5 +456,5 @@
 fileinput=uigetfile_uvmat('pick an input file',oldfile);
 hh=dir(fileinput);
-if numel(hh)>1fill_GUI
+if numel(hh)>1
     msgbox_uvmat('ERROR','invalid input, probably a broken link');
 else
@@ -1800,5 +1804,5 @@
 %% look for the input file existence
 errormsg='';%default
-if ~exist(fileinput,'file')
+if isempty(regexp(fileinput,'^http://')) && ~exist(fileinput,'file')
     errormsg=['input file ' fileinput  ' does not exist'];
     msgbox_uvmat('ERROR',errormsg)
@@ -1841,5 +1845,18 @@
 % detect the file type, get the movie object if relevant, and look for the corresponding file series:
 % the root name and indices may be corrected by including the first index i1 if a corresponding xml file exists
+% if isempty(regexp(fileinput,'^http://'))
 [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,NomType,FileInfo,MovieObject,i1,i2,j1,j2]=find_file_series(FilePath,[FileName FileExt]);
+% else
+%     FileInfo.FileType='netcdf';
+%     [RootPath,SubDir,RootFile,i1,i2,j1,j2,Ext,NomType]=fileparts_uvmat(fileinput);
+%     i1_series=[0 i1 i2];
+%     i2_series=[];
+%     j1_series=[0 j1 j1];
+%     j2_series=[0 j1 j1];
+%     MovieObject=[];
+% %     [RootPath,RootFile]=fileparts(fileinput);
+% %     [RootPath,SubDir]=fileparts(RootPath);
+% %     NomType='*';
+% end
 FileType=FileInfo.FileType;
 if strcmp(FileType,'txt')
@@ -1883,16 +1900,20 @@
         set(handles_SubDir,'String',['/' SubDir]);
         set(handles_RootFile,'String',['/' RootFile]); %display the separator
-        if strcmp(NomType,'level')
-            rootname=fullfile(RootPath,SubDir,'level');
-            rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
-            if ~isempty(rr)
-                set(handles_FileIndex,'String',rr.i);
-            end
-        else
+%         if strcmp(NomType,'level')
+%             rootname=fullfile(RootPath,SubDir,'level');
+%             rr=regexp(fileinput,['^' rootname '(?<j>\d+)/' RootFile '(?<i>\d+)' FileExt '$'],'names');
+%             if ~isempty(rr)
+%                 set(handles_FileIndex,'String',rr.i);
+%             end
+%         else
+            if isempty(regexp(RootPath,'^http://'))
             rootname=fullfile(RootPath,SubDir,RootFile);
+            else
+                rootname=[RootPath '/' SubDir '/' RootFile];
+            end
             indices=fileinput(length(rootname)+1:end);
             indices(end-length(FileExt)+1:end)=[]; %remove extension
             set(handles_FileIndex,'String',indices);
-        end
+%         end
         set(handles_NomType,'String',NomType);
         set(handles_FileExt,'String',FileExt);
@@ -3187,9 +3208,12 @@
 if isempty(i2), set(handles.i2,'String',''); end % suppress the second i index display if not used
 if isempty(j2), set(handles.j2,'String',''); end % suppress the second j index display if not used
-if strcmp(get(handles.NomType,'String'),'level')
-    jindex=str2num(get(handles.j1,'String'));
-    filename=[fullfile(RootPath,SubDir,['level' num2str(jindex)],RootFile) FileIndex FileExt];% build the input file name (first line)
-else
+% if strcmp(get(handles.NomType,'String'),'level')
+%     jindex=str2num(get(handles.j1,'String'));
+%     filename=[fullfile(RootPath,SubDir,['level' num2str(jindex)],RootFile) FileIndex FileExt];% build the input file name (first line)
+% else
+if isempty(regexp(RootPath,'^http://'))
 filename=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];% build the input file name (first line)
+else
+    filename=[RootPath '/' SubDir '/' RootFile FileIndex FileExt];%
 end
 filename_1='';%default second file name
@@ -3247,5 +3271,5 @@
 
 %% determine the main input file information for action
-if ~exist(FileName,'file')
+if isempty(regexp(FileName,'^http://')) &&~exist(FileName,'file')
     errormsg=['input file ' FileName ' does not exist'];
     return
@@ -4340,5 +4364,9 @@
 field= list_fields{index_fields(1)}; % selected string
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
+if isempty(regexp(RootPath,'^http://'))
 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+else
+    FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
+end
 [tild,tild,tild,i1,i2,j1,j2,tild,NomType]=fileparts_uvmat(['xxx' get(handles.FileIndex,'String') FileExt]);
 
@@ -4385,5 +4413,9 @@
         %read selection from get_field
         [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
+        if isempty(regexp(RootPath,'^http://'))
         FileName=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
+        else
+            FileName=[RootPath '/' SubDir '/' RootFile FileIndices FileExt];
+        end
         GetFieldData=get_field(FileName,ParamIn);% inport field names from the GUI get_field
         FieldList={};
