io

gridkit.io.read_raster(path: str, bounds: Tuple[float, float, float, float] | None = None, bounds_crs: CRS | None = None, border_buffer: float = 0)[source]

Read data from a GeoTIFF

Parameters:
  • path (str) – The path to the file. This needs to be a file that is supported by rasterio.

  • bounds (Tuple(float, float, float, float)) – The bounds of the are of interest. Only the data within the supplied bounds is read from the input file.

  • bounds_crs (pyproj.CRS) – The Coordinte Reference System (CRS) of the supploed bounds. If the CRS of the bounds does not match that of the input files, the bounds are converted to that of the input file before reading.

  • border_buffer (int) – A buffer to apply to the supplied bounds to read in a larger slice of the area.

Returns:

The contents of the GeoTIFF in the form of a BoundedRectGrid

Return type:

BoundedRectGrid

See also

write_raster()

gridkit.io.read_geotiff(*args, bands=1, **kwargs)[source]

Deprecated, please refer to read_raster()

gridkit.io.write_raster(grid, path)[source]

Write a BoundedRectGrid to a raster file (eg .tiff).

Parameters:
  • grid (BoundedRectGrid) – The grid to write to a raster file. This can only be a BoundedRectGrid.

  • path (str) – The locatin of the file to write to (eg ./my_raster.tiff).

Returns:

The path pointing to the written file

Return type:

str

See also

read_raster()