pygetm.legacy module

class pygetm.legacy.DatFile(path: str | PathLike[str])[source]

Bases: object

Support for reading GETM dat files with comments indicated by ! or #. Whitespace-only lines are skipped.

get_line() str[source]

Return next non-empty line

pygetm.legacy.domain_from_topo(path: str | PathLike[str], **kwargs) Domain[source]

Create a domain object from a topo.nc file used by legacy GETM.

Parameters:
  • path – NetCDF file with legacy domain topography

  • **kwargs – keyword arguments that are ultimately passed to pygetm.domain.Domain

Bottom roughness can be prescribed with keyword argument z0, which will be passed to pygetm.domain.Domain. This argument must be provided if the topo file does not contain bottom roughness z0. If z0 is present in the argument list as well as the topo file, the argument takes priority.

pygetm.legacy.load_bdyinfo(domain: Domain, path: str | PathLike[str], type_2d: int | None = None, type_3d: int | None = None)[source]

Add open boundaries from bdyinfo.dat to domain.

Parameters:
  • domain – domain to add open boundaries to

  • path – data file with open boundary information

  • type_2d – type of 2D open boundary condition to use. If provided, this overrides the type configured in the file.

  • type_3d – type of 3D open boundary condition to use. If provided, this overrides the type configured in the file.

pygetm.legacy.load_riverinfo(domain: Domain, path: str | PathLike[str])[source]

Add rivers from riverinfo.dat to domain

Rivers that appear multiple times in the file are meant to be split over multiple cells. For each entry of such rivers, an index is appended to the river name to generate a unique name for the cell-specific “river mouth”. The original river name and the number of cells it is split over are stored as attributes original_name and split. These attributes can be used when accessing river forcing for all mouths combined, for instance, the combined flow rate stored under original_name can be divided by split to get the flow rate for each mouth.

Parameters:
  • domain – domain to add rivers to

  • path – data file with river information