function sphcont(varargin)

%sphcolorcont(variable1,lat,lon)
%sphcolorcont(variable1,lat,lon, num)
%sphcolorcont(variable1,lat,lon, num, atl)


if nargchk(3, 5, nargin);
  error('Check input arguments - must have between three and five')
end

num=1;

%  Get inputs
field1 = varargin{1};
lat = varargin{2};
lon = varargin{3};
num = varargin{4};
domain = varargin{5};

%plots spherical data on a robinson projection with continents

if max(lon)<=4
    error('input longitude should be in degrees')
end

if max(abs(lat))>90
    error('input order is wrong - input latitude vector before longitude vector')
end

field1=squeeze(field1);
a=size(field1);
NN=a(1,1); N=a(1,2);

if length(lat)<NN | length(lat)>NN
    error('field1 size and latitude input must be same size')
end

if length(lon)<N | length(lon)>N
    error(' field1 size and longitude input must be same size')
end


load topo
figure(num); clf;
if domain == 'atl'
    axesm('robinson','MapLatLimit',[min(lat) max(lat)],'MapLonLimit',[min(lon) max(lon)], 'Origin', 0)
else
    axesm('robinson','MapLatLimit',[min(lat) max(lat)],'MapLonLimit',[min(lon) max(lon)])
   
end





contourm(topo,  topolegend, 'k'); 

% Add the topograpy surface and color map.
geoshow(topo, topolegend, 'DisplayType', 'surface')
colormap(demcmap(topo))




[LON,LAT]=meshgrid(lon,lat);
hold on
[c,h]=contourm(LAT, LON, field1, 'r');
ht = clabelm(c,h); set(ht,'color','r')
%hidem(gca)
tightmap2
%fill_landmap('over', 0.5*[1 1 1]); %makes land surface grey

