Skip to content

Dimensions

InvertedTruncatedCone

Calculates the volume and surface area of an inverted truncated cone.

Useful for calculating the A and H morphometry parameters for simple water bodies. Assumes only the height (i.e., depth), side slope, and surface radius of the water body are known.

Attributes:

Name Type Description
height Union[float, int]

Height of the water body from the base to surface in metres.

surface_radius Union[float, int]

Surface radius of the water body in metres.

num_vals int

The number of values to be returned by the get_volumes(), get_surface_areas(), and get_heights() methods. num_vals should be the same as the bsn_vals parameter from the &morphometry configuration block (see bsn_vals in nml.NMLMorphometry()).

side_slope Union[float, int]

Side slope of water body - the rise over run (metre/metre). Default is 1/3.

surface_elevation float

Elevation at the water body surface. Shifts the values returned by get_heights() up or down. Default is 0.0.

Examples:

Import the dimensions and nml modules:

>>> from glmpy import dimensions, nml

Consider a small circular reservoir that has a surface radius of 15m, a slide slope of 1/3, and is 3m deep:

>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=3,
...     surface_elevation=0
... )

Get a list of height values to use for the H parameter in the &morphometry configuration block by calling the get_heights() method. The length of the list is determined by the num_vals attribute:

>>> print(reservoir.get_heights())
[-3.0, -1.5, 0.0]

Get the water surface area at each of these heights by calling the get_surface_areas() method:

>>> print(reservoir.get_surface_areas())
[113.09733552923255, 346.3605900582747, 706.8583470577034]

Get the volume at each of these heights by calling the get_volumes() method:

>>> print(reservoir.get_volumes())
[0.0, 328.6891313818321, 1102.6990214100174]

Set the A, H, and bsn_vals attributes of nml.NMLMorphometry():

>>> morphometry = nml.NMLMorphometry(
...     A=ofr.get_surface_areas(),
...     H=ofr.get_heights(),
...     bsn_vals=3
... )

get_heights()

Calculates heights.

Returns a list of heights (m) from base to surface. The number of heights is determined by the num_vals attribute. Heights can be adjusted for different surface elevations by increasing or decreasing the surface_elevation attribute.

Returns:

Name Type Description
heights list

Heights (m) from base to surface.

Examples:

Get the height values for a water body that has a surface elevation of -3m:

>>> from glmpy import dimensions
>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=3,
...     surface_elevation=-3
... )
>>> print(reservoir.get_heights())
[-6.0, -4.5, -3.0]

get_surface_areas()

Calculates surface areas.

Returns a list of surface areas (m^2) that correspond with the heights returned by get_heights(). The length of the list is determined by the num_vals attribute. Surface areas are returned as a list of floats where the first item is the area at the bottom of the water body and the last is the area at the surface.

Returns:

Name Type Description
surface_areas list

Surface areas of water body (m^2).

Examples:

Get a list of 5 surface areas at each height in get_heights():

>>> from glmpy import dimensions
>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=5,
...     surface_elevation=0
... )
>>> print(reservoir.get_heights())
[-3.0, -2.25, -1.5, -0.75, 0.0]
>>> print(reservoir.get_surface_areas())
[113.09733552923255, 213.8246499849553, 346.3605900582747, 
510.70515574919074, 706.8583470577034]

Get a list of 3 surface areas at each height in get_heights():

>>> from glmpy import dimensions
>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=3,
...     surface_elevation=0
... )
>>> print(reservoir.get_heights())
[-3.0, -1.5, 0.0]
>>> print(reservoir.get_surface_areas())
[113.09733552923255, 346.3605900582747, 706.8583470577034]

get_volumes()

Calculates volumes

Returns a list of volumes (m^3) that correspond with the heights returned by get_heights(). The length of the list is determined by the num_vals attribute. Volumes are returned as a list of floats where the first item is the volume at the bottom of the water body and the last is the volume at the surface.

Returns:

Name Type Description
volume list

The water body volumes (m^3).

Examples:

Get a list of 5 volumes at each height in get_heights():

>>> from glmpy import dimensions
>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=5,
...     surface_elevation=0
... )
>>> print(reservoir.get_heights())
[-3.0, -2.25, -1.5, -0.75, 0.0]
>>> print(reservoir.get_volumes())
[0.0, 120.60770546672065, 328.6891313818321, 648.1007469585319, 
1102.6990214100174]

Get a list of 3 volumes at each height in get_heights():

>>> from glmpy import dimensions
>>> reservoir = dimensions.InvertedTruncatedCone(
...     surface_radius=15,
...     height=3,
...     side_slope=1/3,
...     num_vals=3,
...     surface_elevation=0
... )
>>> print(reservoir.get_heights())
[-3.0, -1.5, 0.0]
>>> print(reservoir.get_volumes())
[0.0, 328.6891313818321, 1102.6990214100174]

InvertedTruncatedPyramid

Calculates the volume and surface area of an inverted truncated pyramid.

Useful for calculating the A and H morphometry parameters for simple water bodies such as on-farm reservoirs. Assumes only the height (i.e., depth), side slope, surface length, and surface width of the water body are known.

Attributes:

Name Type Description
height Union[float, int]

Height of water body from the base to surface in metres.

surface_length Union[float, int]

Surface length of the water body in metres.

surface_width Union[float, int]

Surface width of the water body in metres.

num_vals int

The number of values to be returned by the get_volumes(), get_surface_areas(), and get_heights() methods. num_vals should be the same as the bsn_vals parameter from the &morphometry configuration block (see bsn_vals in MorphometryBlock).

side_slope Union[float, int]

Side slope of water body - the rise over run (metre/metre). Default is 1/3.

surface_elevation float

Elevation at the water body surface. Shifts the values returned by get_heights() up or down. Default is 0.0.

Examples:

Import the dimensions module and glm_nml sub-module:

>>> from glmpy import dimensions
>>> from glmpy.nml import glm_nml

Consider a square on-farm reservoir that is 40m long, 40m wide, 6m deep, and has a side slope of 1/3:

>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=7,
...     side_slope=1/3,
...     surface_elevation=0
... )

Get a list of height values to use for the H parameter in the &morphometry configuration block by calling the get_heights() method. The length of the list is determined by the num_vals attribute:

>>> print(ofr.get_heights())
[-6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0]

Get the water surface area at each of these heights by calling the get_surface_areas() method:

>>> print(ofr.get_surface_areas())
[16.0, 100.0, 256.0, 484.0, 784.0, 1156.0, 1600.0]

Get the volume at each of these heights by calling the get_volumes() method:

>>> print(ofr.get_volumes())
[0.0, 52.0, 224.0, 588.0, 1216.0, 2180.0, 3552.0]

Set the A, H, and bsn_vals attributes of nml.NMLMorphometry():

>>> morphometry = glm_nml.MorphometryBlock(
...     A=ofr.get_surface_areas(),
...     H=ofr.get_heights(),
...     bsn_vals=7
... )

get_heights()

Calculates heights.

Returns a list of heights (m) from base to surface. The number of heights is determined by the num_vals attribute. Heights can be adjusted for different surface elevations by increasing or decreasing the surface_elevation attribute.

Returns:

Name Type Description
heights list

Heights (m) from base to surface.

Examples:

Get the height values for a water body that has a surface elevation of -3m:

>>> from glmpy import dimensions
>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=7,
...     side_slope=1/3,
...     surface_elevation=-3
... )
>>> print(ofr.get_heights())
[-9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0]

get_surface_areas()

Calculates surface areas.

Returns a list of surface areas (m^2) that correspond with the heights returned by get_heights(). The length of the list is determined by the num_vals attribute. Surface areas are returned as a list of floats where the first item is the area at the bottom of the water body and the last is the area at the surface.

Returns:

Name Type Description
surface_areas list

Surface areas of water body (m^2).

Examples:

Get a list of 7 surface areas at each height in get_heights():

>>> from glmpy import dimensions
>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=7,
...     side_slope=1/3,
...     surface_elevation=0
... )
>>> print(ofr.get_heights())
[-6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0]
>>> print(ofr.get_surface_areas())
[16.0, 100.0, 256.0, 484.0, 784.0, 1156.0, 1600.0]

Get a list of 4 surface areas at each height in get_heights():

>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=4,
...     side_slope=1/3
... )
>>> print(ofr.get_heights())
[-6.0, -4.0, -2.0, 0.0]
>>> print(ofr.get_surface_areas())
[16.0, 256.0, 784.0, 1600.0]

get_volumes()

Calculates volumes.

Returns a list of volumes (m^3) that correspond with the heights returned by get_heights(). The length of the list is determined by the num_vals attribute. Volumes are returned as a list of floats where the first item is the volume at the bottom of the water body and the last is the volume at the surface.

Returns:

Name Type Description
volume list

The water body volumes (m^3).

Examples:

Get a list of 7 volumes at each height in get_heights():

>>> from glmpy import dimensions
>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=7,
...     side_slope=1/3,
...     surface_elevation=0
... )
>>> print(ofr.get_heights())
[-6.0, -5.0, -4.0, -3.0, -2.0, -1.0, 0.0]
>>> print(ofr.get_volumes())
[0.0, 52.0, 224.0, 588.0, 1216.0, 2180.0, 3552.0]

Get a list of 4 volumes at each height in get_heights():

>>> ofr = dimensions.InvertedTruncatedPyramid(
...     height=6,
...     surface_length=40,
...     surface_width=40,
...     num_vals=4,
...     side_slope=1/3,
...     surface_elevation=0
... )
>>> print(ofr.get_heights())
[-6.0, -4.0, -2.0, 0.0]
>>> print(ofr.get_volumes())
[0.0, 224.0, 1216.0, 3552.0]

InvertedTruncatedSquarePyramid