function mapross
%
%-------------------------------------------------------------------
%   Written by Vassilis Zervakis, in February 1996, while at
%              AINCO - Interocean, Madrid, Spain.
%-------------------------------------------------------------------
%
global mapfigure
global minlat minlon maxlat maxlon
global sizelon sizelat
global mapfigure
global colors isobaths
global X Y Umean Vmean
global DATAPATH FLOATS
%
%  Convert latitudes and longitudes in minutes -------
Ymax = fix(maxlat)*60. + (maxlat-round(maxlat))*0.6;
Ymin = fix(minlat)*60. + (minlat-round(minlat))*0.6;
Xmax = fix(maxlon)*60. + (maxlon-round(maxlon))*0.6;
Xmin = fix(minlon)*60. + (minlon-round(minlon))*0.6;
rows = (Ymax - Ymin)/sizelat;
cols = (Xmax - Xmin)/sizelon;
boxes = rows * cols;
%
%   read a lot of floats
%
% ------Load floats---------------------------
Ysize = 0.;
ans = 1;
numfloats = 0;
floatsread = [];
while ans == 1,
   [float, number, timer, temp, pres, lat, lon, u, v, www] = rfcread1;
%  Make sure this float has not already been read -------------
   flread = 0;
   k = 1;
   while (flread == 0) & (k <= numfloats),
      flread = strcmp( float, floatsread(k,:));
      k = k + 1;        
   end
%  if the float has not been previously read, -----------------
   if flread == 0,
     numfloats = numfloats + 1
     if floatsread == [],
        floatsread = float;
      else
        floatsread = str2mat(floatsread, float);
     end
     NN = length(lat);
     clear number;
     clear temp;
     clear pres;
     clear wwww;
%    --Check if float data within the space limits ------
     if (min(lat)>maxlat)|(max(lat)<minlat)|(min(lon)>maxlon)|(max(lon)<minlon),
%    --if float data outside the space limits ------
       mbox('OK','Data out of space limits',' Select other float ' )
       numfloats = numfloats - 1;
       [fm,fn] = size(floatsread);
%    --subtract this float from the floatsread matrix-----
       floatmatr = floatsread(1:fm-1,:);
       clear floatsread;
       floatsread = floatmatr;
       clear floatmatr;
       clear fm;
       clear fn;
       ans = 1;
      else,
       Ysize = max(Ysize,NN)
     end
     clear u;
     clear v;
     clear lon;
     clear lat;
     charans = mbox('YESNO','Include another float in the statistics? ' );
     ans = strcmp(charans, 'YES');
   else
     charans = mbox('YESNO','THIS FLOAT HAS ALREADY BEEN LOADED.',...
                            'Load another one ? ');
     ans = strcmp(charans, 'YES');
   end
end
% -----Initialize matrices
X = zeros(numfloats,Ysize + 1);
Y = zeros(numfloats,Ysize + 1);
dX = zeros(numfloats,Ysize + 1);
dY = zeros(numfloats,Ysize + 1);
%
if mapfigure == [],
   basemap(colors,isobaths);
 else
   figure(mapfigure);
end
hold on
global linecolor startcolor startsymbol stepcolor stepsymbol
linecolor = 'k';
startcolor = 'k';
stepcolor = 'k';
startsymbol = '+';
stepsymbol = 'o';
flstep = 0;
for numfl = 1:numfloats,
   filename = [floatsread(numfl,:)]
   [float, number, timer, temp, pres, lat, lon, u, v, www] = rfcload1(DATAPATH, filename);
%      ---Load the X, Y matrices with data from the floats -------
%    ---find the indeces of the matrixes X and Y that correspond to the 
%    ---geographical coordinates of the float -------------------------
   [ltemp,lpres, llat, llon, lu, lv, lwwww] = datalow('hanning',3);
   [DUDt, fU] = lefthandside(timer,llat,lu,lv);
   NN = length(lat);
   X(numfl,1:NN) = lon';
   Y(numfl,1:NN) = lat';
   RN  = DUDt ./ abs(fU);
   dX(numfl,1:NN-1) = real(RN)';
   dY(numfl,1:NN-1) = imag(RN)';
   floverl(llon, llat);
end
mapfigure;
hold on;
title('Rossby number vectors');
%
% ---generate and store the scale vector --------------------------
%
Deltax = maxlon - minlon;
Deltay = maxlat - minlat;
X(1, Ysize + 1) = minlon + Deltax/20.;
Y(1, Ysize + 1) = minlat + Deltay/20.;
dX(1, Ysize + 1) = 0.1;
dY(1, Ysize + 1) = 0.0;
quiver(X, Y, dX, dY, 100) ;
x0 = X(1, Ysize + 1);
y0 = Y(1, Ysize + 1) + Deltay/25;
text('Color','k',...
     'Position',[x0 y0],...
     'Fontsize',10,...
     'String','Ro # = 0.1');
text
%
