2.1.1. Domain¶
-
class
pyprom.domain.Domain(data, summits=<SummitsContainer> 0 Objects, saddles=<SaddlesContainer> 0 Objects, runoffs=<RunoffsContainer> 0 Objects, linkers=[])[source]¶ Domain object, This object contains the
pyprom.lib.containers.saddles.SaddlesContainer,pyprom.lib.containers.summits.SummitsContainer,pyprom.lib.containers.runoffs.RunoffsContainer,pyprom.lib.containers.linker.Linker, required to calculate the surface network.-
__init__(data, summits=<SummitsContainer> 0 Objects, saddles=<SaddlesContainer> 0 Objects, runoffs=<RunoffsContainer> 0 Objects, linkers=[])[source]¶ A Domain consumes either a
pyprom.lib.datamap.DataMapobject or apyprom.dataload.Loaderchild object.Parameters: - data (
pyprom.lib.datamap.DataMaporpyprom.dataload.Loader) – Datamap to be used with thisDomain - summits (
pyprom.lib.containers.summits.SummitsContainer) – Summits Container - saddles (
pyprom.lib.containers.saddles.SaddlesContainer) – Saddles Container - runoffs (
pyprom.lib.containers.runoffs.RunoffsContainer) – RunOffs Container - linkers (
pyprom.lib.containers.linker.Linker) – List of Linkers
- data (
-
__str__()¶ Returns: String representation of this object
-
__unicode__()¶ Returns: String representation of this object
-
__weakref__¶ list of weak references to the object (if defined)
-
_climb_up(point, summitHash, explored, orderedExploredPoints)[source]¶ _climb_up finds the next higher neighbor to walk up to.
Parameters: - point (
pyprom.lib.locations.gridpoint.GridPoint) – GridPoint to climb up from. - summitHash ({x: {y:
pyprom.lib.locations.gridpoint.GridPoint}}) – hash of all points of all Summits. - explored ({x: {y: bool}) – lookup hash of GridPoints that have already been explored and are therefore not to be explored again.
- orderedExploredPoints (list(tuple(x,y))) – ordered list of Explored Points
Returns: GridPoint (Next candidate), Summit (If found), dict() explored points, ordered list of explored points (x,y).
Return type: pyprom.lib.locations.gridpoint.GridPoint.pyprom.lib.locations.summit.Summit, {x: {y: bool}}, list(tuple(x,y))- point (
-
_walk(saddle, summitHash)[source]¶ Walk from HighEdge. Appends to self.linkers
Parameters: - saddle (
pyprom.lib.locations.saddle.Saddle) – Saddle to walk from. - summitHash ({x: {y:
pyprom.lib.locations.gridpoint.GridPoint}}) – hash of all points of all Summits.
- saddle (
-
detect_basin_saddles()[source]¶ This function identifies Basin Saddles, and Single Summit Saddles and disqualifies them.
-
classmethod
from_cbor(cborBinary, datamap)[source]¶ Loads a cbor binary into a Domain. This also requires a
pyprom.lib.datamap.DataMapParameters: - cborBinary (bin) – cbor of
Domaindata - datamap (
pyprom.lib.datamap.DataMap) – datamap for this Domain
Returns: - cborBinary (bin) – cbor of
-
classmethod
from_dict(domainDict, datamap)[source]¶ Loads dictionary representation into
DomainParameters: - domainDict (dict) – dict() representation of
Domain - datamap (
pyprom.lib.datamap.DataMap) – datamap for this Domain
Returns: a new Domain
Return type: - domainDict (dict) – dict() representation of
-
purge_saddles(singleSummit=True, basinSaddle=True, allBasinSaddles=False)[source]¶ Purges Non-redundant Basin Saddles and/or Single Summit linked Saddles
Parameters: - singleSummit (bool) – Purge singleSummit
pyprom.lib.locations.saddle.Saddlefrom Saddles Container - basinSaddle (bool) – Purge basinSaddle
pyprom.lib.locations.saddle.Saddlefrom Saddles Container which do not have an alternativeBasinSaddle - allBasinSaddles (bool) – Purge all
pyprom.lib.locations.saddle.Saddlefrom Saddles Container regardless of whether they have an alternativeBasinSaddle
- singleSummit (bool) – Purge singleSummit
-
classmethod
read(filename, datamap)[source]¶ Class Method for reading a Domain saved to file into a
Domain.Parameters: - filename (str) – name of file (including path) to read
- datamap (
pyprom.lib.datamap.DataMap) – Datamap for this Domain
-
run(sparse=False, superSparse=False)[source]¶ Performs discovery of
pyprom.lib.locations.saddle.Saddle,pyprom.lib.locations.summit.Summit,pyprom.lib.locations.runoff.Runoff, andpyprom.lib.containers.linker.Linker. Runs walk() and disqualifies Basin Saddles.Parameters: - sparse (bool) – just do feature discovery, and walk()
- superSparse (bool) – just do feature discovery
-
to_cbor(noWalkPath=True)[source]¶ Returns compressed cbor binary representation of this
DomainParameters: noWalkPath (bool) – exclude pyprom.lib.containers.walkpath.WalkPathfrom memberpyprom.lib.containers.linker.LinkerReturns: cbor binary of Domain
-
to_dict(noWalkPath=True)[source]¶ Returns dict representation of this
DomainParameters: noWalkPath (bool) – exclude pyprom.lib.containers.walkpath.WalkPathfrom memberpyprom.lib.containers.linker.LinkerReturns: dict() representation of DomainReturn type: dict()
-
walk()[source]¶ Helper for iterating through
pyprom.lib.containers.saddles.SaddlesContainersaddles and Walking them. This in effect discovers which Saddles are linked to which summits.
-
walkSingleSaddle(saddle)[source]¶ Perform a walk on a single saddle This still modifies internal attributes in this
DomainobjectParameters: saddle ( pyprom.lib.locations.saddle.Saddle) – Saddle to walk from.
-
write(filename, noWalkPath=True)[source]¶ Writes the contents of the
Domainto a file.Parameters: - filename (str) – name of file (including path) to write this
Domainto - noWalkPath (bool) – exclude
pyprom.lib.containers.walkpath.WalkPathfrom memberpyprom.lib.containers.linker.Linker
- filename (str) – name of file (including path) to write this
-