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.DataMap object or a pyprom.dataload.Loader child object.

Parameters:
__repr__()[source]
Returns:String representation of this object
__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:
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))

_walk(saddle, summitHash)[source]

Walk from HighEdge. Appends to self.linkers

Parameters:
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.DataMap

Parameters:
Returns:

Domain

classmethod from_dict(domainDict, datamap)[source]

Loads dictionary representation into Domain

Parameters:
Returns:

a new Domain

Return type:

Domain

purge_saddles(singleSummit=True, basinSaddle=True, allBasinSaddles=False)[source]

Purges Non-redundant Basin Saddles and/or Single Summit linked Saddles

Parameters:
classmethod read(filename, datamap)[source]

Class Method for reading a Domain saved to file into a Domain.

Parameters:
run(sparse=False, superSparse=False)[source]

Performs discovery of pyprom.lib.locations.saddle.Saddle, pyprom.lib.locations.summit.Summit, pyprom.lib.locations.runoff.Runoff, and pyprom.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 Domain

Parameters:noWalkPath (bool) – exclude pyprom.lib.containers.walkpath.WalkPath from member pyprom.lib.containers.linker.Linker
Returns:cbor binary of Domain
to_dict(noWalkPath=True)[source]

Returns dict representation of this Domain

Parameters:noWalkPath (bool) – exclude pyprom.lib.containers.walkpath.WalkPath from member pyprom.lib.containers.linker.Linker
Returns:dict() representation of Domain
Return type:dict()
walk()[source]

Helper for iterating through pyprom.lib.containers.saddles.SaddlesContainer saddles 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 Domain object

Parameters:saddle (pyprom.lib.locations.saddle.Saddle) – Saddle to walk from.
write(filename, noWalkPath=True)[source]

Writes the contents of the Domain to a file.

Parameters: