showModelMesh
Overview
showModelMesh reads three co-registered floating-point .r4 model grids (<prefix>.lat.r4, <prefix>.lon.r4, and <prefix>.mask.r4) representing a curvilinear hydrodynamic or oceanographic model grid, and exports an ASCII wireframe line file (<prefix>.mesh.llz) connecting adjacent active (non-zero mask) nodes along grid rows and columns.
Syntax & CLI Options
showModelMesh [-v] -prefix <modelprefix>
| Flag | Description |
|---|---|
-v | Verbose output. |
-prefix <modelprefix> | Prefix of the three input .r4 files (<modelprefix>.lat.r4, <modelprefix>.lon.r4, and <modelprefix>.mask.r4). Writes <modelprefix>.mesh.llz. |
How It Works
- Grid Ingestion & Validation:
- Opens
<prefix>.lat.r4,<prefix>.lon.r4, and<prefix>.mask.r4, verifies that all three are 32-bit floating-point grids (data_type == 3) with identicaldxanddydimensions, and reads their float arrays (jswapfloat_fread).
- Opens
- Wireframe Segment Generation:
- Iterates through every cell
(i, j)fori = 0..yno-2andj = 0..xno-2. - Retrieves
(lat, lon, mask)at(i, j), its eastern neighbor(lat1, lon1, mask1)at(i, j+1), and its southern neighbor(lat2, lon2, mask2)at(i+1, j). -
If both
maskandmask1are non-zero, writes a 2-point horizontal segment followed by a0.0 0.0 0.0pen-up terminator:<lat> <lon> <mask> <lat1> <lon1> <mask1> 0.0 0.0 0.0 - If both
maskandmask2are non-zero, writes the vertical segment connecting(i, j)to(i+1, j)followed by0.0 0.0 0.0.
- Iterates through every cell
Examples
Export a wireframe mesh from curvilinear model coordinate grids
showModelMesh -prefix gom_pom
Workflow Context
- Related Model Tools:
extractNodeProf,convert3D_TSZ_to_SV,readQUODDY,makemesh.