Channel Input File

File extension: cif

This file object supports spatial objects.

File Object

class gsshapy.orm.ChannelInputFile(alpha=None, beta=None, theta=None, links=None, maxNodes=None)[source]

Bases: sqlalchemy.ext.declarative.api.Base, gsshapy.base.file_base.GsshaPyFileObjectBase

Object interface for the Channel Input File.

The contents of the channel input file is abstracted into several objects including: StreamLink, UpstreamLink, StreamNode, Weir, Culvert, Reservoir, ReservoirPoint, BreakpointCS, Breakpoint, and TrapezoidalCS. See the documentation provided for each object for a more details.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing

tableName = 'cif_channel_input_files'

Database tablename

id

PK

fileExtension

STRING

projectFile

RELATIONSHIP

RELATIONSHIP

linkNodeDatasets

RELATIONSHIP

alpha

FLOAT

beta

FLOAT

theta

FLOAT

INTEGER

maxNodes

INTEGER

Retrieve only the links that represent fluvial portions of the stream. Returns a list of StreamLink instances.

Returns:A list of fluvial StreamLink objects.
Return type:list

Retrieve the links in the order of the link number.

Parameters:session (sqlalchemy.orm.session.Session) – SQLAlchemy session object bound to PostGIS enabled database.
Returns:A list of StreamLink objects.
Return type:list
getStreamNetworkAsKml(session, path=None, documentName='Stream Network', withNodes=False, styles={})[source]

Retrieve the stream network visualization in KML format.

Parameters:
  • session (sqlalchemy.orm.session.Session) – SQLAlchemy session object bound to PostGIS enabled database
  • path (str, optional) – Path to file where KML will be written. Defaults to None.
  • documentName (str, optional) – Name of the KML document. This will be the name that appears in the legend. Defaults to ‘Stream Network’.
  • withNodes (bool, optional) – Include nodes. Defaults to False.
  • styles (dict, optional) –

    Custom styles to apply to KML geometry. Defaults to empty dictionary.

    Valid keys (styles) include:
    • lineColor: tuple/list of RGBA integers (0-255) e.g.: (255, 0, 0, 128)
    • lineWidth: float line width in pixels
    • nodeIconHref: link to icon image (PNG format) to represent nodes (see: http://kml4earth.appspot.com/icons.html)
    • nodeIconScale: scale of the icon image
Returns:

KML string

Return type:

str

getStreamNetworkAsWkt(session, withNodes=True)[source]

Retrieve the stream network geometry in Well Known Text format.

Parameters:
  • session (sqlalchemy.orm.session.Session) – SQLAlchemy session object bound to PostGIS enabled database
  • withNodes (bool, optional) – Include nodes. Defaults to False.
Returns:

Well Known Text string.

Return type:

str

getStreamNetworkAsGeoJson(session, withNodes=True)[source]

Retrieve the stream network geometry in GeoJSON format.

Parameters:
  • session (sqlalchemy.orm.session.Session) – SQLAlchemy session object bound to PostGIS enabled database
  • withNodes (bool, optional) – Include nodes. Defaults to False.
Returns:

GeoJSON string.

Return type:

str

Supporting Objects

Bases: sqlalchemy.ext.declarative.api.Base, gsshapy.base.geom.GeometricObjectBase

Object containing generic stream link or reach data.

GSSHA stream networks are composed of a series of stream links and nodes. A stream link is composed of two or more nodes. A basic fluvial stream link contains the cross section. Stream links can also be used to describe structures on a stream such as culverts, weirs, or reservoirs.

This object inherits several methods from the gsshapy.orm.GeometricObjectBase base class for generating geometric visualizations.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4_-_Link_.28Reach.29_information

tableName = 'cif_links'

Database tablename

id

PK

channelInputFileID

FK

downstreamLinkID

INTEGER

INTEGER

geometry

GEOMETRY

channelInputFile

RELATIONSHIP

RELATIONSHIP

nodes

RELATIONSHIP

weirs

RELATIONSHIP

culverts

RELATIONSHIP

reservoir

RELATIONSHIP

breakpointCS

RELATIONSHIP

trapezoidalCS

RELATIONSHIP

datasets

RELATIONSHIP

linkNumber

INTEGER

type

STRING

numElements

INTEGER

dx

FLOAT

erode

BOOLEAN

subsurface

BOOLEAN

class gsshapy.orm.StreamNode(nodeNumber, x, y, elevation)[source]

Bases: sqlalchemy.ext.declarative.api.Base, gsshapy.base.geom.GeometricObjectBase

Object containing the stream node data in the channel network.

Stream nodes represent the computational unit of GSSHA stream networks. Each stream link must consist of two or more stream nodes.

This object inherits several methods from the gsshapy.orm.GeometricObjectBase base class for generating geometric visualizations.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2.1.4_Node_information

tableName = 'cif_nodes'

Database tablename

id

PK

linkID

FK

geometry

GEOMETRY

RELATIONSHIP

datasets

RELATIONSHIP

nodeNumber

INTEGER

x

FLOAT

y

FLOAT

elevation

FLOAT

Bases: sqlalchemy.ext.declarative.api.Base

Object used to map stream links with their upstream link counterparts.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.3_.E2.80.93_Channel_network_connectivity

tableName = 'cif_upstream_links'

Database tablename

id

PK

linkID

INTEGER

RELATIONSHIP

upstreamLinkID

INTEGER

class gsshapy.orm.Weir(type, crestLength, crestLowElevation, dischargeCoeffForward, dischargeCoeffReverse, crestLowLocation, steepSlope, shallowSlope)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing data that defines a weir structure for a stream link.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2_-_Structure_channel_links

tableName = 'cif_weirs'

Database tablename

id

PK

linkID

FK

RELATIONSHIP

type

STRING

crestLength

FLOAT

crestLowElevation

FLOAT

dischargeCoeffForward

FLOAT

dischargeCoeffReverse

FLOAT

crestLowLocation

FLOAT

steepSlope

FLOAT

shallowSlope

FLOAT

class gsshapy.orm.Culvert(type, upstreamInvert, downstreamInvert, inletDischargeCoeff, reverseFlowDischargeCoeff, slope, length, roughness, diameter, width, height)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing a culvert structure data for a stream link.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2_-_Structure_channel_links

tableName = 'cif_culverts'

Database tablename

id

PK

linkID

FK

RELATIONSHIP

type

STRING

upstreamInvert

FLOAT

downstreamInvert

FLOAT

inletDischargeCoeff

FLOAT

reverseFlowDischargeCoeff

FLOAT

slope

FLOAT

length

FLOAT

roughness

FLOAT

diameter

FLOAT

width

FLOAT

height

FLOAT

class gsshapy.orm.Reservoir(initWSE, minWSE, maxWSE)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing a data that defines a reservoir for a stream link.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.3_-_Reservoir_channel_links

tableName = 'cif_reservoirs'

Database tablename

id

PK

linkID

FK

RELATIONSHIP

reservoirPoints

RELATIONSHIP

initWSE

FLOAT

minWSE

FLOAT

maxWSE

FLOAT

class gsshapy.orm.ReservoirPoint(i, j)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing the cells/points that define the maximum inundation area of a reservoir.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#

tableName = 'cif_reservoir_points'

Database tablename

id

PK

reservoirID

FK

reservoir

RELATIONSHIP

i

INTEGER

j

INTEGER

class gsshapy.orm.BreakpointCS(mannings_n, numPairs, numInterp, mRiver, kRiver, erode, subsurface, maxErosion)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing breakpoint type cross section data for fluvial stream links.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2.1.2_Natural_cross-section

tableName = 'cif_breakpoint'

Database tablename

id

PK

linkID

FK

RELATIONSHIP

breakpoints

RELATIONSHIP

mannings_n

FLOAT

numPairs

INTEGER

numInterp

INTEGER

mRiver

FLOAT

kRiver

FLOAT

erode

BOOLEAN

subsurface

BOOLEAN

maxErosion

FLOAT

class gsshapy.orm.Breakpoint(x, y)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object used to define points in a BreakpointCS object.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2.1.2_Natural_cross-section

tableName = 'cif_bcs_points'

Database tablename

id

PK

crossSectionID

FK

crossSection

RELATIONSHIP

x

FLOAT

y

FLOAT

class gsshapy.orm.TrapezoidalCS(mannings_n, bottomWidth, bankfullDepth, sideSlope, mRiver, kRiver, erode, subsurface, maxErosion)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Object containing trapezoidal type cross section data for fluvial stream links.

See: http://www.gsshawiki.com/Surface_Water_Routing:Channel_Routing#5.1.4.1.4.2.1.1_Trapezoidal_cross-section

tableName = 'cif_trapezoid'

Database tablename

id

PK

linkID

FK

RELATIONSHIP

mannings_n

FLOAT

bottomWidth

FLOAT

bankfullDepth

FLOAT

sideSlope

FLOAT

mRiver

FLOAT

kRiver

FLOAT

erode

BOOLEAN

subsurface

BOOLEAN

maxErosion

BOOLEAN