digger.make.polyhedron

Module Contents

Functions

polyhedron

Either add or subtract a polyhedron defined by a set of planes.

API

digger.make.polyhedron.polyhedron(topo_path: str, mask_path: str, planes: list = [], sense: str = 'subtract', mask_to_water: bool = True, topo_flag: bool = True, sea_level: float = 0.0, b_prefix: str = 'b', q1_prefix: str = 'q1', eta_prefix: str = 'eta', west: float | None = None, south: float | None = None, east: float | None = None, north: float | None = None, write_tif: bool = True, write_tt3: bool = False, fig_path: str = 'polyhedron.png') None

Either add or subtract a polyhedron defined by a set of planes.

Warning

digger.make.polyhedron will only work as conceptually expected for convex polygons.

Tip

For complex modification of topography consider chaining together multiple calls to digger.make.polyhedron.

Inputs:
topo_pathstr

Path to rasterio-readable file containing the initial topography input file. Output is written at the resolution of this file. Expected in projected coordinates (e.g., meters or feet, not degrees).

mask_pathstr

Path to fiona-readable file containing polygons indicating where the polyhedron should be applied.

planeslist

A list of dictionaries each specifying a plane. The planes are specified with the following keys:

  • xyz: A tuple of x-, y-, and z-coordinate of a point the plane passes through.

  • dip_dir: The dip direction of the plane. The dip direction uses a compass angle (degrees clockwise from north) rather than a math angle (degrees counterclockwise from east).

  • dip: The dip angle from horizontal in degrees.

sensestr

Whether to add (sense="add") or subtract (sense="subtract") the generated polyhedron from the topography. If sense is "add" then the file written to b_prefix will be the provided topography and the polyhedron will be defined by volume contained underneath each plane and above the topography. In contrast, if sense is "subtract" the provided topography will be written out as eta_prefix and the polyhedron will be the volume above each plane and below the topography.

mask_to_waterbool

If True add the extent of topography less than sea_level to the mask used to define where the polyhedron is active.

sea_levelfloat

Sea level used to determine the extent of the water mask if mask_to_water=True.

topo_flagbool

If True` an additional constraint is made on where the polyhedron is active. If sense="subtract" and topo_flag=True, the polyhedron will only be considered if will lower the topography. This feature was added because of the presence of edge cases in complex topography.

If sense="add" and topo_flag=True, the polyhedron elevation will only be used only if it is higher than the topography.

q1_prefixstr

Prefix of the path to write any output of q1 (thickness, h).

eta_prefixstr

Prefix of the path to write any output of the surface altitude.

b_prefixstr

Prefix of the path to write any output of b (eta-h).

westfloat

The extent within topo_path to consider for this analysis. Along with west, east, and north, this parameter may reduce the size of the terrain consider, speeding computation time and reducing file size.

southfloat

The extent within topo_path to consider for this analysis.

eastfloat

The extent within topo_path to consider for this analysis.

northfloat

The extent within topo_path to consider for this analysis.

write_tt3bool

Whether to write out topotype 3 files b. If written, the b_prefix has ‘.tt3’ added to the end.

write_tifbool

Whether to write out geotif files of b. If written, the b_prefix has ‘.tif’ added to the end.

fig_pathstr

The base filepath for figures generated. The file extension will be used by matplotlib to determine the type of file (png, pdf, etc).

Output:

None