function sphcolorcontjet(varargin)

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


if nargchk(4, 6, nargin);
  error('Check input arguments - must have between four and six')
end

%set default figure number
num=1;

%  Get inputs
field1 = varargin{1};
field2 = varargin{2};
lat = varargin{3};
lon = varargin{4};
num = varargin{5};
% if nargin == 6
%     domain = varargin{6};
% else
%     domain = 'something'
% end



%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

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

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

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



LAT=lat;
load coast
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

axesm('robinson','MapLatLimit',[min(LAT) max(LAT)],'MapLonLimit',[min(lon)-10 max(lon)+10], 'Origin', 0, 'FLatLimit',[min(LAT)-5 max(LAT)+5], 'FLonLimit',[min(lon)-10 max(lon)+10],'ScaleFactor',1.5) %Atlantic?
%axesm('robinson','MapLatLimit',[min(LAT) max(LAT)],'MapLonLimit',[max(lon) min(lon)], 'Origin', mean(lon), 'FLatLimit',[min(LAT)-5 max(LAT)+5], 'FLonLimit',[max(lon) min(lon)],'ScaleFactor',1.5) %atlantic domain used with lon2
%axesm('robinson','MapLatLimit',[min(LAT) max(LAT)], 'Origin', 180, 'FLatLimit',[min(LAT)-5 max(LAT)+5],'ScaleFactor',1.5) %most universal
%axesm('robinson')


framem; plotm(lat,long, 'k');
Lat=lat;
lat=LAT; clear LAT


[LON,LAT]=meshgrid(lon,lat);
hold on;
%color_trans; colormap(cmap);
colormap('jet')
caxis([min(min(field1)) max(max(field1))]);
%caxis([-max(max(abs(field1))) max(max(abs(field1)))])
pcolorm(LAT, LON, field1)
colorbar;
hold on
[c,h]=contourm(LAT, LON, field2, 'r');
ht = clabelm(c,h); set(ht,'color','r')
hidem(gca)

hold on;framem; plotm(Lat,long, 'k');
tightmap
