digger.utils.tt3tools

Module Contents

Functions

tif2tt3

Convert a tif file to a tt3 format file.

rasterio2tt3

Convert formats used by rasterio to a tt3 format file.

API

digger.utils.tt3tools.tif2tt3(inpath: str, outpath: str, band: int = 1, strformat: str = '%7.5e', nanerror=True, nodata: float = -9999.0) None

Convert a tif file to a tt3 format file.

Inputs:
inpathstr

string indicating path of input tif

outpathstr

string indicating path of output .tt3

bandint

band from tif to write out (presumes that band exists)

strformatstr

string format to write in tt3 (default “%7.5e”)

nanerrorbool

if True (default) raise an error if there are any nodata values in the input tif band.

nodatafloat

if the underlying raster dataset has no nodata value set then this will cause a problem when writing to the tt3. This value is only used if nodata is not defined in the underlying tif.

Outputs:

None

digger.utils.tt3tools.rasterio2tt3(array: numpy.ndarray, transform: rasterio.Affine, outpath: str, nodata: float = -9999.0, strformat: str = '%7.5e', nanerror: bool = True) None

Convert formats used by rasterio to a tt3 format file.

Inputs:
arraynp.ndarray

numpy array representing 2d data read in by rasterio.

transformrasterio.Affine

rasterio transfrom object representing spatial extent and grid cell size.

outpathstr

string indicating path of output .tt3

nodatafloat

nodata value to check against.

strformatstr

string format to write in tt3 (default “%7.5e”)

nanerrorbool

if True (default) raise an error if there are any nodata values in the input tif band.

Outputs:

None