% --------------------------------------------------------
%  njshelf_chart_dotted
%
%    only plotting moorings that have been deployed.
%    Uses sw06 mooring spreadsheet
%
%
%    This only plots positions with dots
%
% ---------------------------------------------------------

% user defined area  0-no/1-yes --------------

contour_bathym    = 0;            % takes some time, not recommended
plot_acoustics    = 1;            % plots acoustics moorings and some misc
plot_po           = 1;
plot_legend       = 0;            % not for this one, numbering only
include_misc      = 0;            % include moorings other people are deploying
lines_of_death    = 0;
plot_mohsen       = 0;

figs = [ 1         % 1 = all moorings
   %      2         % 2 = cluster
    %      3         % 3 = on shelf area
    %    4         % 4 = off shelf area
    %     5         % 5 = along shelf area
    %     6         % 6 = larger area including all moorings
       ]';         % use ' to make it a single row, otherwise error in looping...

% ltcol = [.85 .85 .85];    % color for not deployed, too light for printing, screen ok
ltcol = [.5 .5 .5];   %  may be better... not for numbering
% -------------------------------------------
 
% loop through desired figures
for ifig = figs,           
    
 % specify corners of plot
 switch  ifig
   case 1,
     lat = [ 38+54/60 39+20/60 ];
          % lat = [ 38+53/60 39+24/60 ];      % little larger for badiey sites
     lon = [ -(73+25/60) -(72+45/60) ];
          % lon = [ -(73+25/60) -(72+40/60) ];
     stitle = 'SW06 Mooring Locations';
    case 2,
     lat = [ 39+0/60 39+5/60 ];
     lon = [ -(73+6/60) -(73+0/60) ];
     stitle = 'SW06 - Cluster Area';
    case 3,
     lat = [ 39+0/60 39+12/60 ];
     lon = [ -(73+24/60) -(73+4/60) ];
     stitle = 'SW06 - onshore area';
    case 4, 
     lat = [ 38+54/60 39+1/60 ];
     lon = [ -(73+1/60) -(72+48/60) ];
     stitle = 'SW06 - offshore area';
    case 5,
     lat = [ 39+6/60 39+16/60 ];
     lon = [ -(73+2/60) -(72+51/60) ];      
     stitle = 'SW06 - along shore area';
   case 6,
     lat = [ 38+30/60 39+40/60 ];
     lon = [ -(74+0/60) -(72+30/60) ];      
     stitle = 'SW06';
   otherwise
     figs
     error('Figure flag out of range, see code');
 end

 % takes a long time, must have contouring function
 if (contour_bathym)
    contourSW06NGDC_func(lat,lon);
 else
    figure(ifig); clf
    m_proj('mercator','lon',[lon(1) lon(2)],'lat',[lat(1) lat(2)]);
    m_grid('linestyle',':','box','fancy','tickdir','in','linewidth',3);
 end


 % load all positions  -  OLD WAY
 %%% load SW06_all_positions

 sw06_load_positions;                    % run load functions
 if (include_misc),
    sw06_load_misc;
 end
  
 

 if (plot_po),

  nenv = find(env.in ~= 0);
  hxx = m_line(env.lon, env.lat);
  set(hxx,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none'); 

  nsmoor = find(smoor.in ~= 0);
  hxy = m_line(smoor.lon, smoor.lat);
  set(hxy,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  npo = find(whoipo.in ~= 0);
  hxz = m_line(whoipo.lon, whoipo.lat);
  set(hxz,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
    
  ngpod = find(gpod.in ~= 0);
  hgp = m_line(gpod.lon, gpod.lat);
  set(hgp,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  nWC = find(osuWC.in ~= 0);
  hwc = m_line(osuWC.lon, osuWC.lat);
  set(hwc,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  nBL = find(osuBL.in ~= 0);
  hbl = m_line(osuBL.lon, osuBL.lat);
  set(hbl,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  
  nswm = find(swami.in ~= 0);
  hswm = m_line(swami.lon,swami.lat);
  set(hswm,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  nasis = find(asis.in ~= 0);
  hasis = m_line(asis.lon,asis.lat);
  set(hasis,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  nwv = find(wrider.in ~= 0);
  hwv = m_line(wrider.lon,wrider.lat);
  set(hwv,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  

 end


 % -------------------------------
 %  appending acoustic positions
 % -------------------------------

 if (plot_acoustics),
 
  nmsm = find(msm.in ~= 0);
  hmsm = m_line(msm.lon,msm.lat);
  set(hmsm,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');

  nnrl3 = find(nrl300.in ~= 0);
  hnrl3 = m_line(nrl300.lon,nrl300.lat);
  set(hnrl3,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  
  nnrl5 = find(nrl500.in ~= 0);
  hnrl5 = m_line(nrl500.lon,nrl500.lat);
  set(hnrl5,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   

  nw224 = find(w224.in ~= 0);
  hw2 = m_line(w224.lon,w224.lat);
  set(hw2,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  

  nw400 = find(w400.in ~= 0);
  hw4 = m_line(w400.lon,w400.lat);
  set(hw4,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  
 
  nshr = find(shr.in ~= 0);
  hshr = m_line(shr.lon,shr.lat);
  set(hshr,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
   
  nshrk = find(shark.in ~= 0);
  hshk = m_line(shark.lon,shark.lat);
  set(hshk,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  

  % not being deployed off KNORR, so don't plot.....
  % nvla = find(vla.in ~= 0);
  % hvla = m_line(vla.lon,vla.lat);
  % set(hvla,'marker','o','markersize',7,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  % hvlat = m_text(vla.lon, vla.lat, num2str(vla.num));  

  nmor = find(moray.in ~= 0);
  hapl = m_line(moray.lon,moray.lat);
  set(hapl,'marker','o','markersize',5,'color',ltcol,'markerfacecolor',ltcol,'linestyle','none');
  
 end


  % no initial location marks
  if (include_misc == 1)

     nWBSa = find(drdc_WBSa.in ~= 0);
     if (~isempty(nWBSa)),
      hWBSa = m_line(drdc_WBSa.lon(nWBSa),drdc_WBSa.lat(nWBSa));
      set(hWBSa,'marker','p','markersize',7,'color','b','markerfacecolor','b','linestyle','none');
     end 

     nWBSb = find(drdc_WBSb.in ~= 0);
     if (~isempty(nWBSb)),
      hWBSb = m_line(drdc_WBSb.lon(nWBSb),drdc_WBSb.lat(nWBSb));
      set(hWBSb,'marker','p','markersize',7,'color','b','markerfacecolor','b','linestyle','none');
     end    
 
     nUAT1 = find(drdc_UAT1.in ~= 0);
     if (~isempty(nUAT1)),
      hUAT1 = m_line(drdc_UAT1.lon(nUAT1),drdc_UAT1.lat(nUAT1));
      set(hUAT1,'marker','p','markersize',7,'color','g','markerfacecolor','g','linestyle','none');
     end    
     
     nUAT2 = find(drdc_UAT2.in ~= 0);
     if (~isempty(nUAT2)),
      hUAT2 = m_line(drdc_UAT2.lon(nUAT2),drdc_UAT2.lat(nUAT2));
      set(hUAT2,'marker','p','markersize',7,'color','r','markerfacecolor','r','linestyle','none');
     end    
     
     nBBN1 = find(drdc_BBN1.in ~= 0);
     if (~isempty(nBBN1)),
      hBBN1 = m_line(drdc_BBN1.lon(nBBN1),drdc_BBN1.lat(nBBN1));
      set(hBBN1,'marker','p','markersize',7,'color','r','markerfacecolor','r','linestyle','none');
     end    
     
     nBBN2 = find(drdc_BBN2.in ~= 0);
     if (~isempty(nBBN2)),
      hBBN2 = m_line(drdc_BBN2.lon(nBBN2),drdc_BBN2.lat(nBBN2));
      set(hBBN2,'marker','p','markersize',7,'color','r','markerfacecolor','r','linestyle','none');
     end    

  end

  % Add legend
 
  if (plot_legend == 1),
    hleg = legend([hxx,hxy,hxz,hwc,hbl,hmsm,hnrl3,hnrl5,hw2,hw4, ...
             hshr,hshk,hswm,hasis,htrl,hvla,hapl,hwv ], ...
            'envmoor','smoor','po moor','osumoor','osu BL', ...
            'MSM','NRL300','NRL500','whoi224','whoi400', ...
            'SHRU','WHOI array','SWAMI','ASIS','r/t string',...
             'vla', 'MORAY','wave rider');

    % on my pc
    % set(hleg,'position',[0.7723    0.1472    0.2250    0.8111]);

    % on my linux machine,  (do a get(hleg,'position') to find best for you)
    set(hleg, 'position', [0.80   0.33    0.1875    0.5751]);
  end


  if (plot_mohsen ==1),
      sw06_load_mohsen;
  end


  if (lines_of_death == 1),
      
        hLOD1 = m_line([-73.3834   -72.8418 ],[39.1567  38.9137  ]);
        hLOD2 = m_line([-73.0636   -72.9131 ],[39.0652  39.2678  ]);
        hLOD3 = m_line([-73.0235   -72.8729 ],[39.0472  39.2498  ]);
  end
             
 caxis( [ 50 3000])
 xlabel('Lon W')
 ylabel('Lat N')
 title(stitle);

end   % over ifig
% -------------------------------------------------------------------------------------
 
