ROMS Tools - myroms/roms GitHub Wiki

Extraction by Decimation or Interpolation

ROMS can extract and write solutions to the provided grid geometry by decimation or horizontal interpolation, level-by-level, in 3D fields. It is activated with the GRID_EXTRACT option.

The ROMS standard input script roms.in includes new parameters:

  • ExtractFlag: ROMS solution extraction integer flag:

    • ExtractFlag = 1, extraction by horizontal interpolation, level-by-level. This option is not fully developed because a special interpolation algorithm is required in applications with land/sea masks. A generic remapping using the ESMF library is currently being developed for grid-to-grid interpolation, including land/sea masks.
    • ExtractFlag > 1, coarsening by decimation, level-by-level. For example, if ExtractFlag=2, the field data is sampled at every other point. This strategy is advantageous in mixed-resolution, split 4D-Var applications where the outer loop background (prior) trajectory may be computed at a higher resolution than in the inner loop minimization to accelerate the calculations. The decimated solution becomes the background nonlinear trajectory used to linearize the tangent linear (TLM) and adjoint (ADM) models. In this case, to ensure that both fine and coarse grids at RHO points coincide at the domain boundary, the following equalities must satisfied:
      • MOD(Lm+1, ExtractFlag) = 0
      • MOD(Mm+1, ExtractFlag) = 0
  • GRXNAME: The input extraction grid geometry NetCDF filename. It must be created with tools similar to the ROMS application grid and contained inside the parent grid.

  • XTRNAME: The output extracted solution NetCDF filename.

For debugging and testing, an idealized test case, LAKE_DECIMATE, at 1x1 km resolution (360x300x20), is introduced.

  • On principle, the LAKE_DECIMATE parent grid satisfies decimation factors of 2, 3, 4, 5, 6, 10, and so on. However, we are using ExtractFlag = 2 to sample the solution at every other point. The issue is that decimating next to land/sea mask point and U- and **V-**type staggered variables is very tricky because it requires averaging.
Parent Grid 1.0x1.0 km Extracted Grid 2.0x2.0 km

The figures bellow show the decimated solution for free surface and surface temperature for ExtractFlag=2:

Parent Grid 1.0x1.0 km Extracted Grid 2.0x2.0 km
  • Alternatively, may extract non-aligned grids by interpolation: Rotated higher-resolution grids, Bay and Inlet. The Bay grid includes the coastline and island to test the interpolation in the presence of land/sea masks, while the Inlet grid does not.
Bay Grid 0.5x0.5 km Inlet Grid 0.5x0.5 km

This test is under development because the interpolation infrastructure inside ROMS currently cannot include coastline making. Also, the interpolation logic only works in 1x1 parallel decomposition. The plan is to add a generic ESMF-based grid-to-grid interpolation that works in parallel and can handle land-masked points.

Parent Grid 1.0x1.0 km Extracted Inlet Grid 0.5x0.5 km

YAML Parser

The YAML Parser (ROMS/Utility/yaml_parser.F) requires features of the Fortran 2003 standard and some elements of the Fortran 2008 standard, available in modern compilers. In the past, we have reports of Users having issues compiling with older versions of gfortran or incomplete implementation of the Object-Oriented Programming (OOP) principles from the 2003 standard. Therefore, a standalone program is added (ROMS/Programs/yaml_parser_test.F) to test the compilers.

To compile and link, use the following:

ifort -o yaml_parser_test.x yaml_parser_test.F
gfortran -o yaml_parser_test.x yaml_parser_test.F

Then, to execute, use:

> yaml_parser_test.x

 Enter YAML filename:  ../../ESM/coupling_esmf.yaml

 Enter YAML filename:  ../../ESM/roms_cmeps.yaml

 Enter YAML filename:  ../External/varinfo.yaml

 Enter YAML filename:

The YAML tree dictionary and extraction are written to standard output.