Modify existing MOM6 grid
1. Import Modules
[1]:
%%capture
from mom6_forge.grid import Grid
from mom6_forge.topo import Topo
2. Create a MOM6 grid object from an existing supergrid
tx2_3v2 is the current MOM6-CESM workhorse grid (0.66deg, tripolar).
[2]:
grid = Grid.from_supergrid('/glade/p/cesmdata/inputdata/ocn/mom/tx2_3v2/ocean_hgrid_221123.nc')
3. Read the bathymetry
[3]:
topo = Topo.from_topo_file(grid, '/glade/p/cesmdata/inputdata/ocn/mom/tx2_3v2/ocean_topog_230413.nc')
4. Modify Depth
[4]:
%matplotlib ipympl
from mom6_forge.topo_editor import TopoEditor
TopoEditor(topo)
[4]:
5. Save the grid and bathymetry files
[5]:
# MOM6 supergrid file:
grid.write_supergrid("./ocean_hgrid_t232_modified.nc")
# MOM6 topography file:
topo.write_topo("./ocean_topog_t232_modified.nc")
# CICE grid file:
topo.write_cice_grid("./cice_grid_t232_modified.nc")
# SCRIP grid file (for runoff remapping, if needed):
topo.write_scrip_grid("./scrip_grid_t232_modified.nc")
# ESMF mesh file:
topo.write_esmf_mesh("./ESMF_mesh_t232_modified.nc")
[ ]: