function [etopo2,lon,lat]=get_etopo2(lon,lat)
% Function [etopo2,lon,lat]=get_etopo2(lon,lat)
%   get etopo2 bathymetry
%   etopo2 is decimated on grid defined by input lon/lat;
%   if input lon/lat is not specified, full resolution etopo2
%   is returned. etopo2 bathymetry file obtained from
%   http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO2/ETOPO2.raw.bin
%
% INPUTS
% lon     longitude East (deg)
% lat     latitude North (deg)
%
% OUTPUTS
% lon     longitude East (deg)
% lat     latitude North (deg)
% etopo2  2-D array containing bathymetry (m)

elon=0:1/30:(360-1/30);
elat=(-90+1/30):1/30:90;

etopo2=rot90(readbin('~/matlab/mitgcm/ETOPO2.raw.bin',[10800 5400],1,'int16'))';
etopo2=etopo2([5401:10800 1:5400],:);

if nargin < 2
  lon=elon;
  lat=elat;
else
  etopo2=decim2(elon,elat,etopo2,lon,lat);
end
