tilupy.raster

Functions

read_raster(→ list[numpy.ndarray])

Convert a raster file (tif or asc) into numpy array.

read_tiff(→ list[numpy.ndarray])

Read and convert a tiff file into numpy array.

read_ascii(→ list[numpy.ndarray])

Read and convert a ascii file into numpy array.

write_tiff(→ None)

Write tif file from numpy array.

write_ascii(→ None)

Write ascii file from numpy array.

write_raster(→ None)

Write raster file from numpy array.

Module Contents

Functions

tilupy.raster.read_raster(file: str) list[numpy.ndarray]

Convert a raster file (tif or asc) into numpy array.

Parameters:

file (str) – Path to the raster file.

Returns:

X and Y coordinates and data values in numpy array.

Return type:

list[np.ndarray]

tilupy.raster.read_tiff(file: str) list[numpy.ndarray]

Read and convert a tiff file into numpy array.

Parameters:

file (str) – Path to the tiff file.

Returns:

X and Y coordinates and data values in numpy array.

Return type:

list[np.ndarray]

tilupy.raster.read_ascii(file: str) list[numpy.ndarray]

Read and convert a ascii file into numpy array.

Parameters:

file (str) – Path to the ascii file.

Returns:

X and Y coordinates and data values in numpy array.

Return type:

list[np.ndarray]

tilupy.raster.write_tiff(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, file_out: str, **kwargs) None

Write tif file from numpy array.

Parameters:
  • x (np.ndarray) – X coordinates.

  • y (np.ndarray) – Y coordinates.

  • z (np.ndarray) – Elevation values.

  • file_out (str) – Name of the output folder.

tilupy.raster.write_ascii(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, file_out: str) None

Write ascii file from numpy array.

Parameters:
  • x (np.ndarray) – X coordinates.

  • y (np.ndarray) – Y coordinates.

  • z (np.ndarray) – Elevation values.

  • file_out (str) – Name of the output folder.

tilupy.raster.write_raster(x: numpy.ndarray, y: numpy.ndarray, z: numpy.ndarray, file_out: str, fmt: str = None, **kwargs) None

Write raster file from numpy array.

Parameters:
  • x (np.ndarray) – X coordinates.

  • y (np.ndarray) – Y coordinates.

  • z (np.ndarray) – Elevation values.

  • file_out (str) – Name of the output folder.

  • fmt (str) – Wanted format : “asc”, “ascii”, “txt”, “tif”, “tiff”.

Raises:

ValueError – If invalid format.