Create ESMF mesh

Create ESMF mesh#

Use mom6_bathy to create ESMF mesh

from mom6_bathy.grid import Grid
from mom6_bathy.topo import Topo
import xarray as xr
import datetime
import warnings
warnings.filterwarnings("ignore")
today = datetime.date.today().strftime("%y%m%d")
print(today)
260305
grid = Grid.from_supergrid('../supergrid/ORCA_gridgen/ocean_hgrid_250930.nc')
topo = Topo.from_topo_file(grid, '../topography/topo.sub150.tx2_3v3.SRTM15_V2.4.edit2.SmL1.0_C1.0.nc', min_depth=9.5, varname="D_edit2")
fname_topo = "./ocean_topo_tx2_3v3_{}.nc".format(today)
topo.write_topo(fname_topo)
# SCRIP grid file (for runoff remapping, if needed):
topo.write_scrip_grid("./tx2_3v3_{}_SCRIP.nc".format(today))
# ESMF mesh file
fname_mesh = "./ESMF_mesh_tx2_3v3_{}.nc".format(today)
topo.write_esmf_mesh(fname_mesh)
fname_mesh_cfd = "./tx2_3v3_{}_ESMF_mesh.nc".format(today)
!nccopy -k cdf5 {fname_mesh} {fname_mesh_cfd}