% plt_map_ctd.m - plot sampling runs and injection

mat_path='/mnt/oc415-2a/oc415_2/ctd/process/';

clear h

figure(1)
clf

Lat_min=29.8;
Lat_max=31;
Lon_min=-68;
Lon_max=-66.5;


m_proj('mercator','lat',[Lat_min Lat_max],'lon',[Lon_min Lon_max])

hold on

%%%%%%%%%%%%%%% CTD
for cast = 1:29
  disp(int2str(cast))
  if cast <10
    fn = ['oc41520',int2str(cast)];
  elseif cast <100
    fn = ['oc4152',int2str(cast)];
  end

  if cast == 15 | cast == 17 | cast == 20 | cast == 22 ...
	 | cast == 24
  
    % multipart casts
    if cast == 20
      ltr = ['a','b','c','d','e'];
    elseif cast == 15
      ltr = [' ','b','c','d'];
    else
      ltr = ['a','b','c','d'];
    end
    for jj = 1
      fn = ['oc4152',int2str(cast)];    
      eval(['load ',mat_path,fn,ltr(jj)])
      readhdr_bcd(cast,ltr(jj));
      lll=ltr(jj);
      m_plot(-lon,lat,'.');
      %m_text(-lon,lat,[int2str(cast)]);
    end
  else
    %single casts
    eval(['load ',mat_path,fn])
    readhdr;
    m_plot(-lon,lat,'.');
    if cast == 15 | cast == 17 | cast == 24 | cast == 22
      disp('nothing')
    elseif cast == 14 | cast == 16 | cast == 23 | cast == 21
      disp('something 1')
      m_text(-lon,lat,[int2str(cast),',',int2str(cast+1)]);
    elseif (cast >=1 & cast <=14) | cast == 18 | cast >= 25
      disp('something 2')
      m_text(-lon,lat,[int2str(cast)]);
    end

  end
end
m_grid('box','on','tickdir','in','fontweight','bold'); 

% this makes the color reappear
set(findobj('tag','m_grid_color'),'facecolor','none')

xlabel('Longitude')
ylabel('Latitude')
title('EDDIES OC415-2 - CTD stations')

orient portrait
print -dpng ctd_map.png
