model module¶
The FLDPLN model module. This module implements the FLDPLN singleton class which exposes the MATLAB functions in the fldpln_py package/library created by MATLAB. In essence, the FLDPLN class hides the conversion from Python variables to MATLAB data types in those functions.
FLDPLN
¶
A singleton class for using the fldpln_py Python package generated in MATLAB.
CreateSegmentLibrary(self, bildir, segdir, filmskfile, segshpfile, fldmn, fldmx, dh, mxht, libdir, mtype, para)
¶
Create segment-based FLDPLN library
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bildir |
str |
BIL file directory |
required |
segdir |
str |
Segment file directory |
required |
filmskfile |
str |
Spatial mask BIL file path used to limit the modeling. If no mask, set to '' |
required |
segshpfile |
str |
A shapefile that contains the segments to be used in the library. If all segments are used, set to '' |
required |
segshpfile |
dict |
Dictionary containing the shapefile information file (str): Shapefile path that contains the select subset of segments, set to '' if all segments are used segid_field (str): Field name in the shapefile that contains the segment ID seg_fldmx_field (str): Field name in the shapefile that contains the fldmx value. Set to '' if all segments use the same fldmx |
required |
fldmn |
float |
Minimum flood stage assumed, typically set to 1 centimeter or 0.0328084 foot depends on DEM's vertical unit |
required |
fldmx |
float |
Maximum stage modeled |
required |
dh |
float |
Vertical step size in DEM's vertical unit |
required |
mxht |
float |
max dem+flood height to cease flooding. Usually set 0 for no cap height |
required |
libdir |
str |
Output directory for the segment-based library |
required |
mtype |
str |
FLDPLN model type. Choose from {'hd', 'ram0', 'ram'} |
required |
para |
dict |
Dictionary containing parallelization settings when running the model. type (str): Parallelization type. Choose from {'none', 'parfor', 'parfeval'} numcores (int): Number of cores to use. Set to 0 to use all available cores worker_type (str): Type of workers, 'Processes' or 'Threads'. Default is 'Processes' as MATLAB Runtime does not support 'Threads' |
required |
Returns:
Type | Description |
---|---|
None |
No return value |
FormatSegmentLibrary(self, bildir, segdir, libdir, dirout)
¶
Reformat segment-based library for tiling and mapping
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bildir |
str |
BIL file directory |
required |
segdir |
str |
Segment file directory |
required |
libdir |
str |
Raw segment-based library directory |
required |
dirout |
str |
Output directory for the reformatted library |
required |
Returns:
Type | Description |
---|---|
None |
No return value |
GenerateSegments(self, fdrf, facf, strfac, segfac, seglen, segdir)
¶
Generate stream segments for building segment-based FLDPLN library
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fdrf |
str |
Flow direction BIL file path |
required |
facf |
str |
Flow accumulation BIL file path |
required |
strfac |
int |
Stream flow accumulation threshold (in sq. miles) for identifying stream networks |
required |
segfac |
int |
Stream flow accumulation threshold (in sq. miles) used for creating segments along stream networks |
required |
seglen |
int |
Segment length threshold (in miles) used for creating segments along stream networks |
required |
segdir |
str |
Output directory for segment files |
required |
Returns:
Type | Description |
---|---|
None |
No return value |
GenerateStreamOrder(self, bildir, segdir, segshp)
¶
Generate stream order for the segments
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bildir |
str |
BIL file directory |
required |
segdir |
str |
Segment file directory |
required |
segshp |
str |
Selected segment shapefile |
required |
Returns:
Type | Description |
---|---|
None |
No return value |
WriteSegmentFspCsvFiles(self, bildir, segdir, seg_list, outdir=None, fileType='csv')
¶
Write segment and FSP as CSV files for viewing or creating segment shapefile
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bildir |
str |
BIL file directory |
required |
segdir |
str |
Segment file directory |
required |
seg_list |
list |
List of integer segment IDs to be exported. If empty, all segments will be exported |
required |
outdir |
str |
Output directory for the CSV files. If None, the output will be saved in the segment file directory |
None |
fileType |
str |
FSP output file type. Choose from {'mat', 'csv'}. default is 'csv' |
'csv' |
Returns:
Type | Description |
---|---|
None |
No return value |