i7aof.grid

High-level API for grid-related functionality. See i7aof.grid for developer details.

i7aof.grid.ismip.ensure_ismip_grid(config) str

Ensure the ISMIP grid NetCDF file exists beneath the configured workdir and return its absolute path.

Parameters:

config (mpas_tools.config.MpasConfigParser) – Configuration object. Uses [workdir] option base_dir as the root directory and [ismip_grid] options to determine the grid filename and resolution.

Returns:

Absolute path to the ISMIP grid file on disk.

Return type:

str

Notes

If the grid file does not exist, it will be created by calling write_ismip_grid() with the current working directory temporarily changed to [workdir] base_dir so the file is written under that tree.

Raises:
  • ValueError – If [workdir] base_dir is not defined in the configuration.

  • FileNotFoundError – If the grid file could not be created for any reason.

i7aof.grid.ismip.get_horiz_res_string(config)

Get the horizontal resolution string from the configuration.

Parameters:

config (mpas_tools.config.MpasConfigParser) – Configuration object with grid parameters.

Returns:

The horizontal resolution as a string.

Return type:

str

i7aof.grid.ismip.get_ismip_grid_filename(config)

Get the ISMIP grid filename from the configuration.

Parameters:

config (mpas_tools.config.MpasConfigParser) – Configuration object with grid parameters.

Returns:

The ISMIP grid filename.

Return type:

str

i7aof.grid.ismip.get_res_string(config, extrap: bool = False)

Get the resolution string from the configuration.

Parameters:
  • config (mpas_tools.config.MpasConfigParser) – Configuration object with grid parameters.

  • extrap (bool, optional) – If True, use dz_extrap for the vertical component of the resolution string.

Returns:

The resolution as a string combining horizontal and vertical resolutions.

Return type:

str

i7aof.grid.ismip.get_ver_res_string(config, extrap: bool = False)

Get the vertical resolution string from the configuration.

Parameters:
  • config (mpas_tools.config.MpasConfigParser) – Configuration object with grid parameters.

  • extrap (bool, optional) – If True, use dz_extrap instead of dz for the resolution.

Returns:

The vertical resolution as a string.

Return type:

str

i7aof.grid.ismip.write_ismip_grid(config)

Write the ISMIP grid to a NetCDF file.

Parameters:

config (mpas_tools.config.MpasConfigParser) – Configuration object with grid parameters.