Difference between revisions of "Land Sea Masking Scripts"

From WikiROMS
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:


<section begin=add_coastline.m />;<span id="add_coastline"></span><span class="blue">add_coastline.m</span>
<section begin=add_coastline.m />;<span id="add_coastline"></span><span class="blue">add_coastline.m</span>
:Adds coastline data to ROMS Grid NetCDF file. This is the coastline data is used to facilitate Land/Sea masking editing. <br />
:Adds coastline data to ROMS Grid NetCDF file. This is the coastline data used to facilitate Land/Sea masking editing. <br />
::<span class="red">add_coastline</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">Clon</span>, <span class="green">Clat</span>)
::<span class="red">add_coastline</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">Clon</span>, <span class="green">Clat</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncfile</span>: &nbsp; ROMS Grid NetCDF file name (string)
::{| class="matlab"
::<span class="green">Clon </span>: &nbsp; Coastline longitude (1D array, degree_east)
|-
::<span class="green">Clat </span>: &nbsp; Coastline latitude  (1D array, degree_north)<section end=add_coastline.m />
|<span class="green">ncfile</span>:
|ROMS Grid NetCDF file name (string)
|-
|<span class="green">Clon</span>:
|Coastline longitude (1D array, degree_east)
|-
|<span class="green">Clat</span>:
|Coastline latitude  (1D array, degree_north)
|-
|}<section end=add_coastline.m />




<section begin=editmask.m />;<span id="editmask"></span><span class="blue">editmask.m</span>
<section begin=editmask.m />;<span id="editmask"></span><span class="blue">editmask.m</span>
:GUI for manual editing of ROMS Land/Sea mask on RHO-points.  To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates.  If the (I,J) coordinates are not provided, it compute and write them into file. If called without, one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates. <br />
:GUI for manual editing of ROMS Land/Sea mask on RHO-points.  To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates.  If the (I,J) coordinates are not provided, it will compute and write them into a file. If called without one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates. <br />
::<span class="red">editmask</span> &nbsp;(<span class="green">grid_file</span>, <span class="green">coast_file</span>)
::<span class="red">editmask</span> &nbsp;(<span class="green">grid_file</span>, <span class="green">coast_file</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">grid_file </span>: &nbsp; ROMS Grid NetCDF file name containing the grid and mask arrays (string)
::{| class="matlab"
::<span class="green">coast_file</span>: &nbsp; Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)  
|-
|<span class="green">grid_file</span>:
|ROMS Grid NetCDF file name containing the grid and mask arrays (string)
|-
|<span class="green">coast_file</span>:
|Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)
|-
|}
:'''Mouse shortcuts:'''
:'''Mouse shortcuts:'''
::<span class="green">double click</span>, &nbsp; zoom in
::{| class="matlab"
::<span class="green">right click</span>, &nbsp; zoom out
|-
::<span class="green">middle click</span>, &nbsp; change editing mode<section end=editmask.m />
|<span class="green">double click</span>:
|zoom in
|-
|<span class="green">right click</span>:
|zoom out
|-
|<span class="green">middle click</span>:
|change editing mode
|-
|}<section end=editmask.m />




<section begin=editscope.m />;<span id="editscope"></span><span class="blue">editscope.m</span>
<section begin=editscope.m />;<span id="editscope"></span><span class="blue">editscope.m</span>
:GUI for manual editing of ROMS adjoint sensitivity scope mask on RHO-points.  To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates.  If the (I,J) coordinates are not provided, it compute and write them into file. If called without, one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates. <br />
:GUI for manual editing of ROMS adjoint sensitivity scope mask on RHO-points.  To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates.  If the (I,J) coordinates are not provided, it will compute and write them into a file. If called without one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates. <br />
::<span class="red">editscope</span> &nbsp;(<span class="green">grid_file</span>, <span class="green">coast_file</span>)
::<span class="red">editscope</span> &nbsp;(<span class="green">grid_file</span>, <span class="green">coast_file</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">grid_file </span>: &nbsp; ROMS Grid NetCDF file name containing the grid and mask arrays (string)
::{| class="matlab"
::<span class="green">coast_file</span>: &nbsp; Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)  
|-
|<span class="green">grid_file </span>:
|ROMS Grid NetCDF file name containing the grid and mask arrays (string)
|-
|<span class="green">coast_file</span>:
|Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)
|-
|}
:'''Mouse shortcuts:'''
:'''Mouse shortcuts:'''
::<span class="green">double click</span>, &nbsp; zoom in
::{| class="matlab"
::<span class="green">right click</span>, &nbsp; zoom out
|-
::<span class="green">middle click</span>, &nbsp; change editing mode<section end=editscope.m />
|<span class="green">double click</span>:
|zoom in
|-
|<span class="green">right click</span>:
|zoom out
|-
|<span class="green">middle click</span>:
|change editing mode
|-
|}<section end=editscope.m />




Line 47: Line 88:
::<span class="green">C</span> = <span class="red">ijcoast</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">coast_file)
::<span class="green">C</span> = <span class="red">ijcoast</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">coast_file)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
::<span class="green">coast_file</span>: &nbsp; Coastline file name (string)
|-
|<span class="green">ncname</span>:
|ROMS grid NetCDF file name (string)
|-
|<span class="green">coast_file</span>:
|Coastline file name (string)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">C</span>: &nbsp;  Coastline data (struct array)
::{| class="matlab"
:::<span class="green">C.grid   </span>, &nbsp; ROMS Grid NetCDF file name
|-
:::<span class="green">C.coast </span>, &nbsp; Coastline file name
|<span class="green">C</span>:
:::<span class="green">C.indices</span>, &nbsp; Coastline indices file name
|Coastline data (struct array)
:::<span class="green">C.lon   </span>, &nbsp; Coastline longitudes
|-
:::<span class="green">C.lat   </span>, &nbsp; Coastline latitudes
|}
:::<span class="green">C.Icst   </span>, &nbsp; Coastline I-grid coordinates, (0:L)
:::{| class="matlab"
:::<span class="green">C.Jcst   </span>, &nbsp; Coastline J-grid coordinates, (0:M)<section end=ijcoast.m />
|-
|<span class="green">C.grid</span>
|ROMS Grid NetCDF file name
|-
|<span class="green">C.coast</span>
|Coastline file name
|-
|<span class="green">C.indices</span>
|Coastline indices file name
|-
|<span class="green">C.lon</span>
|Coastline longitudes
|-
|<span class="green">C.lat</span>
|Coastline latitudes
|-
|<span class="green">C.Icst</span>
|Coastline I-grid coordinates, (0:L)
|-
|<span class="green">C.Jcst</span>
|Coastline J-grid coordinates, (0:M)
|-
|}<section end=ijcoast.m />




<section begin=landsea.m />;<span id="landsea"></span><span class="blue">landsea.m</span>
<section begin=landsea.m />;<span id="landsea"></span><span class="blue">landsea.m</span>
:Computes automatically the Land/Sea mask for an application grid and writes it into input NetCDF file. The Land/Sea mask is computed from closed coastlines polygons extracted from the GSHHS data set if the (<span class="green">clon</span>, <span class="green">clat</span>) coastline data is not provided. <br />
:Computes the Land/Sea mask for an application grid atomatically and writes it into an input NetCDF file. The Land/Sea mask is computed from closed coastlines polygons extracted from the GSHHS data set if the (<span class="green">clon</span>, <span class="green">clat</span>) coastline data is not provided. <br />
::<span class="green">F</span> = <span class="red">lansea</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">clon</span>, <span class="green">clat</span>)
::<span class="green">F</span> = <span class="red">lansea</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">clon</span>, <span class="green">clat</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
::<span class="green">clon </span>: &nbsp; Coastline longitude (1D array; degrees_west)
|-
::<span class="green">clat </span>: &nbsp; Coastline latitude (1D array; degrees_north)
|<span class="green">ncname</span>:
|ROMS grid NetCDF file name (string)
|-
|<span class="green">clon</span>:
|Coastline longitude (1D array; degrees_west)
|-
|<span class="green">clat</span>:
|Coastline latitude (1D array; degrees_north)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">F</span>: &nbsp;  Land/Sea mask data (struct array)
::{| class="matlab"
:::<span class="green">F.mask_rho</span>, &nbsp; Mask on '''&rho;'''-points (2D array)
|-
:::<span class="green">F.mask_psi</span>, &nbsp; Mask on &'''psi;'''-points (2D array)
|<span class="green">F</span>:
:::<span class="green">F.mask_u </span>, &nbsp; Mask on '''u'''-points (2D array)
|Land/Sea mask data (struct array)
:::<span class="green">F.mask_v </span>, &nbsp; Mask on '''v'''-points (2D array) <section end=landsea.m />
|-
|}
:::{| class="matlab"
|-
|<span class="green">F.mask_rho</span>
|Mask on '''&rho;'''-points (2D array)
|-
|<span class="green">F.mask_psi</span>
|Mask on '''&psi;'''-points (2D array)
|-
|<span class="green">F.mask_u</span>
|Mask on '''u'''-points (2D array)
|-
|<span class="green">F.mask_v</span>
|Mask on '''v'''-points (2D array)
|-
|}<section end=landsea.m />




Line 79: Line 174:
::[<span class="green">spherical</span>, <span class="green">x</span>, <span class="green">y</span>, <span class="green">bath</span>, <span class="green">rmask</span>] = <span class="red">read_mask</span> &nbsp;(<span class="green">ncfile</span>)
::[<span class="green">spherical</span>, <span class="green">x</span>, <span class="green">y</span>, <span class="green">bath</span>, <span class="green">rmask</span>] = <span class="red">read_mask</span> &nbsp;(<span class="green">ncfile</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
|-
|<span class="green">ncname</span>:
|ROMS grid NetCDF file name (string)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">spherical</span>, &nbsp; Spherical switch (logical)
::{| class="matlab"
::<span class="green">x       </span>, &nbsp; X-location of &rho;-points
|-
::<span class="green">y       </span>, &nbsp; Y-location of &rho;-points
|<span class="green">spherical</span>:
::<span class="green">bath     </span>, &nbsp; Bathymetry at &rho;-points
|Spherical switch (logical)
::<span class="green">rmask   </span>, &nbsp; Land/Sea mask at &rho;-points<section end=read_mask.m />
|-
|<span class="green">x</span>:
|X-location of &rho;-points
|-
|<span class="green">y</span>:
|Y-location of &rho;-points
|-
|<span class="green">bath</span>:
|Bathymetry at &rho;-points
|-
|<span class="green">rmask</span>:
|Land/Sea mask at &rho;-points
|-
|}<section end=read_mask.m />




<section begin=read_scope.m />;<span id="read_scope"></span><span class="blue">read_scope.m</span>
<section begin=read_scope.m />;<span id="read_scope"></span><span class="blue">read_scope.m</span>
:Reads in ROMS grid bathymetry and adjoint sensitivity scope mask at &rho;-point from NetCDF file. <br />
:Reads in ROMS grid bathymetry and adjoint sensitivity scope mask at &rho;-points from NetCDF file. <br />
::[<span class="green">spherical</span>, <span class="green">x</span>, <span class="green">y</span>, <span class="green">bath</span>, <span class="green">rmask</span>] = <span class="red">read_mask</span> &nbsp;(<span class="green">ncfile</span>)
::[<span class="green">spherical</span>, <span class="green">x</span>, <span class="green">y</span>, <span class="green">bath</span>, <span class="green">rmask</span>] = <span class="red">read_mask</span> &nbsp;(<span class="green">ncfile</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
|-
|<span class="green">ncname</span>:
|ROMS grid NetCDF file name (string)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">spherical</span>, &nbsp; Spherical switch (logical)
::{| class="matlab"
::<span class="green">x       </span>, &nbsp; X-location of &rho;-points
|-
::<span class="green">y       </span>, &nbsp; Y-location of &rho;-points
|<span class="green">spherical</span>:
::<span class="green">bath     </span>, &nbsp; Bathymetry at &rho;-points
|Spherical switch (logical)
::<span class="green">rmask   </span>, &nbsp; Land/Sea mask at &rho;-points<section end=read_scope.m />
|-
|<span class="green">x</span>:
|X-location of &rho;-points
|-
|<span class="green">y</span>:
|Y-location of &rho;-points
|-
|<span class="green">bath</span>:
|Bathymetry at &rho;-points
|-
|<span class="green">rmask</span>:
|Land/Sea mask at &rho;-points
|-
|}<section end=read_scope.m />




Line 105: Line 236:
::[<span class="green">umask</span>, <span class="green">vmask</span>, <span class="green">vmask</span>] = <span class="red">uvp_masks</span> &nbsp;(<span class="green">rmask</span>)
::[<span class="green">umask</span>, <span class="green">vmask</span>, <span class="green">vmask</span>] = <span class="red">uvp_masks</span> &nbsp;(<span class="green">rmask</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">rmask</span>: &nbsp; Land/Sea mask on '''&rho;'''-points (2D array)
::{| class="matlab"
|-
|<span class="green">rmask</span>:
|Land/Sea mask on '''&rho;'''-points (2D array)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">umask</span>, &nbsp; Land/Sea mask on '''u'''-points (2D array)
::{| class="matlab"
::<span class="green">vmask</span>, &nbsp; Land/Sea mask on '''v'''-points (2D array)
|-
::<span class="green">rmask</span>, &nbsp; Land/Sea mask on '''&psi;'''-points (2D array) <section end=uvp_masks.m />
|<span class="green">umask</span>:
|Land/Sea mask on '''u'''-points (2D array)
|-
|<span class="green">vmask</span>:
|Land/Sea mask on '''v'''-points (2D array)
|-
|<span class="green">rmask</span>:
|Land/Sea mask on '''&psi;'''-points (2D array)
|-
|}<section end=uvp_masks.m />




Line 116: Line 261:
::[<span class="green">Uscope</span>, <span class="green">Vscope</span>] = <span class="red">uvp_masks</span> &nbsp;(<span class="green">Rscope</span>)
::[<span class="green">Uscope</span>, <span class="green">Vscope</span>] = <span class="red">uvp_masks</span> &nbsp;(<span class="green">Rscope</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">Rscope</span>: &nbsp; Scope mask on '''&rho;'''-points (2D array)
::{| class="matlab"
|-
|<span class="green">Rscope</span>:
|Scope mask on '''&rho;'''-points (2D array)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">Uscope</span>, &nbsp; Scope mask on '''u'''-points (2D array)
::{| class="matlab"
::<span class="green">Vscope</span>, &nbsp; Scope mask on '''v'''-points (2D array)<section end=uv_scope.m />
|-
|<span class="green">Uscope</span>:
|Scope mask on '''u'''-points (2D array)
|-
|<span class="green">Vscope</span>:
|Scope mask on '''v'''-points (2D array)
|-
|}<section end=uv_scope.m />




<section begin=write_mask.m />;<span id="write_mask"></span><span class="blue">write_mask.m</span>
<section begin=write_mask.m />;<span id="write_mask"></span><span class="blue">write_mask.m</span>
:Writes out Land/Sea mask data into ROMS Grid NetCDF file. <br />
:Writes out Land/Sea mask data into ROMS Grid NetCDF file. <br />
::span class="green">status</span> = <span class="red">write_mask</span> &nbsp;(<span class="green">ncfile</span>, span class="green">rmask</span>, <span class="green">umask</span>, <span class="green">vmask</span>, <span class="green">pmask</span>)
::<span class="green">status</span> = <span class="red">write_mask</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">rmask</span>, <span class="green">umask</span>, <span class="green">vmask</span>, <span class="green">pmask</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
::<span class="green">rmask </span>, &nbsp; Land/Sea mask on '''&rho;'''-points (2D array)
|-
::<span class="green">umask </span>, &nbsp; Land/Sea mask on '''u'''-points (2D array)
|<span class="green">ncname</span>:
::<span class="green">vmask </span>, &nbsp; Land/Sea mask on '''v'''-points (2D array)
|ROMS grid NetCDF file name (string)
::<span class="green">pmask </span>, &nbsp; Land/Sea mask on '''&psi;'''-points (2D array)
|-
|<span class="green">rmask</span>:
|Land/Sea mask on '''&rho;'''-points (2D array)
|-
|<span class="green">umask</span>:
|Land/Sea mask on '''u'''-points (2D array)
|-
|<span class="green">vmask</span>:
|Land/Sea mask on '''v'''-points (2D array)
|-
|<span class="green">pmask</span>:
|Land/Sea mask on '''&psi;'''-points (2D array)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">status</span>, &nbsp; Error flag<section end=write_mask.m />
::{| class="matlab"
|-
|<span class="green">status</span>:
|Error flag
|-
|}<section end=write_mask.m />




<section begin=write_scope.m />;<span id="write_scope"></span><span class="blue">write_scope.m</span>
<section begin=write_scope.m />;<span id="write_scope"></span><span class="blue">write_scope.m</span>
:Writes out adjoint sensitivity scope mask data into ROMS Grid NetCDF file. <br />
:Writes out adjoint sensitivity scope mask data into ROMS Grid NetCDF file. <br />
::span class="green">status</span> = <span class="red">write_mask</span> &nbsp;(<span class="green">ncfile</span>, span class="green">Rscope</span>, <span class="green">Uscope</span>, <span class="green">Vscope</span>)
::<span class="green">status</span> = <span class="red">write_mask</span> &nbsp;(<span class="green">ncfile</span>, <span class="green">Rscope</span>, <span class="green">Uscope</span>, <span class="green">Vscope</span>)
:'''On Input:'''
:'''On Input:'''
::<span class="green">ncname</span>: &nbsp; ROMS grid NetCDF file name (string)
::{| class="matlab"
::<span class="green">Rscope</span>, &nbsp; Adjoint sensitivity scope mask on '''&rho;'''-points (2D array)
|-
::<span class="green">Uscope</span>, &nbsp; Adjoint sensitivity scope mask on '''u'''-points (2D array)
|<span class="green">ncname</span>:
::<span class="green">Vscope</span>, &nbsp; Adjoint sensitivity scope mask on '''v'''-points (2D array)
|ROMS grid NetCDF file name (string)
|-
|<span class="green">Rscope</span>:
|Adjoint sensitivity scope mask on '''&rho;'''-points (2D array)
|-
|<span class="green">Uscope</span>:
|Adjoint sensitivity scope mask on '''u'''-points (2D array)
|-
|<span class="green">Vscope</span>:
|Adjoint sensitivity scope mask on '''v'''-points (2D array)
|-
|}
:'''On Output:'''
:'''On Output:'''
::<span class="green">status</span>, &nbsp; Error flag<section end=write_scope.m />
::{| class="matlab"
|-
|<span class="green">status</span>:
|Error flag
|-
|}<section end=write_scope.m />

Latest revision as of 13:10, 4 May 2012

Matlab: Land/Sea Masking Scripts

This page describes several Matlab scripts in the matlab/landmask repository sub-directory, which are used to process ROMS Land/Sea mask.



add_coastline.m
Adds coastline data to ROMS Grid NetCDF file. This is the coastline data used to facilitate Land/Sea masking editing.
add_coastline  (ncfile, Clon, Clat)
On Input:
ncfile: ROMS Grid NetCDF file name (string)
Clon: Coastline longitude (1D array, degree_east)
Clat: Coastline latitude (1D array, degree_north)


editmask.m
GUI for manual editing of ROMS Land/Sea mask on RHO-points. To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates. If the (I,J) coordinates are not provided, it will compute and write them into a file. If called without one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates.
editmask  (grid_file, coast_file)
On Input:
grid_file: ROMS Grid NetCDF file name containing the grid and mask arrays (string)
coast_file: Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)
Mouse shortcuts:
double click: zoom in
right click: zoom out
middle click: change editing mode


editscope.m
GUI for manual editing of ROMS adjoint sensitivity scope mask on RHO-points. To accelerate the processing, the Land/Sea mask is edited in (I,J) grid coordinates. If the (I,J) coordinates are not provided, it will compute and write them into a file. If called without one or both arguments, it will prompt for the needed file name(s). If the coastline data is in grid_file, it will read it and convert to (I,J) fractional coordinates.
editscope  (grid_file, coast_file)
On Input:
grid_file : ROMS Grid NetCDF file name containing the grid and mask arrays (string)
coast_file: Matlab file name containing the coastline (lon, lat) or (I,J) fractional coordinates (string; optional)
Mouse shortcuts:
double click: zoom in
right click: zoom out
middle click: change editing mode


ijcoast.m
Converts coastline data to ROMS (I,J) fractional coordinates to facilitate Land/Sea masking editing with editmask.
C = ijcoast  (ncfile, coast_file)
On Input:
ncname: ROMS grid NetCDF file name (string)
coast_file: Coastline file name (string)
On Output:
C: Coastline data (struct array)
C.grid ROMS Grid NetCDF file name
C.coast Coastline file name
C.indices Coastline indices file name
C.lon Coastline longitudes
C.lat Coastline latitudes
C.Icst Coastline I-grid coordinates, (0:L)
C.Jcst Coastline J-grid coordinates, (0:M)


landsea.m
Computes the Land/Sea mask for an application grid atomatically and writes it into an input NetCDF file. The Land/Sea mask is computed from closed coastlines polygons extracted from the GSHHS data set if the (clon, clat) coastline data is not provided.
F = lansea  (ncfile, clon, clat)
On Input:
ncname: ROMS grid NetCDF file name (string)
clon: Coastline longitude (1D array; degrees_west)
clat: Coastline latitude (1D array; degrees_north)
On Output:
F: Land/Sea mask data (struct array)
F.mask_rho Mask on ρ-points (2D array)
F.mask_psi Mask on ψ-points (2D array)
F.mask_u Mask on u-points (2D array)
F.mask_v Mask on v-points (2D array)


read_mask.m
Reads in ROMS grid bathymetry and Land/Sea mask at ρ-point from NetCDF file.
[spherical, x, y, bath, rmask] = read_mask  (ncfile)
On Input:
ncname: ROMS grid NetCDF file name (string)
On Output:
spherical: Spherical switch (logical)
x: X-location of ρ-points
y: Y-location of ρ-points
bath: Bathymetry at ρ-points
rmask: Land/Sea mask at ρ-points


read_scope.m
Reads in ROMS grid bathymetry and adjoint sensitivity scope mask at ρ-points from NetCDF file.
[spherical, x, y, bath, rmask] = read_mask  (ncfile)
On Input:
ncname: ROMS grid NetCDF file name (string)
On Output:
spherical: Spherical switch (logical)
x: X-location of ρ-points
y: Y-location of ρ-points
bath: Bathymetry at ρ-points
rmask: Land/Sea mask at ρ-points


uvp_masks.m
Computes the Land/Sea masks at u-, v-, and ψ-points from the mask on ρ-points.
[umask, vmask, vmask] = uvp_masks  (rmask)
On Input:
rmask: Land/Sea mask on ρ-points (2D array)
On Output:
umask: Land/Sea mask on u-points (2D array)
vmask: Land/Sea mask on v-points (2D array)
rmask: Land/Sea mask on ψ-points (2D array)


uv_scope.m
Computes the adjoint sensitivity scope masks at u- and v-points from the scope mask on ρ-points.
[Uscope, Vscope] = uvp_masks  (Rscope)
On Input:
Rscope: Scope mask on ρ-points (2D array)
On Output:
Uscope: Scope mask on u-points (2D array)
Vscope: Scope mask on v-points (2D array)


write_mask.m
Writes out Land/Sea mask data into ROMS Grid NetCDF file.
status = write_mask  (ncfile, rmask, umask, vmask, pmask)
On Input:
ncname: ROMS grid NetCDF file name (string)
rmask: Land/Sea mask on ρ-points (2D array)
umask: Land/Sea mask on u-points (2D array)
vmask: Land/Sea mask on v-points (2D array)
pmask: Land/Sea mask on ψ-points (2D array)
On Output:
status: Error flag


write_scope.m
Writes out adjoint sensitivity scope mask data into ROMS Grid NetCDF file.
status = write_mask  (ncfile, Rscope, Uscope, Vscope)
On Input:
ncname: ROMS grid NetCDF file name (string)
Rscope: Adjoint sensitivity scope mask on ρ-points (2D array)
Uscope: Adjoint sensitivity scope mask on u-points (2D array)
Vscope: Adjoint sensitivity scope mask on v-points (2D array)
On Output:
status: Error flag