Utility Scripts

From WikiROMS
Jump to navigationJump to search
Matlab: Utility Scripts

This page describes several Matlab scripts in the matlab/utility repository sub-directory which are used for various purposes.



sample_grid.m
Computes the donor grid indices range of the polygon that tightly contains the target grid. This is done to sample the donor grid to accelerate the interpolation of fields for the receiver grid. The input coordinates can be either in terms of Cartesian or spherical coordinates
[Istr, Iend, Jstr, Jend] = sample_grid  (XD, YD, XR, YR, offset, plt)
On Input:
XD:   Donor grid X-coordinates (2D array)
YD:   Donor grid Y-coordinates (2D array)
XR:   Receiver grid X-coordinates (2D array)
YR:   Receiver grid Y-coordinates (2D array)
offset:   Number of extra points to used to sample the donor grid so is large enough to contain the target grid (optional; default 5)
plt:   Switch to plot parent and target grids (logical; optional; default false)
On Ouput:
Istr:   Donor grid starting I-index for sampling
Iend:   Donor grid ending I-index for sampling
Jstr:   Donor grid starting J-index for sampling
Jend:   Donor grid ending J-index for sampling