pyHMT2D API¶
pyHMT2D base classes, constants, and tools¶
-
class
HydraulicData
(name)¶ Hydraulic data base class
-
name
¶ name of the hydraulic mode that this data is for, e.g., SRH-2D, HEC-RAS, or just the name of the data set, e.g., terrain, flow
- Type
-
clear_data
()¶ clear the data
-
init_data
()¶ Initialize the data
-
modify_ManningsN
(materialID, newManningsNValue, materialName)¶ Modify materialID’s Manning’s n value to new value
-
reset_data
()¶ Reset the data
-
-
class
HydraulicModel
(name, version)¶ Hydraulic model base class
-
exit_model
()¶ Exit the model
-
init_model
()¶ Initialize the model
-
run_model
()¶ Run the model
-
-
gMax_Nodes_per_Element
¶ maximum number of nodes for an element
-
gMax_Elements_per_Node
¶ maximum number of elements for a node
Miscellaneous classes and tools¶
Package summary for Misc
-
class
RAS_to_SRH_Converter
(RASPlanResultFileName, RASTerrainGeoTiffFileName, SRHCaseName)[source]¶ A Python class to convert HEC-RAS case, mainly mesh and material (Manning’s n), to SRH-2D case
Typical work flow is as follows: 1. create 2D case in HEC-RAS 2. call RAS to SRH converter: create srhgeom and srhmat files 3. manually create and adjust srhhydro file 4. run SRH-2D
-
SRHCaseName
¶ Case name for SRH-2D; the resulted files will be SRHCaseName.srhgeom, SRHCaseName.srhmat
- Type
-
-
class
Terrain
(name)[source]¶ A Python class for terrain data I/O, creation, and manipulation
Typical work flow is as follows:
create the Terrain object
create the terrain (elevation, pixel_width/height): user can either call some pre-defined terrains such as constant slope, or create the terrain by themsleves and then call set_terrain(…), and set_pixel_size(…)
set the georeferencing by calling set_georeference(…)
save the terrain to file by calling save_terrain_to_file(…)
-
elevation
¶ elevation of the terrain (2D numpy array)
- Type
numpy.ndarray
-
EPSGCode
¶ EPSG (European Petroleum Survey Group) code that defines the coordinate reference system
- Type
Terrain class constructor
- Parameters
name (str) – name of the terrain
-
create_constant_slope_channel_elevation
(slope, channel_lenx, channel_leny, pixel_width, pixel_height, elevation_origin=0, extra_len=0)[source]¶ Create a constant slope channel elevation
The slope is in the x direction only. The slope in the y direction is zero.
- Parameters
slope (float) – slope in x
channel_lenx (float) – channel length in x
channel_leny (float) – channel length in y
elevation_origin (float) – the elevation at the origin (top left; does not account for the extra fringe)
extra_len (float) – optional extra fringe length added to the channel domain (to have some free room in developing 2D models in e.g., SMS or HEC-RAS.
-
get_elevation
()[source]¶ Get the elevation array
- Returns
elevation – elevation 2D array
- Return type
numpy.array
-
save_terrain_to_file
(terrainFileName, geoDriverName='GTiff')[source]¶ save terrain to file, such as GeoTiff
-
set_elevation
(elevation)[source]¶ Set the elevation array
- Parameters
elevation (numpy.ndarray) – elevation 2D array