function mapMB_2(lon,lat,z,bat_fill,eastl,westl,southl,northl)


%% % Specify the bathymetry filename
grd = '/Users/Mau/Documents/MBARIprojects/MB_bathymetry/GMRTv3_8_20210114topo.grd';
 
% Load in the bathymetry data
[mx,my,mz]=grdread2(grd);
mz=double(mz);

%% Define projection and lat/lon boundaries
lonmin=westl; lonmax=eastl;
latmin=southl;    latmax=northl;

% lonmin=-123; lonmax=-121.75;
% latmin=36;    latmax=37;

m_proj('lambert','lons',[lonmin lonmax],'lat',[latmin latmax]);
hold on

% to blank out data outside map range
lat(lat<latmin)=NaN; lat(lat>latmax)=NaN;
lon(lon<lonmin)=NaN; lon(lon>lonmax)=NaN;
z(lon<lonmin)=NaN; z(lon>lonmax)=NaN;

% % Plot gridded data
% [LON,indx]= sort(X,1);
% LAT=Y;
% VAR=Z(indx(:,1),:);
% 
% LON=padarray(LON,[2 2],'circular');
% LAT=padarray(LAT,[2 2],'circular');
% VAR=padarray(VAR,[2 2],'circular');
% 
% h=m_pcolor(LON,LAT,VAR);
% set(h,'linestyle','none');

% % Plot %profile by profile
% z=cbrewer('div','Spectral',length(lat));
% m_plot(lon,lat,'.','color',z,'markersize',0.5,'linestyle','none');
% 
% Grid and patch over land
m_grid('linestyle','none','tickdir','out','linewidth',2);
m_gshhs_h('patch',[.5 .5 .5]);

% Plot Bathymetry
if bat_fill==1
% % m_tbase('contourf',[-5000:100:500],'edgecolor','k'); %5' resolution, still too coarse
% % hAxesBAT = axes;
% [CS,CH]=m_etopo2('contourf',[-5000:100:0]);

[CS,CH]=m_contourf(mx,my,mz,1000,'edgecolor','none'); %,'edgecolor',[0.4 0.4 0.4], 'linewidth',1);
% cmap_bati=cmocean('topo','pivot',0); % to show topography over land
cmap_bati=flipud(cmocean('deep',52));
colormap(cmap_bati);
% axis(gca,'off')

hold on
zlevels=[-6000, -5000, -4000, -3000, -2000, -1000, -500, -400, -300, -200, -100, 0];
[CS,CH]=m_contour(mx,my,mz,zlevels,'edgecolor',[0.4 0.4 0.4], 'linewidth',1);
clabel(CS,CH,zlevels,'LabelSpacing',500,'color',[0.4 0.4 0.4])

% ax=m_contfbar; %(1,[.5 .8],CS,CH);
% title(ax,{'Level/m',''}); % Move up by inserting a blank line

elseif  bat_fill==0
zlevels=[-6000, -5000, -4000, -3000, -2000, -1000, -500, -400, -300, -200, -100, 0];

zlevels=[[-6000:1000:-1000],[-500, -400, -300, -200, -100],[-100:10:0]];
% [CS,CH]=m_etopo2('contour',zlevels,'edgecolor',[0.4 0.4 0.4],
% 'linewidth',1); %low res bati
[CS,CH]=m_contour(mx,my,mz,zlevels,'edgecolor',[0.4 0.4 0.4], 'linewidth',1);
clabel(CS,CH,zlevels,'LabelSpacing',500,'color',[0.4 0.4 0.4])

% high res bathymetry(60m res)
% [CS,CH]=m_contour(mx,my,mz,zlevels,'edgecolor',[0.4 0.4 0.4], 'linewidth',1);
% hold on
% Takes too long!
end

% Plot Mooring locations around MB
C1=[-121.85000000, 36.79600000];
M1=[-122.038, 36.75];
M2=[-122.37800000, 36.69700000];
TOPO1=[-121.99978870, 36.69368688]; % Astrid's Mooring site, has an upward looking ADCP
NDBC=[-122.33475000, 36.75116700];  % NDBC #46044
MARS=[-122.18681000, 36.71137000]; % MARS Main Node

TOPO1=[dm2degrees([-121 59.9239]), dm2degrees([36 41.599])]; % Astrid's Mooring site, has an upward looking ADCP, updated coordinates for deploy 4

% Waypoints navigation ~ Topo1
WP1_2=[-122.004759,36.704079];
WP2_1=[-121.995579, 36.699015];

WP1_2=[-122.004759,36.704079];
WP2_2=[-121.995579, 36.699015];

WP1_3=[-122.000001, 36.701589];
WP2_3=[-121.992360, 36.697213];

grey=[0.2 0.2 0.2];

% Plot and label mooring sites:
m_plot(C1(:,1),C1(:,2),'color','k','MarkerFaceColor','y',...
    'Marker','o','markersize',10);
m_text(C1(:,1),C1(:,2),' C1','vertical','top');

m_plot(TOPO1(:,1),TOPO1(:,2),'color','k','MarkerFaceColor','w',...
     'Marker','o','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
m_text(TOPO1(:,1),TOPO1(:,2),' TOPO1','vertical','top');

m_plot(M1(:,1),M1(:,2),'color','k','MarkerFaceColor','y',...
     'Marker','o','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
m_text(M1(:,1),M1(:,2),' M1','vertical','top'); 

% m_plot(WP1_2(:,1),WP1_2(:,2),'color','g','MarkerFaceColor','g',...
%      'Marker','*','markersize',15); %'linewidth',2)%3) %'-.','color','w','markersize',4);
% m_text(WP1_2(:,1),WP1_2(:,2),' WP1_2','color','g','vertical','top'); 
% 
% m_plot(WP2_2(:,1),WP2_1(:,2),'color','g','MarkerFaceColor','g',...
%      'Marker','*','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
% m_text(WP2_2(:,1),WP2_1(:,2),' WP2_2','color','g','vertical','top'); 
% 
% m_plot(WP1_3(:,1),WP1_2(:,2),'color','c','MarkerFaceColor','c',...
%      'Marker','*','markersize',15); %'linewidth',2)%3) %'-.','color','w','markersize',4);
% m_text(WP1_3(:,1),WP1_2(:,2),' WP1_3','color','c','vertical','top'); 
% 
% m_plot(WP2_3(:,1),WP2_1(:,2),'color','c','MarkerFaceColor','c',...
%      'Marker','*','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
% m_text(WP2_3(:,1),WP2_1(:,2),' WP2_3','color','c','vertical','top'); 

if M2(:,1)>westl
m_plot(M2(:,1),M2(:,2),'color','k','MarkerFaceColor','y',...
     'Marker','o','markersize',10)%3) %'-.','color','w','markersize',4);
m_text(M2(:,1),M2(:,2),' M2','vertical','top');
end
if NDBC(:,1)>westl
m_plot(NDBC(:,1),NDBC(:,2),'color','k','MarkerFaceColor','w',...
     'Marker','o','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
m_text(NDBC(:,1),NDBC(:,2),' NDBC','vertical','top');
end
if MARS(:,1)>westl
m_plot(MARS(:,1),MARS(:,2),'color','k','MarkerFaceColor',[0.4 0.4 0.4],...
     'Marker','o','markersize',10); %'linewidth',2)%3) %'-.','color','w','markersize',4);
m_text(MARS(:,1),MARS(:,2)+0.001,' MARS','vertical','top'); 
end

hold on

% Plot data
% m_scatter(lon,lat,100,z,'filled');

% h=m_pcolor(lon,lat,z);
% set(h,'linestyle','none');

% % Change colorbar
% % cmap=flipud(cbrewer('div','Spectral',length(lat)));
% % colormap(cmap);
% h=colorbar('vert','fontsize',16);%40); 
% set(get(h,'Title'),'String','Depth [m]','fontsize',20);
% % caxis([0 0.01])

% Change font
fontsize=18; %30; % 36; %
set(findall(gcf,'-property','FontSize'),'FontSize',fontsize)
set(findall(gcf,'-property','FontName'),'FontName','Helvetica')
set(findall(gcf,'-property','linewidth'),'linewidth',1); %2)
set(findall(gcf,'-property','markersize'),'linewidth',2); %4) 
