hecstac.ras package#
Submodules#
hecstac.ras.assets module#
Asset instances of HEC-RAS model files.
- class hecstac.ras.assets.BinaryLogAsset(*args, **kwargs)#
Bases:
GenericAssetBinary Log asset.
- regex_parse_str: str = '.+\\.blf$'#
- class hecstac.ras.assets.BoundaryConditionAsset(*args, **kwargs)#
Bases:
GenericAssetBoundary Condition asset.
- regex_parse_str: str = '.+\\.b\\d{2}$'#
- class hecstac.ras.assets.ColorScalesAsset(*args, **kwargs)#
Bases:
GenericAssetColor Scales file asset.
- regex_parse_str: str = '.+\\.color-scales$'#
- class hecstac.ras.assets.ComputationalLevelOutputAsset(*args, **kwargs)#
Bases:
GenericAssetComputational Level Output asset.
- regex_parse_str: str = '.+\\.hyd\\d{2}$'#
- class hecstac.ras.assets.ComputationalMessageAsset(*args, **kwargs)#
Bases:
GenericAssetComputational Message file asset.
- regex_parse_str: str = '.+\\.comp-msgs.txt$'#
- class hecstac.ras.assets.DSSAsset(*args, **kwargs)#
Bases:
GenericAssetDSS asset.
- regex_parse_str: str = '.+\\.dss$'#
- class hecstac.ras.assets.GeometricPreprocessorAsset(*args, **kwargs)#
Bases:
GenericAssetGeometric Pre-Processor asset.
- regex_parse_str: str = '.+\\.c\\d{2}$'#
- class hecstac.ras.assets.GeometryAsset(*args, **kwargs)#
Bases:
GenericAsset[GeometryFile]HEC-RAS Geometry file asset.
- PROPERTIES_WITH_GDF = ['reaches', 'junctions', 'cross_sections', 'structures']#
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- property geometry: Polygon | MultiPolygon#
Retrieves concave hull of cross-sections.
- property geometry_wgs84: Polygon | MultiPolygon#
Reproject geometry to wgs84.
- geopackage(dst, model_meta, flow_file=None, make_public=True)#
Make a geopackage for a geometry file.
- Return type:
str
- property has_1d: bool#
Check if geometry has any river centerlines.
- property has_2d: bool#
Check if geometry has any 2D areas.
- regex_parse_str: str = '.+\\.g\\d{2}$'#
- thumbnail(layers, title='Model_Thumbnail', thumbnail_dest=None, make_public=True)#
Create a thumbnail figure for a geometry file.
- Return type:
str
- class hecstac.ras.assets.GeometryHdfAsset(*args, **kwargs)#
Bases:
GenericAsset[GeometryHDFFile]HEC-RAS Geometry HDF file asset.
- bc_lines_spatial(output_crs='EPSG:4326')#
Return boundary condition line names and geometry.
- Return type:
GeoDataFrame
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- property geometry: Polygon | MultiPolygon#
Retrieves concave hull of cross-sections.
- property geometry_wgs84: Polygon | MultiPolygon#
Reproject geometry to wgs84.
- property has_1d: bool#
Check if the geometry asset has 1d geometry.
- property has_2d: bool#
Check if the geometry asset has 2d geometry.
- model_perimeter(output_crs='EPSG:4326')#
Return model perimeter from mesh areas.
- Return type:
GeoDataFrame
- property reference_line_names: list[str] | None#
Return the list of reference line names from the file.
- reference_lines_spatial(output_crs='EPSG:4326')#
Return reference line names and geometry.
- Return type:
GeoDataFrame
- reference_points_spatial(output_crs='EPSG:4326')#
Return reference point names and geometry.
- Return type:
GeoDataFrame
- regex_parse_str: str = '.+\\.g\\d{2}\\.hdf$'#
- thumbnail(layers, title='Model_Thumbnail', thumbnail_dest=None, make_public=True)#
Create a thumbnail figure for a geometry hdf file, includingvarious geospatial layers such as USGS gages, mesh areas, breaklines, and boundary condition (BC) lines.
- Parameters:
layers (list) – A list of model layers to include in the thumbnail plot. Options include “usgs_gages”, “mesh_areas”, “breaklines”, and “bc_lines”.
title (str, optional) – Title of the figure, by default “Model Thumbnail”.
thumbnail_dest (str, optional) – Directory for created thumbnails. If None then thumbnails will be exported to same level as the item.
- class hecstac.ras.assets.HydraulicDesignAsset(*args, **kwargs)#
Bases:
GenericAssetHydraulic Design asset.
- regex_parse_str: str = '.+\\.h\\d{2}$'#
- class hecstac.ras.assets.InitialConditionsFileAsset(*args, **kwargs)#
Bases:
GenericAssetInitial Conditions file asset.
- regex_parse_str: str = '.+\\.IC\\.O\\d{2}$'#
- class hecstac.ras.assets.LogAsset(*args, **kwargs)#
Bases:
GenericAssetLog asset.
- regex_parse_str: str = '.+\\.log$'#
- class hecstac.ras.assets.MiscTextFileAsset(*args, **kwargs)#
Bases:
GenericAssetMiscellaneous Text file asset.
- regex_parse_str: str = '.+\\.txt$'#
- class hecstac.ras.assets.MiscXMLFileAsset(*args, **kwargs)#
Bases:
GenericAssetMiscellaneous XML file asset.
- regex_parse_str: str = '.+\\.xml$'#
- class hecstac.ras.assets.OutputFileAsset(*args, **kwargs)#
Bases:
GenericAssetOutput RAS file asset.
- regex_parse_str: str = '.+\\.o\\d{2}$'#
- class hecstac.ras.assets.PlanAsset(*args, **kwargs)#
Bases:
GenericAsset[PlanFile]HEC-RAS Plan file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.p\\d{2}$'#
- class hecstac.ras.assets.PlanHdfAsset(*args, **kwargs)#
Bases:
GenericAsset[PlanHDFFile]HEC-RAS Plan HDF file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.p\\d{2}\\.hdf$'#
- class hecstac.ras.assets.PlanRestartFileAsset(*args, **kwargs)#
Bases:
GenericAssetRestart file for Unsteady Flow Plan asset.
- regex_parse_str: str = '.+\\.p\\d{2}\\.rst$'#
- class hecstac.ras.assets.PrjAsset(*args, **kwargs)#
Bases:
GenericAsset[CachedFile]Factory to create HEC-RAS project file assets or projection assets.
- classmethod from_dict(data)#
Subclass.
- Return type:
- regex_parse_str: str = '.+\\.[pP][rR][jJ]$'#
- class hecstac.ras.assets.ProjectAsset(*args, **kwargs)#
Bases:
GenericAsset[ProjectFile]HEC-RAS Project file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.[pP][rR][jJ]$'#
- class hecstac.ras.assets.ProjectionAsset(*args, **kwargs)#
Bases:
GenericAsset[CachedFile].prj projection file.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.[pP][rR][jJ]$'#
- class hecstac.ras.assets.QuasiUnsteadyFlowAsset(*args, **kwargs)#
Bases:
GenericAsset[QuasiUnsteadyFlowFile]HEC-RAS Quasi-Unsteady Flow file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.q\\d{2}$'#
- class hecstac.ras.assets.RasMapperBackupFileAsset(*args, **kwargs)#
Bases:
GenericAssetBackup RAS Mapper file asset.
- regex_parse_str: str = '.+\\.rasmap\\.backup$'#
- class hecstac.ras.assets.RasMapperFileAsset(*args, **kwargs)#
Bases:
GenericAssetRAS Mapper file asset.
- regex_parse_str: str = '.+\\.rasmap$'#
- class hecstac.ras.assets.RasMapperOriginalFileAsset(*args, **kwargs)#
Bases:
GenericAssetOriginal RAS Mapper file asset.
- regex_parse_str: str = '.+\\.rasmap\\.original$'#
- class hecstac.ras.assets.RestartAsset(*args, **kwargs)#
Bases:
GenericAssetRestart file asset.
- regex_parse_str: str = '.+\\.rst$'#
- class hecstac.ras.assets.RunFileAsset(*args, **kwargs)#
Bases:
GenericAssetRun file asset for steady flow analysis.
- regex_parse_str: str = '.+\\.r\\d{2}$'#
- class hecstac.ras.assets.SedimentDataAsset(*args, **kwargs)#
Bases:
GenericAssetSediment Data asset.
- regex_parse_str: str = '.+\\.s\\d{2}$'#
- class hecstac.ras.assets.SedimentOutputAsset(*args, **kwargs)#
Bases:
GenericAssetSediment Output asset.
- regex_parse_str: str = '.+\\.sed$'#
- class hecstac.ras.assets.SedimentTransportCapacityAsset(*args, **kwargs)#
Bases:
GenericAssetSediment Transport Capacity asset.
- regex_parse_str: str = '.+\\.SedCap\\d{2}$'#
- class hecstac.ras.assets.SiamInputAsset(*args, **kwargs)#
Bases:
GenericAssetSIAM Input Data file asset.
- regex_parse_str: str = '.+\\.SiamInput$'#
- class hecstac.ras.assets.SiamOutputAsset(*args, **kwargs)#
Bases:
GenericAssetSIAM Output Data file asset.
- regex_parse_str: str = '.+\\.SiamOutput$'#
- class hecstac.ras.assets.SteadyFlowAsset(*args, **kwargs)#
Bases:
GenericAsset[SteadyFlowFile]HEC-RAS Steady Flow file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.f\\d{2}$'#
- class hecstac.ras.assets.UnsteadyFlowAsset(*args, **kwargs)#
Bases:
GenericAsset[UnsteadyFlowFile]HEC-RAS Unsteady Flow file asset.
- property extra_fields: dict#
Return extra fields with added dynamic keys/values.
- regex_parse_str: str = '.+\\.u\\d{2}$'#
- class hecstac.ras.assets.UnsteadyFlowHdfAsset(*args, **kwargs)#
Bases:
GenericAsset[RASHDFFile]HEC-RAS Unsteady Flow HDF file asset.
- property extra_fields: dict#
Return extra fields when complete.
- regex_parse_str: str = '.+\\.u\\d{2}\\.hdf$'#
- class hecstac.ras.assets.UnsteadyFlowLogAsset(*args, **kwargs)#
Bases:
GenericAssetUnsteady Flow Log asset.
- regex_parse_str: str = '.+\\.bco\\d{2}$'#
- class hecstac.ras.assets.UnsteadyRunFileAsset(*args, **kwargs)#
Bases:
GenericAssetRun file for Unsteady Flow asset.
- regex_parse_str: str = '.+\\.x\\d{2}$'#
- class hecstac.ras.assets.WaterQualityAsset(*args, **kwargs)#
Bases:
GenericAssetWater Quality asset.
- regex_parse_str: str = '.+\\.w\\d{2}$'#
- class hecstac.ras.assets.WaterQualityLogAsset(*args, **kwargs)#
Bases:
GenericAssetWater Quality Log file asset.
- regex_parse_str: str = '.+\\.bco$'#
- class hecstac.ras.assets.WaterQualityRestartAsset(*args, **kwargs)#
Bases:
GenericAssetWater Quality Restart asset.
- regex_parse_str: str = '.+\\.wqrst\\d{2}$'#
- class hecstac.ras.assets.XSOutputAsset(*args, **kwargs)#
Bases:
GenericAssetCross Section Output asset.
- regex_parse_str: str = '.+\\.SedXS\\d{2}$'#
- class hecstac.ras.assets.XSOutputHeaderAsset(*args, **kwargs)#
Bases:
GenericAssetCross Section Output Header asset.
- regex_parse_str: str = '.+\\.SedHeadXS\\d{2}$'#
hecstac.ras.consts module#
Constants.
hecstac.ras.errors module#
Errors for the ras module.
- exception hecstac.ras.errors.GeometryAssetInvalidCRSError#
Bases:
ExceptionInvalid crs provided to geometry asset.
- exception hecstac.ras.errors.GeometryAssetMissingCRSError#
Bases:
ExceptionRequired crs is missing from geometry asset definition.
- exception hecstac.ras.errors.Invalid1DGeometryError#
Bases:
Exception1D geometry asset either has no cross sections or reaches.
- exception hecstac.ras.errors.InvalidStructureDataError#
Bases:
ExceptionRaised when a HEC-RAS geometry structure is invalid.
hecstac.ras.item module#
HEC-RAS STAC Item class.
- class hecstac.ras.item.RASModelItem(*args, **kwargs)#
Bases:
ItemAn object representation of a HEC-RAS model.
- HECSTAC_VERSION_KEY = 'HEC-RAS:hecstac_version'#
- MODEL_GAGES_KEY = 'HEC-RAS:gages'#
- MODEL_UNITS_KEY = 'HEC-RAS:unit_system'#
- PROJECT_DESCRIPTION_KEY = 'HEC-RAS:description'#
- PROJECT_KEY = 'HEC-RAS:project'#
- PROJECT_STATUS_KEY = 'HEC-RAS:status'#
- PROJECT_TITLE_KEY = 'HEC-RAS:project_title'#
- PROJECT_VERSION_KEY = 'HEC-RAS:version'#
- RAS_DATETIME_SOURCE_KEY = 'HEC-RAS:datetime_source'#
- RAS_HAS_1D_KEY = 'HEC-RAS:has_1d'#
- RAS_HAS_2D_KEY = 'HEC-RAS:has_2d'#
- add_asset(key, asset)#
Subclass asset then add, eagerly load metadata safely.
- add_geospatial_assets(output_prefix)#
Extract geospatial data from geometry hdf asset and adds them as Parquet assets.
- Parameters:
output_prefix (str) – Path prefix where the Parquet files will be saved.
- add_model_geopackages(dst, geometries=None, make_public=True)#
Generate model geopackage asset for each geometry file.
- Parameters:
dst (str, optional) – Directory for created geopackages.
geometries (list, optional) – A list of geometry file names to make the gpkg for.
make_public (bool, optional) – Whether to use public-style url for created assets.
- add_model_thumbnails(layers, thumbnail_dest, title_prefix='Model_Thumbnail', make_public=True)#
Generate model thumbnail asset for each geometry file.
- Parameters:
layers (list) – List of geometry layers to be included in the plot. Options include ‘mesh_areas’, ‘breaklines’, ‘bc_lines’, ‘River’, ‘XS’, ‘Structure’, and ‘Junction’
thumbnail_dest (str, optional) – Directory for created thumbnails.
title_prefix (str, optional) – Thumbnail title prefix, by default “Model_Thumbnail”.
make_public (bool, optional) – Whether to use public-style url for created assets.
- property bbox: list[float]#
Get the bounding box of the model geometry.
- property crs: CRS#
Get the authority code for the model CRS.
- property factory: AssetFactory#
Return AssetFactory for this item.
- classmethod from_dict(stac)#
Load a model from a stac item dictionary.
- Return type:
Self
- classmethod from_prj(ras_project_file, stac_id=None, crs=None, simplify_geometry=True, assets=None)#
Create a STAC item from a HEC-RAS .prj file.
- Return type:
Self- Parameters:
ras_project_file (str) – Path to the HEC-RAS project file (.prj).
stac_id (str) – ID for the STAC item. If none, ID is set to the .prj file stem (e.g., Muncie.prj -> Muncie).
crs (str, optional) – Coordinate reference system (CRS) to apply to the item. If None, the CRS will be extracted from the geometry .hdf file.
simplify_geometry (bool, optional) – Whether to simplify geometry. Defaults to True.
assets (list, optional) – List of assets to include in the STAC item. If None, all model files will be included.
- Returns:
stac – An instance of the class representing the STAC item.
- Return type:
- property geometry: dict#
Return footprint of model as a geojson.
- property geometry_assets: list[GeometryHdfAsset | GeometryAsset]#
Return any RasGeomHdf in assets.
- property gpkg_metadata: dict#
Generate metadata for the geopackage metadata table.
- property has_1d: bool#
Whether any geometry file has 2D elements.
- property has_2d: bool#
Whether any geometry file has 2D elements.
- property model_datetime: list[datetime]#
Parse datetime from model geometry and return result.
- property pf: ProjectFile#
Get a ProjectFile instance for the RAS Model .prj file.
- property pm: LocalPathManager#
Get the path manager rooted at project file’s href.
- property project_asset: ProjectAsset#
Find the project file for this model.
- property project_version#
Attempt to return the geometry used to perform the last update on the primary geometry file.
- to_dict(*args, lightweight=True, **kwargs)#
Preload fields before serializing to dict.
If lightweight=True, skip loading heavy geometry assets.
- to_file(*args, out_path=None, lightweight=True, **kwargs)#
Save the item to it’s self href.
- Return type:
None
- update_properties()#
Force recalculation of HEC-RAS properties.
- Return type:
dict
hecstac.ras.parser module#
Contains classes and methods to parse HEC-RAS files.
- class hecstac.ras.parser.CachedFile(fpath)#
Bases:
objectBase class for caching and initialization of file-based assets.
- class hecstac.ras.parser.Connection(ras_data)#
Bases:
objectHEC-RAS Connection.
- class hecstac.ras.parser.FlowChangeLocation(river=None, reach=None, rs=None, flows=None, profile_names=None)#
Bases:
objectHEC-RAS Flow Change Locations.
-
flows:
Optional[list[float]] = None#
-
profile_names:
Optional[list[str]] = None#
-
reach:
Optional[str] = None#
-
river:
Optional[str] = None#
-
rs:
Optional[str] = None#
-
flows:
- class hecstac.ras.parser.GeometryFile(fpath)#
Bases:
CachedFileHEC-RAS Geometry file asset.
- clean_polygons(polygons)#
Unpack geometry collections, make polygons valid, and remove internal rings.
- Return type:
list
- property concave_hull#
Compute and return the concave hull (polygon) for cross sections.
- property concave_hull_gdf: GeoDataFrame#
Convert shapely convave hull to geopandas.
- property connections: dict[str, Connection]#
A dictionary of the SA/2D connections contained in the HEC-RAS geometry file.
- property cross_sections: dict[str, XS]#
A dictionary of all the cross sections contained in the HEC-RAS geometry file.
- determine_junction_xs(xs_gdf, junction)#
Determine the cross sections that bound a junction.
- Return type:
GeoDataFrame
- determine_lateral_structure_xs(xs_gdf)#
Determine if the cross sections are connected to lateral structure.
Determine if the cross sections are connected to lateral structures, if they are update ‘has_lateral_structures’ to True.
- determine_xs_order(row, junction_xs)#
Detemine what order cross sections bounding a junction should be in to produce a valid polygon.
- property file_version: str#
Provide consistent syntax with RasHDFFile.
- property geom_title: str#
Return geometry title.
- property geom_version: str#
Return program version.
- property geometry_time: list[datetime]#
Get the latest node last updated entry for this geometry.
- get_subtype_gdf(subtype)#
Get a geodataframe of a specific subtype of geometry asset.
- Return type:
GeoDataFrame
- property has_1d: bool#
Check if RAS geometry has any 1D components.
- property has_2d: bool#
Check if RAS geometry has any 2D areas.
- property ic_point_names: list[str]#
A list of the initial condition point names contained in the HEC-RAS geometry file.
- iter_labeled_gdfs()#
Return gdf and associated property.
- Return type:
Iterator[tuple[str,GeoDataFrame]]
- property junction_gdf#
A GeodataFrame of the junctions contained in the HEC-RAS geometry file.
- junction_hull(xs_gdf, junction)#
Compute and return the concave hull (polygon) for a juction.
- Return type:
Polygon
- property junctions: dict[str, Junction]#
A dictionary of the junctions contained in the HEC-RAS geometry file.
- property reach_gdf#
A GeodataFrame of the reaches contained in the HEC-RAS geometry file.
- property reaches: dict[str, Reach]#
A dictionary of the reaches contained in the HEC-RAS geometry file.
- property ref_line_names: list[str]#
A list of reference line names contained in the HEC-RAS geometry file.
- property ref_point_names: list[str]#
A list of reference point names contained in the HEC-RAS geometry file.
- remove_holes(geom)#
Remove internal holes in polygons.
- property rivers: dict[str, River]#
River (class) for the rivers contained in the HEC-RAS geometry file.
- Type:
A dictionary of river_name
- property storage_areas: dict[str, StorageArea]#
A dictionary of the storage areas contained in the HEC-RAS geometry file.
- property structures: dict[str, Structure]#
A dictionary of the structures contained in the HEC-RAS geometry file.
- property structures_gdf: GeoDataFrame#
Geodataframe of all structures in the geometry text file.
- to_gpkg(gpkg_path)#
Write the HEC-RAS Geometry file to geopackage.
- Return type:
None
- unpack_geoms(geoms)#
Unpack multipolygons and geometry collections to polygon list.
- property xs_gdf: GeoDataFrame#
Geodataframe of all cross sections in the geometry text file.
- class hecstac.ras.parser.GeometryHDFFile(fpath, **kwargs)#
Bases:
PlanOrGeomHDFFileClass to parse data from Geometry HDF files.
- property cross_sections: int | None#
Return geometry cross sections.
-
hdf_object:
RasGeomHdf#
- property projection#
Return geometry projection.
- property reference_lines: GeoDataFrame | None#
Return geometry reference lines.
- property reference_points: GeoDataFrame | None#
Return geometry reference points.
- class hecstac.ras.parser.Junction(ras_data, junct)#
Bases:
objectHEC-RAS Junction.
- property downstream_reaches: str#
Downstream reaches.
- property downstream_rivers: str#
Downstream rivers.
- property gdf#
Junction geodataframe.
- property junction_lengths: str#
Junction lengths.
- property point: Point#
Junction point.
- split_lines(lines, token, idx)#
Split lines.
- Return type:
list[str]
- property upstream_reaches: str#
Upstream reaches.
- property upstream_rivers: str#
Upstream rivers.
- property x: float#
Junction x coordinate.
- property y#
Junction y coordinate.
- class hecstac.ras.parser.PlanFile(fpath)#
Bases:
CachedFileHEC-RAS Plan file asset.
- property breach_locations: dict#
Return breach locations.
Example file line: Breach Loc= , , ,True,HH_DamEmbankment
- property flow_file: str#
Return flow file.
- property geometry_file: str#
Return geometry file.
- property is_encroached: bool#
Check if any nodes are encroached.
- property plan_title: str#
Return plan title.
- property plan_version: str#
Return program version.
- property short_identifier: str#
Return short identifier.
- class hecstac.ras.parser.PlanHDFFile(fpath, **kwargs)#
Bases:
PlanOrGeomHDFFileClass to parse data from Plan HDF files.
-
hdf_object:
RasPlanHdf#
- property meteorology_data_type#
Return meteorology precip Data Type.
- property meteorology_dss_filename#
Return meteorology precip DSS Filename.
- property meteorology_dss_pathname#
Return meteorology precip DSS Pathname.
- property meteorology_mode#
Return meteorology precip Mode.
- property meteorology_raster_cellsize#
Return meteorology precip Raster Cellsize.
- property meteorology_source#
Return meteorology precip Source.
- property meteorology_units#
Return meteorology precip units.
- property plan_information_base_output_interval: str | None#
Return Base Output Interval.
- property plan_information_computation_time_step_base#
Return Computation Time Step Base.
- property plan_information_flow_filename#
Return Flow Filename.
- property plan_information_geometry_filename#
Return Geometry Filename.
- property plan_information_plan_filename#
Return Plan Filename.
- property plan_information_plan_name#
Return Plan Name.
- property plan_information_project_filename#
Return Project Filename.
- property plan_information_project_title#
Return Project Title.
- property plan_information_simulation_end_time#
Return Simulation End Time.
- property plan_information_simulation_start_time#
Return Simulation Start Time.
- property plan_parameters_1d2d_gate_flow_submergence_decay_exponent#
Return 1D-2D Gate Flow Submergence Decay Exponent.
- property plan_parameters_1d2d_is_stablity_factor#
Return 1D-2D IS Stablity Factor.
- property plan_parameters_1d2d_ls_stablity_factor#
Return 1D-2D LS Stablity Factor.
- property plan_parameters_1d2d_maximum_number_of_time_slices#
Return 1D-2D Maximum Number of Time Slices.
- property plan_parameters_1d2d_maxiter#
Return 1D2D MaxIter.
- property plan_parameters_1d2d_minimum_time_step_for_slicinghours#
Return 1D-2D Minimum Time Step for Slicing(hours).
- property plan_parameters_1d2d_number_of_warmup_steps#
Return 1D-2D Number of Warmup Steps.
- property plan_parameters_1d2d_warmup_time_step_hours#
Return 1D-2D Warmup Time Step (hours).
- property plan_parameters_1d2d_weir_flow_submergence_decay_exponent#
Return 1D-2D Weir Flow Submergence Decay Exponent.
- property plan_parameters_1d_flow_tolerance#
Return 1D Flow Tolerance.
- property plan_parameters_1d_maximum_iterations#
Return 1D Maximum Iterations.
- property plan_parameters_1d_maximum_iterations_without_improvement#
Return 1D Maximum Iterations Without Improvement.
- property plan_parameters_1d_maximum_water_surface_error_to_abort#
Return 1D Maximum Water Surface Error To Abort.
- property plan_parameters_1d_storage_area_elevation_tolerance#
Return 1D Storage Area Elevation Tolerance.
- property plan_parameters_1d_theta#
Return 1D Theta.
- property plan_parameters_1d_theta_warmup#
Return 1D Theta Warmup.
- property plan_parameters_1d_water_surface_elevation_tolerance#
Return 1D Water Surface Elevation Tolerance.
- property plan_parameters_2d_equation_set#
Return 2D Equation Set.
- property plan_parameters_2d_names#
Return 2D Names.
- property plan_parameters_2d_volume_tolerance#
Return 2D Volume Tolerance.
- property plan_parameters_2d_water_surface_tolerance#
Return 2D Water Surface Tolerance.
-
hdf_object:
- class hecstac.ras.parser.PlanOrGeomHDFFile(fpath)#
Bases:
RASHDFFileMostly geometry-accessing functions for data present in both plan and geom files.
- property bc_lines: GeoDataFrame | None#
Return boundary condition lines.
- property breaklines: GeoDataFrame | None#
Return breaklines.
- property bridges_culverts: int | None#
Return Bridge/Culvert Count.
- property connections: int | None#
Return Connection Count.
- property geometry_time: datetime | None#
Return Geometry Time.
- property geometry_version: str | None#
Return Version.
- property inline_structures: int | None#
Return Inline Structure Count.
- property landcover_date_last_modified: datetime | None#
Return Land Cover Date Last Modified.
- property landcover_filename: str | None#
Return Land Cover Filename.
- property landcover_layername: str | None#
Return Land Cover Layername.
- property lateral_structures: int | None#
Return Lateral Structure Count.
- mesh_areas(crs=None, return_gdf=False)#
Retrieve and process mesh area geometries.
- Return type:
GeoDataFrame|Polygon|MultiPolygon- Parameters:
crs (str, optional) – The coordinate reference system (CRS) to set if the mesh areas do not have one. Defaults to None
return_gdf (bool, optional) – If True, returns a GeoDataFrame of the mesh areas. If False, returns a unified Polygon or Multipolygon geometry. Defaults to False.
- property mesh_cells: GeoDataFrame | None#
Return mesh cell polygons.
- property rasmapperlibdll_date: datetime | None#
Return RasMapperLib.dll Date.
- property si_units: bool | None#
Return SI Units.
- property terrain_file_date: datetime | None#
Return Terrain File Date.
- property terrain_filename: str | None#
Return Terrain Filename.
- property terrain_layername: str | None#
Return Terrain Layername.
- property two_d_flow_cell_average_size: float | None#
Return Cell Average Size.
- property two_d_flow_cell_maximum_index: int | None#
Return Cell Maximum Index.
- property two_d_flow_cell_maximum_size: int | None#
Return Cell Maximum Size.
- property two_d_flow_cell_minimum_size: int | None#
Return Cell Minimum Size.
- class hecstac.ras.parser.ProjectFile(fpath)#
Bases:
CachedFileHEC-RAS Project file.
- property geometry_files: list[str]#
Return the geometry files.
- property plan_current: str | None#
Return the current plan.
- property plan_files: list[str]#
Return the plan files.
- property project_description: str#
Return the model description.
- property project_status: str#
Return the model status.
- property project_title: str#
Return the project title.
- property project_units: str | None#
Return the project units.
- property quasi_unsteady_flow_files: list[str]#
Return the quasisteady flow files.
- property ras_version: str | None#
Return the ras version.
- property steady_flow_files: list[str]#
Return the flow files.
- property unsteady_flow_files: list[str]#
Return the unsteady flow files.
- class hecstac.ras.parser.QuasiUnsteadyFlowFile(fpath)#
Bases:
CachedFileHEC-RAS Quasi-Unsteady Flow file data.
- class hecstac.ras.parser.RASHDFFile(fpath)#
Bases:
CachedFileBase class for parsing HDF assets (Plan and Geometry HDF files).
- property file_version: str | None#
Return File Version.
-
hdf_object:
RasHdf#
- property units_system: str | None#
Return Units System.
- class hecstac.ras.parser.Reach(ras_data, river_reach)#
Bases:
objectHEC-RAS River Reach.
- compute_multi_xs_variables(cross_sections)#
Compute variables that depend on multiple cross sections.
Set the thalweg drop, computed channel reach length and computed channel reach length ratio between a cross section and the cross section downstream.
- Return type:
dict
- property coords: list[tuple[float, float]]#
Reach coordinates.
- property cross_sections#
Cross sections.
- property gdf: GeoDataFrame#
Reach geodataframe.
- property geom#
Geometry of the reach.
- property number_of_coords: int#
Number of coordinates in reach.
- property number_of_cross_sections: int#
Number of cross sections.
- property reach_nodes: list[str]#
Reach nodes.
- property structures_gdf: GeoDataFrame#
Structures geodataframe.
- property xs_gdf: GeoDataFrame#
Cross section geodataframe.
- class hecstac.ras.parser.River(river, reaches=None)#
Bases:
objectHEC-RAS River.
- class hecstac.ras.parser.SteadyFlowFile(fpath)#
Bases:
CachedFileHEC-RAS Steady Flow file data.
- property flow_change_locations#
Retrieve flow change locations.
- property flow_title: str#
Return flow title.
- property n_flow_change_locations#
Number of flow change locations.
- property n_profiles: int#
Return number of profiles.
- property profile_names#
Profile names.
- class hecstac.ras.parser.StorageArea(ras_data)#
Bases:
objectHEC-RAS StorageArea.
- class hecstac.ras.parser.Structure(ras_data, river_reach, river, reach, us_xs)#
Bases:
objectHEC-RAS Structures.
- property distance: float#
Distance to upstream cross section.
- property distance_to_us_xs#
The distance from the upstream cross section to the start of the lateral structure.
- property gdf: GeoDataFrame#
Structure geodataframe.
- property number_of_station_elevation_points#
The number of station elevation points.
- property river_station: float#
Structure river station.
- split_structure_header(position)#
Split Structure header.
Example: Type RM Length L Ch R = 3 ,83554. ,237.02,192.39,113.07.
- Return type:
str
- property station_elevation_points#
Station elevation points.
- structure_data(position)#
Structure data.
- Return type:
str|int
- property tail_water_reach#
The tail water reache’s reach name.
- property tail_water_river#
The tail water reache’s river name.
- property tail_water_river_station#
The tail water reache’s river stationing.
- property tw_distance#
The distance between the tail water upstream cross section and the lateral weir.
- property type: StructureType#
Structure type.
- property type_int: int#
Structure type.
- property weir_length#
The length weir.
- property width: float#
Structure width.
- class hecstac.ras.parser.StructureType(value)#
Bases:
EnumStructure types.
- BRIDGE = 3#
- CULVERT = 2#
- INLINE_STRUCTURE = 5#
- LATERAL_STRUCTURE = 6#
- MULTIPLE_OPENING = 4#
- XS = 1#
- class hecstac.ras.parser.UnsteadyFlowFile(fpath)#
Bases:
CachedFileHEC-RAS Unsteady Flow file data.
- property boundary_locations: list#
Return boundary locations.
Example file line: Boundary Location= , , , , ,Perimeter 1 , ,PugetSound_Ocean_Boundary ,
- property flow_title: str#
Return flow title.
- property precip_bc#
Return precipitation boundary condition.
- property reference_lines#
Return reference lines.
- class hecstac.ras.parser.XS(ras_data, river_reach, river, reach, reach_geom=None)#
Bases:
objectHEC-RAS Cross Section.
- property bank_stations: list[str]#
Bank stations.
- property banks_encompass_channel#
A boolean; True if the channel centerlien intersects the cross section between the bank stations.
- property centerline_intersection_point#
A point located where the cross section and reach centerline intersect.
- property centerline_intersection_station#
Station along the cross section where the centerline intersects it.
- property channel_depth#
The depth of the channel; i.e., the depth at which the first bank station is overtoppped.
- property channel_obstruction#
A boolean indicating if the channel is being blocked.
A boolean indicating if ineffective flow area, blocked obstructions, or levees are contained in the channel (between bank stations).
- property channel_reach_length: float#
Cross section channel reach length.
- property channel_width#
The width of the cross section between bank points.
- property computed_river_station#
The computed river stationing according to the reach geometry.
- property contraction_coefficient#
The expansion coefficient for the cross section.
- property coords: list[tuple[float, float]] | None#
Cross section coordinates.
- property correct_cross_section_direction#
A boolean indicating if the cross section is drawn from right to left looking downstream.
- property cross_section_intersects_reach#
Detemine if the cross section intersects the reach, if not return False, otherwise return True.
- property cutline_length#
Length of the cross section bassed on the geometry (x-y coordinates).
- property expansion_coefficient#
The expansion coefficient for the cross section.
- property first_station#
First station of the cross section.
- property gdf#
Cross section geodataframe.
- property gdf_data_dict#
Cross section geodataframe.
- property geom#
Geometry of the cross section according to its coords.
- get_flow_area(wse, start=None, stop=None)#
Get the flow area of the cross-section at a given WSE.
- Return type:
float
- get_mannings_discharge(wse, slope)#
Calculate the discharge of the cross-section according to manning’s equation.
- Return type:
float
- get_wetted_perimeter(wse, start=None, stop=None)#
Get the hydraulic radius of the cross-section at a given WSE.
- Return type:
float
- property has_blocks#
A boolean indicating if the cross section contains blocked obstructions.
- property has_ineffectives#
A boolean indicating if the cross section contains ineffective flow areas.
- property has_levees#
A boolean indicating if the cross section contains levees.
- property horizontal_varying_mannings#
A boolean indicating if horizontally varied mannings values are applied.
- property htab_min_elevation#
The starting elevation for the cross section’s htab.
- property htab_min_increment#
The increment for the cross section’s htab.
- property htab_points#
The number of points on the cross section’s htab.
- property intersects_reach_once#
A boolean indicating if the cross section intersects the reach only once.
- property is_interpolated: bool#
Check if xs is interpolated.
- property last_station#
Last station of the cross section.
- property left_bank_elevation#
Elevation of the left bank station.
- property left_bank_station#
The cross sections left bank station.
- property left_max_elevation#
Max Elevation on the left side of the channel.
- property left_reach_length: float#
Cross section left reach length.
- property left_reach_length_ratio#
The ratio of the left reach length to the channel reach length.
- property mannings#
The manning’s values of the cross section.
- property mannings_code#
A code indicating what type of manning’s values are used.
0, -1 correspond to 3 value manning’s; horizontally varying manning’s values, respectively.
- property max_n#
The highest manning’s n value used in the cross section.
- property min_elevation: float#
The min elevaiton in the cross section.
- property min_elevation_in_channel#
A boolean indicating if the minimum elevation is in the channel.
- property min_n#
The lowest manning’s n value used in the cross section.
- property n_subdivisions: int#
Get the number of subdivisions (defined by manning’s n).
- property number_of_coords: int#
Number of coordinates in cross section.
- property number_of_mannings_points#
The number of mannings points in the cross section.
- property number_of_station_elevation_points: int#
Number of station elevation points.
- property overtop_elevation#
The elevation to at which the cross secition will be overtopped.
- property reach_lengths#
The reach lengths of the cross section.
- property reach_lengths_populated#
A boolean indicating if all the reach lengths are poputed.
- property right_bank_elevation#
Elevation of the right bank station.
- property right_bank_station#
The cross sections right bank station.
- property right_max_elevation#
Max Elevation on the right side of the channel.
- property right_reach_length: float#
Cross section right reach length.
- property right_reach_length_ratio#
The ratio of the right reach length to the channel reach length.
- property river_station: float#
Cross section river station.
- property river_station_str: str#
Return the river station with * for interpolated sections.
- set_bridge_xs(br)#
Set the bridge cross section attribute.
A value of 0 is added for non-bridge cross sections and 4, 3, 2, 1 are set for each of the bridge cross sections from downstream to upstream order.
- set_computed_reach_length(computed_river_station)#
Set the channel reach length computed from the reach/xs/ds_xs geometry.
- set_computed_reach_length_ratio()#
Set the ratio of the computed channel reach length to the model channel reach length.
- set_thalweg_drop(ds_thalweg)#
Set the drop in thalweg elevation between this cross section and the downstream cross section.
- property skew#
The skew applied to the cross section.
- split_xs_header(position)#
Split cross section header.
Example: Type RM Length L Ch R = 1 ,83554. ,237.02,192.39,113.07.
- property station_elevation_df#
A pandas DataFrame containing the station-elevation data of the cross section.
- property station_elevation_point_density#
The average spacing of the station-elevation points.
- property station_elevation_points: list[tuple[float, float]] | None#
Station elevation points.
- property station_length#
Length of cross section based on station-elevation data.
- property subdivision_type: int#
Get the subdivision type.
-1 seems to indicate horizontally-varied n. 0 seems to indicate subdivisions by LOB, channel, ROB.
- property subdivisions: tuple[list[float], list[float]] | None#
Get the stations corresponding to subdivision breaks, along with their roughness.
- property thalweg#
The min elevation of the channel (between bank points).
- wse_intersection_pts(wse)#
Find where the cross-section terrain intersects the water-surface elevation.
- Return type:
list[tuple[float,float]]
- property xs_length_ratio#
Ratio of the cutline length to the station length.
- property xs_max_elevation: float | None#
Cross section maximum elevation.
- hecstac.ras.parser.name_from_suffix(fpath, suffix)#
Generate a name by appending a suffix to the file stem.
- Return type:
str
hecstac.ras.utils module#
Utility functions for the hecstac ras module.
- class hecstac.ras.utils.RequireGeos(version)#
Bases:
objectUnsure.
- hecstac.ras.utils.check_xs_direction(cross_sections, reach)#
Return only cross sections that are drawn right to left looking downstream.
- hecstac.ras.utils.data_pairs_from_text_block(lines, width)#
Split lines at given width to get paired data string. Split the string in half and convert to tuple of floats.
- Return type:
list[tuple[float,float]]
- hecstac.ras.utils.data_triplets_from_text_block(lines, width)#
Split lines at given width to get paired data string. Split the string in half and convert to tuple of floats.
- Return type:
list[tuple[float]]
- hecstac.ras.utils.delimited_pairs_to_lists(lines)#
Extract subdivisions from the manning’s text block.
- Return type:
tuple[list[float],list[float]]
- hecstac.ras.utils.export_thumbnail(layers, title, crs, filepath)#
Generate a thumbnail and save it.
- hecstac.ras.utils.find_model_files(ras_prj, recursive=False, match_project_name=True)#
Find all files with the same base name and return absolute paths.
- Return type:
list[str]- Parameters:
ras_prj (str) – Path to the HEC-RAS project file (.prj).
recursive (bool, optional) – Whether to search recursively in subdirectories. Defaults to False.
match_project_name (bool, optional) – Whether to filter files by the project name (stem). Defaults to True.
- Returns:
List of absolute paths to the found model files.
- Return type:
list[str]
- hecstac.ras.utils.handle_spaces(line, lines)#
Handle spaces in the line.
- hecstac.ras.utils.handle_spaces_arround_equals(line, lines)#
Handle spaces in the line.
- Return type:
str
- hecstac.ras.utils.is_ras_prj(url)#
Check if a file is a HEC-RAS project file.
- Return type:
bool
- hecstac.ras.utils.is_unc_path(file_path)#
Check if a path is a Universal Naming Convention (UNC) network path.
- hecstac.ras.utils.multithreading_enabled(func)#
Prepare multithreading by setting the writable flags of object type ndarrays to False.
NB: multithreading also requires the GIL to be released, which is done in the C extension (ufuncs.c).
- hecstac.ras.utils.reverse(geometry, **kwargs)#
Return a copy of a Geometry with the order of coordinates reversed.
If a Geometry is a polygon with interior rings, the interior rings are also reversed.
Points are unchanged. None is returned where Geometry is None.
- Parameters:
geometry (Geometry or array_like)
**kwargs – See NumPy ufunc docs <ufuncs.kwargs> for other keyword arguments.
See also
is_ccwChecks if a Geometry is clockwise.
Examples
>>> from shapely import LineString, Polygon >>> reverse(LineString([(0, 0), (1, 2)])) <LINESTRING (1 2, 0 0)> >>> reverse(Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)])) <POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))> >>> reverse(None) is None True
- hecstac.ras.utils.search_contents(lines, search_string, token='=', expect_one=True, require_one=True, regex=False)#
Split a line by a token and returns the second half of the line if the search_string is found in the first half.
The regex option assumes that the token is included in the regex.
- Return type:
list[str] |str
- hecstac.ras.utils.text_block_from_start_end_str(start_str, end_strs, lines, additional_lines=0)#
Search for an exact match to the start_str and return all lines from there to a line that contains the end_str.
- Return type:
list[str]
- hecstac.ras.utils.text_block_from_start_str_length(start_str, number_of_lines, lines)#
Search for an exact match to the start token and return a number of lines equal to number_of_lines.
- Return type:
list[str]
- hecstac.ras.utils.text_block_from_start_str_to_empty_line(start_str, lines)#
Search for an exact match to the start_str and return all lines from there to the next empty line.
- Return type:
list[str]
- hecstac.ras.utils.validate_point(geom)#
Validate that point is of type Point. If Multipoint or Linestring create point from first coordinate pair.
Module contents#
HEC-RAS STAC Item module.