roms_tools.setup.nesting.align_grids

Contents

roms_tools.setup.nesting.align_grids#

roms_tools.setup.nesting.align_grids(parent_grid: Grid, child_grid: Grid, boundaries: dict | None = None, hmin: float | None = None, verbose: bool = False) Grid#

This function establishes the relationship between a parent grid and a child grid in ROMS simulations. It alters the child_grid dataset, child_grid.ds ensuring compatibility with the parent grid by adjusting the child grid mask and topography to match the parent grid at the boundaries.

To update the child grid mask and ensure consistency with the parent grid, this function performs the following steps:

  1. Adjusts the child mask to ensure consistency with the parent mask.

To update the child grid topography, this function performs the following operations:

  1. Enforces the minimum depth constraint hmin.

  2. Adjusts the child grid topography to maintain consistency with the parent grid.

  3. Updates the internal dataset (child_grid.ds) with the processed bathymetry.

Parameters:
  • parent_grid (Grid) – The parent grid object, providing the reference for the topography and mask of the child grid.

  • child_grid (Grid) – The child grid object to be adapted and mapped onto the parent_grid.

  • boundaries (Dict[str, bool]) – Specifies which child grid boundaries (‘south’, ‘east’, ‘north’, ‘west’) should be adjusted for topography/mask and included in ds_nesting. If not provided, valid (non-land) boundaries are enabled automatically.

  • hmin (float, optional) – Minimum allowable ocean depth (meters). If None, the existing value is retained.

  • verbose (bool, optional) – Indicates whether to print grid generation steps with timing. Defaults to False.

Returns:

child_grid (Grid) –

Updates the internal dataset (child_grid.ds) in place, modifying the mask

and topography, and ensuring consistent parent-child boundary mapping.