write_grid#

mhm_tools.common.esri_grid.write_grid(file, header, data=None, dtype='f4')[source]#

Write an ascii grid to file.

Parameters:
  • file (PathLike) – Path the the output file.

  • header (dict) – Header describing the grid.

  • data (arraylike, optional) – Data of the grid. If not given, only header will be written, by default None

  • dtype (str, optional) – Data type. Needs to be integer or float and compatible with np.dtype (i.e. “i4”, “f4”, “f8”), by default “f4”

Raises:
  • ValueError – If dtype is neither integer nor float.

  • ValueError – If data is not two dimensional.

  • ValueError – If data shape is not matching the given header.