Skip to content

tinerator.load

from_file

from_file(filepath:str, lagrit_exe=None)

Loads a DEM raster from a local filepath and returns a tinerator.DEM instance.

Arguments

  • filepath (str): Filepath to DEM raster

from_matrix

from_matrix(array:numpy.ndarray, xllcorner=0.0, yllcorner=0.0, cell_size=10.0, no_data_value=-9999)

Creates a TINerator DEM instance from a Numpy 2D matrix.

Arguments

  • array (np.ndarray): NxM Numpy matrix
  • * xllcorner (int,float): lower-left raster x-coordinate
  • * yllcorner (int,float): lower-left raster y-coordinate
  • * cell_size (int,float): raster cell size
  • * no_data_value (int,float): raster null value

  • __Note__: no_data_value cannot be np.nan.

Returns

tinerator.DEM instance

from_coordinates

from_coordinates(bounding_box, outfile=None, SRTM_30=True)

Downloads and returns a DEM from a geodetic coordinate bounding box.

This function is powered by the elevation package, and sources rasters from either SRTM 30m Global 1 arc second V003 elaborated by NASA and NGA, or SRTM 90m Digital Elevation Database v4.1 elaborated by CGIAR-CSI.

Note that note bounding box values must be latitude and longitude values given as: (left, bottom, right, top).

(Specifically, geodetic coordinates in the WGS84 reference system EPSG:4326.)

Note: if this method fails with error 'Too many tiles', try again with SRTM_30=False.

Arguments

  • bounding_box (tuple): Lat/long bounding box values
  • outfile (str): File path to save downloaded raster
  • SRTM_30 (bool): If True, use SRTM 30m. If False, SRTM 90m.

Returns

tinerator.DEM instance

from_shapefile

from_shapefile(shapefile, outfile=None, SRTM_30=True)

Downloads and returns the DEM enclosed by a shapefile.

This function is powered by the elevation package, and sources rasters from either SRTM 30m Global 1 arc second V003 elaborated by NASA and NGA, or SRTM 90m Digital Elevation Database v4.1 elaborated by CGIAR-CSI.

Note: if this method fails with error 'Too many tiles', try again with SRTM_30=False.

Arguments

  • shapefile (str): Path to ESRI Shapefile
  • outfile (str): File path to save downloaded raster
  • SRTM_30 (bool): If True, use SRTM 30m. If False, SRTM 90m.

Returns

tinerator.DEM instance