pygeoc.TauDEM module¶
TauDEM Utility Class.
Thanks to the open-source software TauDEM by David Tarboton and QSWAT by Chris George.
@author: Liangjun Zhu
@changlog:
- 12-04-12 jz - origin version.
- 16-07-01 lj - reorganized for pygeoc.
- 17-06-25 lj - check by pylint and reformat by Google style.
-
class
pygeoc.TauDEM.TauDEM¶ Bases:
objectMethods for calling TauDEM executables.
-
static
aread8(np, flowdir, acc, outlet=None, streamskeleton=None, edgecontaimination=False, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run Accumulate area according to D8 flow direction
-
static
areadinf(np, angfile, sca, outlet=None, wg=None, edgecontaimination=False, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run Accumulate area according to Dinf flow direction
-
static
check_infile_and_wp(curinf, curwp)¶ Check the existence of the given file and directory path. 1. Raise Runtime exception of both not existed. 2. If the
curwpis None, the set the base folder ofcurinfto it.
-
static
connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Reads an ad8 contributing area file, identifies the location of the largest ad8 value as the outlet of the largest watershed
-
static
convertdistmethod(method_str)¶ Convert distance method to h, v, p, and s.
-
static
convertstatsmethod(method_str)¶ Convert statistics method to ave, min, and max.
-
static
d8distdowntostream(np, p, fel, src, dist, distancemethod, thresh, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run D8 distance down to stream by different method for distance. This function is extended from d8hdisttostrm by Liangjun.
Please clone TauDEM by lreis2415 and compile for this program.
-
static
d8flowdir(np, filleddem, flowdir, slope, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run D8 flow direction
-
static
d8hdisttostrm(np, p, src, dist, thresh, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run D8 horizontal distance down to stream.
-
static
dinfdistdown(np, ang, fel, slp, src, statsm, distm, edgecontamination, wg, dist, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run D-inf distance down to stream
-
static
dinfflowdir(np, filleddem, flowangle, slope, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run Dinf flow direction
-
static
dropanalysis(np, fel, p, ad8, ssa, outlet, minthresh, maxthresh, numthresh, logspace, drp, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Drop analysis for optimal threshold for extracting stream.
-
static
error(msg, log_file=None)¶ Print, output error message and raise RuntimeError.
-
static
gridnet(np, pfile, plenfile, tlenfile, gordfile, outlet=None, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run gridnet
-
static
log(lines, log_file=None)¶ Output log message.
-
static
moveoutletstostrm(np, flowdir, streamRaster, outlet, modifiedOutlet, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run move the given outlets to stream
-
static
peukerdouglas(np, fel, streamSkeleton, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run peuker-douglas function
-
static
pitremove(np, dem, filleddem, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run pit remove using the flooding approach
-
static
run(function_name, in_files, wp=None, in_params=None, out_files=None, mpi_params=None, log_params=None)¶ Run TauDEM function.
- The command will not execute if any input file does not exist.
- An error will be detected after running the TauDEM command if any output file does not exist;
参数: - function_name (str) – Full path of TauDEM function.
- in_files (dict, required) –
Dict of pairs of parameter id (string) and file path (string or list) for input files, e.g.:
{'-z': '/full/path/to/dem.tif'}
- wp (str, optional) – Workspace for outputs. If not specified, the directory of the
first input file in
in_fileswill be used. - in_params (dict, optional) –
Dict of pairs of parameter id (string) and value (or None for a flag parameter without a value) for input parameters, e.g.:
{'-nc': None} {'-thresh': threshold} {'-m': 'ave' 's', '-nc': None}
- out_files (dict, optional) –
Dict of pairs of parameter id (string) and file path (string or list) for output files, e.g.:
{'-fel': 'filleddem.tif'} {'-maxS': ['harden.tif', 'maxsimi.tif']}
- mpi_params (dict, optional) –
Dict of pairs of parameter id (string) and value or path for MPI setting, e.g.:
{'mpipath':'/soft/bin','hostfile':'/soft/bin/cluster.node','n':4} {'mpipath':'/soft/bin', 'n':4} {'n':4}
- log_params (dict, optional) –
Dict of pairs of parameter id (string) and value or path for runtime and log output parameters. e.g.:
{'logfile': '/home/user/log.txt', 'runtimefile': '/home/user/runtime.txt'}
返回: True if TauDEM run successfully, otherwise False.
-
static
streamnet(np, filleddem, flowdir, acc, streamRaster, modifiedOutlet, streamOrder, chNetwork, chCoord, streamNet, subbasin, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run streamnet
-
static
threshold(np, acc, stream_raster, threshold=100.0, workingdir=None, mpiexedir=None, exedir=None, log_file=None, runtime_file=None, hostfile=None)¶ Run threshold for stream raster
-
static
write_time_log(logfile, time)¶ Write time log.
-
static
-
class
pygeoc.TauDEM.TauDEMFilesUtils(tau_dir)¶ Bases:
objectpredefined TauDEM resulted file names