Two ways to use a pre-existing grid instead of generating one from scratch:
Section A — load a supergrid and topography directly from files.
Section B — extract a regional sub-grid from a global supergrid by lat/lon bounds.
These are drop-in replacements for Steps 1.1–1.3 in the Getting Started tutorial. Everything after domain generation (Case creation, forcings, build/run) is unchanged.
Section A: Pre-Generated Grid Files¶
Use this when you already have a MOM6 supergrid (ocean_hgrid.nc), a
topography file, and a vertical grid file — e.g. from a previous run or a
shared community grid like NWA12.
Step 1.1: Horizontal Grid¶
from CrocoDash.grid import Grid
grid = Grid.from_supergrid("<NWA_HGRID>")Step 1.2: Topography¶
from CrocoDash.topo import Topo
bathymetry_path = "<NWA_BATHY>"
topo = Topo.from_topo_file(
grid=grid,
topo_file_path=bathymetry_path,
min_depth=5,
)topo.depth.plot()Step 1.3: Vertical Grid¶
from CrocoDash.vgrid import VGrid
vgrid_path = "<NWA_VGRID>"
vgrid = VGrid.from_file(vgrid_path)import matplotlib.pyplot as plt
for depth in vgrid.zi:
plt.axhline(y=depth, linestyle='-')
plt.ylim(max(vgrid.zi) + 10, min(vgrid.zi) - 10)
plt.ylabel("Depth")
plt.title("Vertical Grid")
plt.show()Section B: Subset a Global Supergrid¶
Use this when you have a global or basin-scale supergrid and want to extract a regional sub-domain by specifying lower-left and upper-right corner coordinates.
Step 1.1: Horizontal Grid¶
Extract a subgrid from a global supergrid using subgrid_from_supergrid:
from CrocoDash.grid import Grid
grid = Grid.subgrid_from_supergrid(
path="<HGRID_TRIMMED>", # path to the global supergrid
llc=(16.0, 192.0), # (l)ower (l)eft (c)orner (lat, lon)
urc=(27.0, 209.0), # (u)pper (r)ight (c)orner (lat, lon)
name="hawaii_2",
)Step 1.2: Topography¶
from CrocoDash.topo import Topo
topo = Topo(grid=grid, min_depth=9.5)bathymetry_path = "<GEBCO_LOWRES>"
topo.set_from_dataset(
bathymetry_path=bathymetry_path,
longitude_coordinate_name="lon",
latitude_coordinate_name="lat",
vertical_coordinate_name="elevation",
)topo.depth.plot()