mom6_bathy.topo module

class mom6_bathy.topo.Topo(grid, min_depth)

Bases: object

Bathymetry Generator for MOM6 grids (mom6_bathy.grid.Grid).

MOM6 Simpler Models bathymetry constructor.

Parameters:
  • grid (mom6_bathy.grid.Grid) – horizontal grid instance for which the bathymetry is to be created.

  • min_depth (float) – Minimum water column depth. Columns with shallow depths are to be masked out.

apply_land_frac(landfrac_filepath, landfrac_name, xcoord_name, ycoord_name, depth_fillval=0.0, cutoff_frac=0.5, method='bilinear')

Given a dataset containing land fraction, generate and apply ocean mask.

Parameters:
  • landfrac_filepath (str) – Path the netcdf file containing the land fraction field.

  • landfrac_name (str) – The field name corresponding to the land fraction (e.g., “landfrac”).

  • xcoord_name (str) – The name of the x coordinate of the landfrac dataset (e.g., “lon”).

  • ycoord_name (str) – The name of the y coordinate of the landfrac dataset (e.g., “lat”).

  • depth_fillval (float) – The depth value for dry cells.

  • cutoff_frac (float) – Cells with landfrac > cutoff_frac are deemed land cells.

  • method (str) – Mapping method for determining the ocean mask (lnd -> ocn)

apply_ridge(height, width, lon, ilat)

Apply a ridge to the bathymetry.

Parameters:
  • height (float) – Height of the ridge to be added.

  • width (float) – Width of the ridge to be added.

  • lon (float) – Longitude where the ridge is to be centered.

  • ilat (pair of integers) – Initial and final latitude indices for the ridge.

property basintmask

Ocean domain mask at T grid. Seperate number for each connected water cell, 0 if land.

property depth

MOM6 grid depth array (m). Positive below MSL.

classmethod from_topo_file(grid, topo_file_path, min_depth=0.0)

Create a bathymetry object from an existing topog file.

Parameters:
  • grid (mom6_bathy.grid.Grid) – horizontal grid instance for which the bathymetry is to be created.

  • topo_file_path (str) – Path to an existing MOM6 topog file.

  • min_depth (float, optional) – Minimum water column depth (m). Columns with shallower depths are to be masked out.

gen_topo_ds(title=None)

Write the TOPO_FILE (bathymetry file) in xarray Dataset.

Parameters:

title (str, optional) – File title.

property max_depth

Maximum water column depth.

property min_depth

Minimum water column depth. Columns with shallow depths are to be masked out.

point_is_ocean(lons, lats)

Given a list of coordinates, return a list of booleans indicating if the coordinates are in the ocean (True) or land (False)

property qmask

Ocean domain mask on Q grid. 1 if ocean, 0 if land.

set_bowl(max_depth, dedge, rad_earth=6378000.0, expdecay=400000.0)

Create a bowl-shaped bathymetry. Same effect as setting the TOPO_CONFIG parameter to “bowl”.

Parameters:
  • max_depth (float) – Maximum depth of model in the units of D.

  • dedge (float) – The depth [Z ~> m], at the basin edge

  • rad_earth (float, optional) – Radius of earth

  • expdecay (float, optional) – A decay scale of associated with the sloping boundaries [m]

set_depth_via_topog_file(topog_file_path)

Apply a bathymetry read from an existing topog file

Parameters:

topog_file_path (str) – absolute path to an existing MOM6 topog file

set_flat(D)

Create a flat bottom bathymetry with a given depth D.

Parameters:

D (float) – Bathymetric depth of the flat bottom to be generated.

set_spoon(max_depth, dedge, rad_earth=6378000.0, expdecay=400000.0)

Create a spoon-shaped bathymetry. Same effect as setting the TOPO_CONFIG parameter to “spoon”.

Parameters:
  • max_depth (float) – Maximum depth of model in the units of D.

  • dedge (float) – The depth [Z ~> m], at the basin edge

  • rad_earth (float, optional) – Radius of earth

  • expdecay (float, optional) – A decay scale of associated with the sloping boundaries [m]

property supergridmask

Ocean domain mask on supergrid. 1 if ocean, 0 if land.

property tmask

Ocean domain mask at T grid. 1 if ocean, 0 if land.

property umask

Ocean domain mask on U grid. 1 if ocean, 0 if land.

property vmask

Ocean domain mask on V grid. 1 if ocean, 0 if land.

write_cice_grid(file_path)

Write the CICE grid file in netcdf format. The written file is to be read in by CICE during runtime.

Parameters:

file_path (str) – Path to CICE grid file to be written.

write_esmf_mesh(file_path, title=None)

Write the ESMF mesh file

Parameters:
  • file_path (str) – Path to ESMF mesh file to be written.

  • title (str, optional) – File title.

write_scrip_grid(file_path, title=None)

Write the SCRIP grid file. In latest CESM versions, SCRIP grid files are no longer required and are replaced by ESMF mesh files. However, SCRIP files are still needed to generate custom ocean-runoff mapping files.

Parameters:
  • file_path (str) – Path to SCRIP file to be written.

  • title (str, optional) – File title.

write_topo(file_path, title=None)

Write the TOPO_FILE (bathymetry file) in netcdf format. The written file is to be read in by MOM6 during runtime.

Parameters:
  • file_path (str) – Path to TOPO_FILE to be written.

  • title (str, optional) – File title.