A new automatic tool to construct ROMS land mask from GSHHS
(Global Self-consistent Hierarchical High-resolution Shorelines) dataset
is now available as a compile-once -- use-forever command-line operator.
This is the preferred the way and, in fact superior to the more usual practice
of generating an initial approximation for the mask from bottom topography,
and manually editing it using matlab "editmask" tool -- although some
manual editing may still be needed to resolve "delicate" passages --
99.9% of manual editing can be eliminated. Whoever is interested,
please go ahead and obtain package "tools.tar" from
http://www.atmos.ucla.edu/~alex/ROMS/tools.tar
Make a directory and unpack it there. Refer to "README.compiling" for
help in compiling it. Basically you have to edit makefile header to make sure
that you have correct path for linking to netCDF library (netCDF-4, HDF5-
enabled library is required), you have to create ~/bin directory in your home
directory, and also specify installation path (say /usr/local/bin if you
have write permission in it, but in any case you also need ~/bin as well).
Your may compile the entire package or only tools relevant to land-mask
building: gshhs_to_roms_mask, copymask, single_connect, commit_rmask.
Operator, "gshhs_to_roms_mask", reads GSHHS shoreline data set, generates
"raw" ROMS land mask, and writes it into a separate netCDF file. Usage:
Code: Select all
gshhs_to_roms_mask roms_grid_file.nc
Code: Select all
copymask mask.nc roms_grid_file.nc
tool, and/or
Code: Select all
single_connect i0 j0 roms_grid_file.nc
input: (1) "lon_rho","lat_rho" and their dimensions read from
roms_grid_file.nc, and
(2) GSHHS costline data, usually named "gshhs_f.b" from
http://www.ngdc.noaa.gov/mgg/shorelines ... hs/latest/
which can be found inside gshhg-bin-VERSION.zip archive
IMPORTANT: File "gshhs_f.b" must be placed somewhere on
the local computer, after which C-program "read_gshhs.c" (comes
with this package) must be edited to make sure that its line
Code: Select all
char fname[ ]="/path/to/dir/gshhs_f.b";
because there are really no options -- it is just a program to read the specific
file with no alternatives -- coarse resolution coastlines do not count.
output: file "mask.nc" created by this program; it contains an
integer variable "land_rho" with dimensions matching the
above, and land_rho=0 for water points, nonzero-value(s)
(typically +2) for land, but may produce different values
for differend land masses and object, depending on tuning
of this program below.
Here is an example: raw land mask for 1.5km Gulf of Mexico model,
1220 x 898 grid points, straight after gshhs_to_roms_mask roms_grid_file.nc
command The same mask, single_connect -s 500 500 roms_grid_file.nc green areas corresponds to the original land generated by gshhs_to_roms_mask,
yellow-orange areas are the ones blocked by single_connect for the reason that there
is no water passage to these points from the user-specified point i=500, j=500 designated
as "water"; and dark-brown points scattered here and there on the coastline are blocked for
the reason that they are identified as "narrow bays".
Argument -s stands for show, meaning that each point changed from water to land is set
to -1 or -2 instead of 0, so it is possible to visualize what is is doing. All the images presented
here are just screen captures from ncview. Once processed by single_connect, it is guaranteed
that all the blue area is mathematically a single-connected domain. Once you decide that
you are happy with your land mask and do not want to change anything any more, the next
operator commit_rmask grid_file.nc will set all the colored points to "land", and your model
is ready to run.
An enlarged portion of the image above to illustrate which narrow bays are blocked: ...Alexander Shchepetkin