function statinter
%
% the function statinter is used by the ARPRO
% software as an interface used to input the desired map limits
% and the desired characteristics on the kind of statistics to be
% applied to the float data.
%
%  Also, it allows the setting of the float tail's length (in days...)
%  
% -------------------------------------------------------------
%        Written by Vassilis Zervakis, in February 1996,
%             for AINCO - Interocean, Madrid, Spain
%--------------------------------------------------------------
%
%               Modified by Mike Sparrow, Jan 97.
%                                       & Jan 98
%--------------------------------------------------------------
%
global minlon minlat maxlon maxlat mapset
global colors isobaths
global col1 iso1
global sizelon sizelat
global sizevect
%
if mapset == [],
 minlat = 0;
 maxlat = 0;
 minlon = 0;
 maxlon = 0;
end
h1 = figure('Name','Selecting Statistical Analysis',...
            'NumberTitle','off',...
            'Menubar','none',...
            'Units','normalized',...
            'Position',[0.05 0.1 0.9 0.8],...
            'Color',[0.45 0.45 0.45]);
pos = [ .1, .69, .20, .05 ]; 
uimm(1) = uicontrol('style','text',...
                    'string','Minimum Latitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(2) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(minlat),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global minlat,',...
                    'minlat = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .4, .69, .20, .05 ];
uimm(3) = uicontrol('style','text',...
                    'string','Maximum Latitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(4) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(maxlat),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global maxlat,',...
                    'maxlat = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .1, .60, .20, .05 ];
uimm(5) = uicontrol('style','text',...
                    'string','Minimum Longitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(6) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(minlon),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global minlon,',...
                    'minlon = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [ .4, .60, .20, .05 ];
uimm(7) = uicontrol('style','text',...
                    'string','Maximum Longitude',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(8) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(maxlon),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global maxlon,',...
                    'maxlon = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.08,pos(4)]);
pos = [0.71,0.75,0.1,0.05];
uimm(50) = uicontrol('style','pushbutton',...
                     'string','NE.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = 20,',...
                                 'maxlat = 50,',...
                                 'minlon = -30,',...
                                 'maxlon = 0,',...
                                 'mapset = 1,',...
                                 'statint'],...
                     'Position',pos);
pos = [0.73,0.68,0.1,0.05];
uimm(51) = uicontrol('style','pushbutton',...
                     'string','NW.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = 0,',...
                                 'maxlat = 60,',...
                                 'minlon = -100,',...
                                 'maxlon = -30,',...
                                 'mapset = 1,',...
                                 'statint'],...
                     'Position',pos);
pos = [0.75,0.61,0.1,0.05];
uimm(52) = uicontrol('style','pushbutton',...
                     'string','S.Atlantic',...
                     'units','normalized',...
                     'Callback',['minlat = -60,',...
                                 'maxlat = 0,',...
                                 'minlon = -70,',...
                                 'maxlon = 20,',...
                                 'mapset = 1,',...
                                 'statint'],...
                     'Position',pos);
pos = [0.77,0.54,0.1,0.05];
uimm(53) = uicontrol('style','pushbutton',...
                     'string','Mediterr.',...
                     'units','normalized',...
                     'Callback',['minlat = 30,',...
                                 'maxlat = 50,',...
                                 'minlon = -10,',...
                                 'maxlon = 40,',...
                                 'mapset = 1,',...
                                 'statint'],...
                     'Position',pos);

%
% ---- Determine the size of the longitude grid for statistics-------
pos = [ .1, .35, .3, .04 ];
uimm(9) = uicontrol('style','text',...
                    'string',' Longitudinal size of grid: ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the sizelon -----------------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.05;
sizelon = 120.;
uimm(10) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(sizelon),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global sizelon,',...
                    'sizelon = str2num(get(gco,''string''))'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.3;
uimm(11) = uicontrol('style','text',...
                    'string',' minutes of degree',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ---- Determine the size of the latitude grid for statistics-------
pos = [ .1, .40, .3, .04 ];
uimm(12) = uicontrol('style','text',...
                    'string',' Latitudinal size of grid: ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the sizelat -----------------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.05;
sizelat = 120.;
uimm(13) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(sizelat),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global sizelat,',...
                    'sizelat = str2num(get(gco,''string''))'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.3;
uimm(14) = uicontrol('style','text',...
                    'string',' minutes of degree',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ---- Determine what kind of map I want----------------------------
pos = [ .1, .25, .2, .04 ];
uimm(15) = uicontrol('style','text',...
                    'string',' The map should be : ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine the colors -----------------------------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.2;
global colors;
colors = 'yes';
uimm(16) = uicontrol('style','popup',...
                    'string','colored|Black and white',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global colors,',...
                    'colors = setmapco(get(gco,''Value''))'],...
                    'Units','normalized',...
                    'Position',pos);
% ----Determine whether there will be isobaths----------------------
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
global isobaths;
isobaths = 'yes';
uimm(17) = uicontrol('style','popup',...
                    'string','with|without',...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global isobaths,',...
                    'isobaths = setmapis(get(gco,''Value''))'],...
                    'Units','normalized',...
                    'Position',pos);
pos(1) = pos(1) + pos(3);
pos(3) = 0.1;
uimm(18) = uicontrol('style','text',...
                    'string',' isobaths ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
% -- Determine the size of the label vector -----------------
sizevect = 10;
pos = [ .1, .78, .35, .05 ];
uimm(19) = uicontrol('style','text',...
                    'string','Size of velocity vector : ',...
                    'enable','off',...
                    'horizontalalignment','left',...
                    'backgroundcolor',[1 1 1],...
                    'Units','normalized',...
                    'Position',pos);
uimm(20) = uicontrol('style','edit',...
                    'enable','on',...
                    'string',num2str(sizevect),...
                    'BackgroundColor',[.75 .75 .75],...
                    'Callback',['global sizevect,',...
                    'sizevect = str2num(get(gco,''string''));'],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3),pos(2),.04,pos(4)]);
uimm(21) = uicontrol('style','text',...
                    'enable','off',...
                    'string',' cm /sec',...
                    'BackgroundColor',[1 1 1],...
                    'Units','normalized',...
                    'Position',[pos(1)+pos(3)+0.04,pos(2),.08,pos(4)]);
%
%----------READY TO PLOT ...------------------------------
%
pos = [ 0.2, 0.05, 0.2, 0.05 ];
uimm(22) = uicontrol('style','pushbutton',...
                    'string','Statistics',...
                    'Units','normalized',...
                    'Position',pos,...
                    'Callback',['global isobathy isolines,',...
                                'if isolines ~= [],',...
                                '    isobath2,',...
                                'end,',...
                                'mapstat']);
pos = [ 0.6, 0.05, 0.2, 0.05 ];
uimm(22) = uicontrol('style','pushbutton',...
                    'string','Quit',...
                    'Units','normalized',...
                    'Position',pos,...
                    'Callback','close');
if isobaths == 'yes',
   global isolines
   setisoba;
end



