
%- Feb 12 2013:
needs MDS (binary) grid files (XC,YC,XG,YG & RAC) in dir "./grid_files/"
 (read-in using matlab script: MITgcm/utils/matlab/load_grid.m
  which also allows to use MNC (NetCDF) grid files by changing "ncdf=0;"
  to "ncdf=1;" in all the matlab scripts listed here after).

%-----------------------------------------------------------
NOTE: For the purpose of computing meridional transport, a simpler, more robust
 method (based on grid-cell center latitude) is preferred, see "mk_isoLat_bkl.m"
 and "use_isoLat_bkl.m" in the directory one level up (i.e., in matlab/cs_grid/).
 However, other functions provided here (great-circle section line, basin
 mask and separation) have no improved equivalent (yet) in matlab/cs_grid/.

%- define broken-line on the C.S. grid as close as possible to given yLat latitude:
%  Method: find the list of grid-cell corner points that stay as close as
%  the corresponding target latitude, and collect the connecting grid-cell edges
%  (i.e., velocity points) to generate the broken-line.
%- started: Sep 15  2002
%  Note: have not been updated to accept compact-format input files

gener_bk_line.m
(use: load_grid.m find_bk_line.m clean_bk_line.m save_bk_line.m grph_bk_line.m)
=> write matlab file: isoLat_cube32_59.mat
( run 1rst time to try ; then set krd=0 and run 2nd time to calculate
  all the broken line and write to file)

%- generate array (= bkl_Zon) that give
%  the latitude zone (= between 2 broken-line) of each grid mesh (tracer pt),
%- Started: Jul 24 2003

gen_bk_Zon.m
<= read grid_files/isoLat_cube32_59.mat
=> write matlab file: isoLat_cs32_59.mat
(contains all the arrays that were in isoLat_cube32_59.mat)

%-----------------------------------------------------------
% define mask of 3 basins (Atlantic , Indian , Pacific)
%  and the list of border points (U,V point)
%- Jul 26 2003
%  Note: have not been updated to accept compact-format input files

def_API_msk.m
(use: line_sep.m; needs also hFacC,W,S from ocean-set-up, in dir: ./grid_files/ )
=> write binary files: maskC_bas.bin maskS_bas.bin maskW_bas.bin
 + list of U,V points at the border: => open_basins_section.mat

%- combine "broken-line" + 3 basins
% used to compute the mask of Meridional Stream-Funct. for Atl,Ind,Pac
%- Started: Jul 26 2003

sep_API_basins.m
=> write matlab file: sepBas_cs32_60.mat

%-----------------------------------------------------------
%- define a single broken-line on CS-grid that follows as close as possible
%  a great-circle line:
%- started: Feb 05 2007
%  Note: have not been updated to accept compact-format input files
grt_circ_bkl.m :
uses: load_grid.m rotate_xy.m split_Z_cub.m find_bk_line.m clean_bk_line.m
      save_bk_line.m shift_bk_line.m
(+ optional, for plots: grph_CS.m moveHV_colbar.m )

%------------------------------------------------------
% Example on how to use those broken-line files:
% a) to compute & plot Meridional Transport Stream-function
%   using broken-line file (i.e., like "isoLat_cs32_59.mat") generated by:
%   gener_bk_line.m + gen_bk_Zon.m from this dir.
% b) changing to krd=3, to compute the horizontally integrated transport
%   through a Great-Circle section using broken-line file generated by:
%  grt_circ_bkl.m from this dir.
%- Started: Jul 2003
% Note: has been updated to accept compact-format input files

use_bk_line.m
%-----------------------------------------------------------
