ripple1d package#
Subpackages#
- ripple1d.api package
- ripple1d.conflate package
- Submodules
- ripple1d.conflate.rasfim module
RasFimConflaterRasFimConflater.add_hull()RasFimConflater.check_centerline()RasFimConflater.common_crsRasFimConflater.determine_station_order()RasFimConflater.get_nwm_reach_metadata()RasFimConflater.get_projected_bbox()RasFimConflater.load_data()RasFimConflater.load_gpkg()RasFimConflater.load_pq()RasFimConflater.local_gagesRasFimConflater.local_lakes()RasFimConflater.local_nwm_reaches()RasFimConflater.populate_r_station()RasFimConflater.primary_flow_fileRasFimConflater.primary_geom_fileRasFimConflater.primary_plan_fileRasFimConflater.ras_banksRasFimConflater.ras_centerline_by_river_reach_name()RasFimConflater.ras_centerlinesRasFimConflater.ras_junctionsRasFimConflater.ras_metadataRasFimConflater.ras_project_fileRasFimConflater.ras_river_reach_namesRasFimConflater.ras_start_end_points()RasFimConflater.ras_structuresRasFimConflater.ras_xsRasFimConflater.ras_xs_bboxRasFimConflater.ras_xs_concave_hull()RasFimConflater.ras_xs_convex_hull()RasFimConflater.set_ras_gpkg()RasFimConflater.stac_apiRasFimConflater.stac_collection_idRasFimConflater.stac_item_idRasFimConflater.unitsRasFimConflater.write_hulls()RasFimConflater.xs_by_river_reach_name()
cacl_avg_nearest_points()calculate_reach_coverage()check_for_us_xs()convert_linestring_to_points()count_intersecting_lines()endpoints_from_multiline()ensure_geometry_column()get_us_most_xs_from_junction()map_reach_xs()nearest_line_to_point()ras_reaches_metadata()ras_xs_geometry_data()retrieve_us_ds_xs()validate_reach_conflation()walk_network()
- Module contents
- ripple1d.hecstac package
- ripple1d.ops package
- Submodules
- ripple1d.ops.endpoints module
- ripple1d.ops.fim_lib module
- ripple1d.ops.metrics module
ConflationMetricsConflationMetrics.clean_length()ConflationMetrics.compute_coverage_metrics()ConflationMetrics.compute_station()ConflationMetrics.eclipsed_reaches()ConflationMetrics.length_metrics()ConflationMetrics.overlapped_reaches()ConflationMetrics.populate_station_elevation()ConflationMetrics.populate_thalweg_station()ConflationMetrics.river_lineConflationMetrics.thalweg_metrics()ConflationMetrics.us_ds_xs()
combine_reaches()compute_conflation_metrics()get_eclipsed_reaches()
- ripple1d.ops.ras_conflate module
- ripple1d.ops.ras_run module
- ripple1d.ops.ras_terrain module
- ripple1d.ops.subset_gpkg module
RippleGeopackageSubsetterRippleGeopackageSubsetter.conflation_parametersRippleGeopackageSubsetter.copy_metadata_to_ripple1d_gpkg()RippleGeopackageSubsetter.correct_ras_data()RippleGeopackageSubsetter.crsRippleGeopackageSubsetter.ds_reachRippleGeopackageSubsetter.ds_riverRippleGeopackageSubsetter.ds_river_reachRippleGeopackageSubsetter.ds_river_reach_rsRippleGeopackageSubsetter.ds_rsRippleGeopackageSubsetter.max_flowRippleGeopackageSubsetter.min_flowRippleGeopackageSubsetter.nwm_reach_modelRippleGeopackageSubsetter.reach_distance_modifiersRippleGeopackageSubsetter.rename_river_reach()RippleGeopackageSubsetter.ripple1d_parametersRippleGeopackageSubsetter.ripple_ds_xsRippleGeopackageSubsetter.ripple_gpkg_fileRippleGeopackageSubsetter.ripple_riverRippleGeopackageSubsetter.ripple_structureRippleGeopackageSubsetter.ripple_us_xsRippleGeopackageSubsetter.ripple_xsRippleGeopackageSubsetter.ripple_xs_concave_hullRippleGeopackageSubsetter.source_hullsRippleGeopackageSubsetter.source_junctionRippleGeopackageSubsetter.source_model_metadataRippleGeopackageSubsetter.source_riverRippleGeopackageSubsetter.source_structureRippleGeopackageSubsetter.source_xsRippleGeopackageSubsetter.split_source_hullRippleGeopackageSubsetter.subset_gdfsRippleGeopackageSubsetter.subset_reachesRippleGeopackageSubsetter.subset_riverRippleGeopackageSubsetter.subset_structuresRippleGeopackageSubsetter.subset_xsRippleGeopackageSubsetter.trim_reach()RippleGeopackageSubsetter.update_ds_reach_lengths()RippleGeopackageSubsetter.update_ripple1d_parameters()RippleGeopackageSubsetter.update_structure_names()RippleGeopackageSubsetter.update_xs_names()RippleGeopackageSubsetter.us_reachRippleGeopackageSubsetter.us_riverRippleGeopackageSubsetter.us_river_reachRippleGeopackageSubsetter.us_river_reach_rsRippleGeopackageSubsetter.us_rsRippleGeopackageSubsetter.write_ripple1d_parameters()RippleGeopackageSubsetter.write_ripple_gpkg()RippleGeopackageSubsetter.xs_distance_modifiers
extract_submodel()
- Module contents
- ripple1d.utils package
- Submodules
- ripple1d.utils.dg_utils module
- ripple1d.utils.gpkg_utils module
- ripple1d.utils.ripple_utils module
NWMWalkerNetworkWalkerRASWalkerassert_no_mesh_error()assert_no_ras_compute_error_message()assert_no_ras_geometry_error()assert_no_store_all_maps_error_message()check_xs_direction()clean_polygons()clip_ras_centerline()data_pairs_from_text_block()data_triplets_from_text_block()decode()determine_crs_units()determine_junction_xs()determine_xs_order()fix_reversed_xs()get_path()handle_spaces()handle_spaces_arround_equals()junction_hull()prj_is_ras()remove_holes()replace_line_in_contents()resample_vertices()search_contents()text_block_from_start_end_str()text_block_from_start_str_length()text_block_from_start_str_to_empty_line()unpack_geoms()us_ds_xs()validate_point()xs_concave_hull()
- ripple1d.utils.s3_utils module
check_s3_key_exists()copy_item_to_s3()extract_bucketname_and_keyname()get_basic_object_metadata()init_s3_resources()list_keys()list_keys_regex()read_json_from_s3()s3_delete_dir_recursively()s3_get_output_s3path()s3_get_ripple1d_status_file_key_names()s3_key_public_url_converter()s3_ripple1d_status_succeed_file_exists()s3_upload_dir_recursively()s3_upload_status_file()split_s3_key()str_from_s3()verify_safe_prefix()
- ripple1d.utils.sqlite_utils module
- ripple1d.utils.stac_utils module
- Module contents
Submodules#
ripple1d.consts module#
Constants used throughout.
ripple1d.data_model module#
Data model for shared utilities.
- class ripple1d.data_model.FlowChangeLocation(river=None, reach=None, rs=None, flows=None, profile_names=None)#
Bases:
objectHEC-RAS Flow Change Locations.
-
flows:
list[float] = None#
-
profile_names:
list[str] = None#
-
reach:
str= None#
-
river:
str= None#
-
rs:
float= None#
-
flows:
- class ripple1d.data_model.Junction(ras_data, junct, crs)#
Bases:
objectHEC-RAS Junction.
- property downstream_reaches#
Downstream reaches.
- property downstream_rivers#
Downstream rivers.
- property gdf#
Junction geodataframe.
- property junction_lengths#
Junction lengths.
- property point#
Junction point.
- split_lines(lines, token, idx)#
Split lines.
- property upstream_reaches#
Upstream reaches.
- property upstream_rivers#
Upstream rivers.
- property x#
Junction x coordinate.
- property y#
Junction y coordinate.
- class ripple1d.data_model.NwmReachModel(model_directory, library_directory='')#
Bases:
RasModelStructureNational Water Model reach-based HEC-RAS Model files and directory structure.
- property conflation_file#
Conflation file.
- property crs#
Coordinate Reference System.
- property fim_lib_assets#
Assets of the fim library.
- property fim_lib_stac_json_file#
FIM LIBRARY STAC JSON file.
- property fim_rating_curve#
FIM rating curve.
- property fim_results_database#
Results database.
- property fim_results_directory#
FIM results directory.
- property flow_extension#
Extension of the source model flow file.
- property flow_file#
Flow file of the source model.
- property model_stac_json_file#
STAC JSON file.
- property ras_terrain_hdf#
RAS Terrain HDF file.
- property ripple1d_parameters#
Ripple parameters.
- terrain_agreement_file(f)#
Terrain agreement JSON file.
- property terrain_directory#
Terrain directory.
- property units#
Units specified in the metadata of the geopackage.
- update_write_ripple1d_parameters(new_parameters)#
Write Ripple parameters.
- upload_files_to_s3(ras_s3_prefix, bucket)#
Upload the model to s3.
- upload_fim_lib_assets(s3_prefix, bucket)#
Upload the fim lib to s3.
- class ripple1d.data_model.RasModelStructure(model_directory)#
Bases:
objectBase Model structure for RAS models.
- property assets#
Model assets.
- derive_path(extension)#
Derive path.
- file_exists(file_path)#
Check if file exists.
- Return type:
bool
- property model_name#
Model name.
- property ras_gpkg_file#
RAS GeoPackage file.
- property ras_junctions#
RAS Junctions Geodataframe.
- property ras_project_file#
RAS Project file.
- property ras_rivers#
RAS Rivers Geodataframe.
- property ras_structures#
RAS Structures Geodataframe.
- property ras_xs#
RAS XS Geodataframe.
- property terrain_assets#
Terrain assets.
- property thumbnail_png#
Thumbnail PNG.
- property xs_concave_hull#
XS Concave Hull.
- class ripple1d.data_model.Reach(ras_data, river_reach, crs, units)#
Bases:
objectHEC-RAS River Reach.
- add_bridge_xs(cross_sections, bridge_xs)#
Add bridge cross sections attribute to the cross sections.
- 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#
Reach coordinates.
- property cross_sections#
Cross sections.
- property ds_xs#
Downstream cross section.
- property gdf#
Reach geodataframe.
- property geom#
Geometry of the reach.
- property number_of_coords#
Number of coordinates in reach.
- property number_of_cross_sections#
Number of cross sections.
- property reach_nodes#
Reach nodes.
- property structures#
Structures.
- property structures_gdf#
Structures geodataframe.
- property us_xs#
Upstream cross section.
- property xs_gdf#
Cross section geodataframe.
- class ripple1d.data_model.RippleSourceDirectory(source_directory, model_name)#
Bases:
objectSource Directory for Ripple to create NwmReachModel’s. Should contain the conflation.json file and gpkg file for the source model.
- property assets#
Model assets.
- property conflation_file#
Conflation file.
- derive_path(extension)#
Derive path.
- file_exists(file_path)#
Check if file exists.
- Return type:
bool
- nwm_conflation_parameters(nwm_id)#
NWM Conflation parameters.
- property ras_gpkg_file#
RAS GeoPackage file.
- property ras_project_file#
RAS Project file.
- property source_model_metadata#
Metadata for the source model.
- property terrain_assets#
Terrain assets.
- property thumbnail_png#
Thumbnail PNG.
- class ripple1d.data_model.RippleSourceModel(ras_project_file, crs)#
Bases:
objectSource Model structure for Ripple to create NwmReachModel’s.
- property assets#
Model assets.
- property conflation_file#
Conflation file.
- derive_path(extension)#
Derive path.
- file_exists(file_path)#
Check if file exists.
- Return type:
bool
- property model_name#
Model name.
- nwm_conflation_parameters(nwm_id)#
NWM Conflation parameters.
- property ras_gpkg_file#
RAS GeoPackage file.
- property terrain_assets#
Terrain assets.
- property thumbnail_png#
Thumbnail PNG.
- class ripple1d.data_model.Structure(ras_data, river_reach, river, reach, crs, us_xs)#
Bases:
objectStructure.
- property distance#
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 downstream_river_station#
The downstream head water river station of the lateral weir.
- property gdf#
Structure geodataframe.
- property multiple_xs#
A boolean indicating if the tailwater is connected to multiple cross sections.
- property number_of_station_elevation_points#
The number of station elevation points.
- property river_station#
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.
- property station_elevation_points#
Station elevation points.
- structure_data(position)#
Structure data.
- 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_ds_station#
The tail water reache’s river stationing.
- 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#
Structure type.
- property weir_length#
The length weir.
- property width#
Structure width.
- class ripple1d.data_model.XS(ras_data, river_reach, river, reach, crs, reach_geom=None, units='English')#
Bases:
objectHEC-RAS Cross Section.
- property bank_stations#
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#
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#
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 crs_units#
The units of the crs.
- 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 geom#
Geometry of the cross section according to its coords.
- property has_blocks#
A boolean indicating if the cross section contains blocked obstructions.
- property has_htab_error#
Check if min htab value is less than section invert.
- 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_increment#
Cross section minimum htab.
- 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 htab_starting_el#
Cross section minimum htab.
- property htab_string#
Cross section htab string.
- property intersects_reach_once#
A boolean indicating if the cross section intersects the reach only once.
- 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#
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#
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 number_of_coords#
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#
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#
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#
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#
Station elevation points.
- property station_length#
Length of cross section based on station-elevation data.
- property thalweg#
The min elevation of the channel (between bank points).
- property unit_conversion#
Conversion factor for units based on the model units and crs units.
- property xs_length_ratio#
Ratio of the cutline length to the station length.
- property xs_max_elevation#
Cross section maximum elevation.
ripple1d.errors module#
- exception ripple1d.errors.BadConflation#
Bases:
ExceptionRaised when conflation yields a d/s cross-section with higher station than the u/s cross-section.
- exception ripple1d.errors.CouldNotFindAnyPlansError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.CouldNotIdentifyPrimaryPlanError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.DepthGridNotFoundError#
Bases:
ExceptionRaised when a depth grid is not found when clipping raw RAS output.
- exception ripple1d.errors.FlowTitleAlreadyExistsError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.HECRASVersionNotInstalledError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.InvalidNetworkPath(us_id, ds_id, cur_id, _iter)#
Bases:
ExceptionRaised when no valid path exists between two network reaches.
- exception ripple1d.errors.InvalidStructureDataError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.ModelNotFoundError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoCRSInferredError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoCrossSectionLayerError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoDefaultEPSGError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoFlowFileSpecifiedError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoGeometryFileSpecifiedError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NoRiverLayerError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NotAPrjFile#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NotGeoreferencedError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.NullTerrainError#
Bases:
ExceptionRaised when the downloaded terrain for an error is all nodata values.
- exception ripple1d.errors.PlanNameNotFoundError#
Bases:
ExceptionRaised when a plan is not found during post processing depth grids and rating curve dbs.
- exception ripple1d.errors.PlanTitleAlreadyExistsError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.ProjectionNotFoundError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.RASComputeError#
Bases:
ExceptionRaised when *.pNN.computeMsgs.txt indicates error.
- exception ripple1d.errors.RASComputeMeshError#
Bases:
ExceptionRaised when *.pNN.computeMsgs.txt indicates mesh-specific error.
- exception ripple1d.errors.RASComputeTimeoutError#
Bases:
ExceptionRaised on timeout of API call to Compute_CurrentPlan.
- exception ripple1d.errors.RASGeometryError#
Bases:
ExceptionRaised when *.pNN.computeMsgs.txt indicates geometry-specific error.
- exception ripple1d.errors.RASStoreAllMapsError#
Bases:
ExceptionRaised when *.pNN.computeMsgs.txt indicates StoreAllMaps error (related to RAS Mapper postprocessing).
- exception ripple1d.errors.RasTerrainFailure#
Bases:
ExceptionRaised when the HEC-RAS CreateTerrain executable fails to generate terrain.
- exception ripple1d.errors.SingleXSModel#
Bases:
ExceptionRaised when geopackage creation would yield a single cross-section model.
- exception ripple1d.errors.ToManyPlansError#
Bases:
ExceptionTODO.
- exception ripple1d.errors.UnitsError#
Bases:
ExceptionRaised when units are not English.
- exception ripple1d.errors.UnknownVerticalUnits#
Bases:
ExceptionRaised when unknown vertical units are specified.
- exception ripple1d.errors.UnkownCRSUnitsError#
Bases:
ExceptionTODO.
ripple1d.ras module#
RAS Class and functions.
- class ripple1d.ras.RasFlowText(ras_text_file_path, new_file=False)#
Bases:
RasTextFileRepresents a HEC-RAS flow text file.
- property description#
Fetch the description of the flow file.
- property flow_change_locations#
Retrieve flow change locations.
- classmethod from_str(text_string, ras_text_file_path='')#
Read flow file from string.
- property n_flow_change_locations#
Number of flow change locations.
- property n_profiles#
Number of profiles.
- property profile_names#
Profile names.
- property title#
Title of the flow File.
- property version#
Program Version.
- write_discharges(flows, river, reach, river_station)#
Write discharges to flow content.
- Parameters:
flows (list) – flows to write to the flow content
river (str) – Ras river
reach (str) – Ras reach
river_station (float) – Ras river station
- write_ds_known_wse(ds_wses, river, reach)#
Write downstream known water surface elevations to flow content.
- Parameters:
ds_wses (list) – downstream known water surface elevations
river (str) – Ras river
reach (str) – Ras reach
- write_ds_normal_depth(number_of_profiles, normal_depth, river, reach)#
Write the downstream normal depth boundary condition.
- Parameters:
number_of_profiles (int) – Number of profiles
normal_depth (float) – Normal depth slope to apply to all profiles
river (str) – Ras river
reach (str) – Ras reach
- write_headers(title, profile_names, description)#
Write headers for flow content.
- Parameters:
title (str) – title of the flow
profile_names (list[str]) – profile names for the flow
- Returns:
list (list[str]): lines of the flow content
- class ripple1d.ras.RasGeomText(ras_text_file_path, crs=None, new_file=False, units='English')#
Bases:
RasTextFileRepresents a HEC-RAS geometry text file.
- property cross_sections#
- 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.
- fix_htab_errors()#
Update any htab values lower than the section invert to the section invert.
- classmethod from_gpkg(gpkg_path, title, version, ras_text_file_path='')#
Initiate the RASGeomText class from a geopackage.
- classmethod from_str(text_string, crs, ras_text_file_path='')#
Initiate the RASGeomText class from a string.
- property junction_gdf#
- property junctions#
- property n_cross_sections#
- property n_junctions#
- property n_reaches#
- property n_rivers#
- property n_structures#
- property reach_gdf#
- property reaches#
- property rivers#
- property structures#
- property structures_gdf#
- property title#
Title of the HEC-RAS Geometry file.
- to_gpkg(*args, **kwargs)#
- property version#
The HEC-RAS version.
- property xs_gdf#
- class ripple1d.ras.RasManager(ras_text_file_path, version='631', terrain_path=None, crs=None, new_project=False)#
Bases:
objectManage HEC-RAS projects.
- property current_plan#
Get the current plan.
- classmethod from_gpkg(ras_project_text_file, nwm_id, ras_gpkg_file_path, version='631', terrain_path=None)#
Create a new RasManager object from a geopackage.
- get_flows()#
Create flow objects for each flow.
- get_geoms(*args, **kwargs)#
- get_plans()#
Create plan objects for each plan.
- kwses_run(plan_flow_title, geom_title, depths, wses, flows, river, reach, us_river_station, write_depth_grids=False, show_ras=False, run_ras=True)#
Create a new known water surface elevation run.
- new_geom_from_gpkg(ras_gpkg_file_path, title)#
Create a new geometry file from a geopackage.
- normal_depth_run(plan_flow_title, geom_title, flow_change_locations, profile_names, normal_depth=0.001, write_depth_grids=False, show_ras=False, run_ras=True, flow_file_description='')#
Create a new normal depth run.
- property projection_file#
Write the current projection to file and return the file path.
- update_rasmapper_for_mapping()#
Write a rasmapper file to output depth grids for the current plan.
- write_new_plan_text_file(*args, **kwargs)#
- class ripple1d.ras.RasMap(path, geom, version=631)#
Bases:
objectRepresents a single RasMapper file.
- text_file#
- Type:
Text file repressenting the RAS Mapper file
- contents#
- Type:
a text representation of the files contents
- version#
- Type:
HEC-RAS version for this RAS Mapper file
- add_plan_layer(plan_short_id, plan_hdf, profiles)#
Add a plan layer to the results in the RASMap contents.
- Parameters:
plan_short_id (str) – plan_short_id of the plan
plan_hdf (str) – hdf file for the plan
profiles (list[str]) – profiles for the plan
- add_result_layers(plan_short_id, profiles, variable)#
Add results layers to RasMap contents. When the RAS plan is ran with “Floodplain Mapping” toggled onthe result layer added here will output rasters.
- Parameters:
plan_short_id (str) – Plan short id for the output raster(s)
profiles (list[str]) – Profiles for the output raster(s)
variable (str) – Variable to create rasters for. Currently “Depth” is the only supported variable.
- add_terrain(terrain_name, terrain_path)#
Add Terrain to RasMap content.
- new_rasmap_content(geom)#
Populate the contents with boiler plate contents.
- read_contents()#
Read contents of the file. Searches for the file locally and on s3.
- Raises:
FileNotFoundError: –
- update_crs(projection_file)#
Add/update the crs file to the RAS Mapper contents.
- Parameters:
projection_file (str) – path to projeciton file containing the coordinate system (.prj)
- Raises:
FileNotFoundError: –
- write()#
Write Ras Map contents to file.
- class ripple1d.ras.RasPlanText(ras_text_file_path, crs=None, new_file=False, units='English')#
Bases:
RasTextFileRepresents a HEC-RAS plan file.
- property flow#
Represents the HEC-RAS flow file associated with this plan.
- classmethod from_str(text_string, crs, ras_text_file_path='')#
Initiate a RasPlanText class from a string.
- property geom#
- new_plan_contents(title, short_id, flow, geom, run_rasmapper=False)#
Populate the content of the plan with basic attributes (title, short_id, flow, and geom).
- Raises:
RuntimeError – raise run time error if the plan already has content associated with it:
- new_plan_from_existing(title, short_id, geom_ext, flow_ext)#
Populate the content of the new plan with basic attributes (title, short_id, flow, and geom).
- property plan_geom_extension#
Geometry extension associated with this plan.
- property plan_geom_file#
- property plan_steady_extension#
Steady flow extension associated with this plan.
- property plan_steady_file#
- property plan_unsteady_extension#
Unsteady flow extension associated with this plan.
- property plan_unsteady_flow_file#
- read_rating_curves(profile_name_map)#
Read the flow and water surface elevations resulting from the computed plan.
- Return type:
dict- Raises:
FileNotFoundError – _description_:
- Returns:
dict: A dictionary containing “wse” and “flow” keys whose values are pandas dataframes
- property title#
Title of this HEC-RAS plan.
- property version#
HEC-RAS version.
- class ripple1d.ras.RasProject(ras_text_file_path, new_file=False)#
Bases:
RasTextFileRepresents a HEC-RAS project file.
- property current_plan#
Get the current plan.
- classmethod from_str(text_string, ras_text_file_path='')#
Initiate a RasProject class from a string.
- property geoms#
- property n_flows#
Get the number of flow files associated with this project.
- property n_geoms#
Get the number of geometry files associated with this project.
- property n_plans#
Get the number of plans associated with this project.
- property plans#
- set_current_plan(plan_ext)#
Return new contents with the specified plan as the current RAS plan.
- Parameters:
plan_ext – The plan extension to set as the current plan
- property steady_flows#
- property title#
Title of the HEC-RAS project.
- property units#
Units of the HEC-RAS project.
- property unsteady_flows#
- class ripple1d.ras.RasTextFile(ras_text_file_path, new_file=False)#
Bases:
objectRepresents a HEC-RAS text file.
- property file_extension#
Get the file extension.
- read_contents()#
Read the contents of the text file.
- write_contents()#
Write the contents of the text file.
- write_updated_contents()#
Write the updated contents of the text file.
- class ripple1d.ras.RasUnsteadyText(ras_text_file_path, new_file=False)#
Bases:
RasTextFileRepresents a HEC-RAS unsteady flow text file.
- classmethod from_str(text_string, ras_text_file_path='')#
Read flow file from string.
- property title#
Title of the flow File.
- property version#
Program Version.
- ripple1d.ras.check_crs(func)#
Check CRS decorator.
- ripple1d.ras.check_version_installed(version)#
Check version installed decorator.
- ripple1d.ras.check_windows(func)#
Check windows decorator.
- ripple1d.ras.combine_root_extension(func)#
Combine root extension decorator.
- ripple1d.ras.create_terrain(src_terrain_filepaths, projection_file, dst_terrain_filepath, vertical_units='Feet', version='631')#
Use the crs file and a list of terrain file paths to make the RAS terrain HDF file. Default location is {model_directory}TerrainTerrain.hdf.
Returns the full path to the local directory containing the output files.
- Return type:
str
- ripple1d.ras.get_new_extension_number(dict_of_ras_subclasses)#
Determine the next numeric extension that should be used when creating a new plan, flow, or geom; e.g., if you are adding a new plan and .p01, and .p02 already exists then the new planwill have a .p03 extension.
- Return type:
str- Parameters:
dict_of_ras_subclasses (dict) – A dictionary containing plan/geom/flow titles as keys and objects plan/geom/flow as values.
- Returns:
new file extension (str): The new file exension.
- ripple1d.ras.search_for_ras_crs(search_dir)#
Search for RAS crs.
ripple1d.rasmap module#
RASMap Contents.
ripple1d.ripple1d_logger module#
Logging utility an setup.
- class ripple1d.ripple1d_logger.RippleLogFormatter(datefmt='%Y-%m-%dT%H:%M:%SZ', include_traceback=True, include_fields=None, **kwargs)#
Bases:
FormatterFormat log messages as JSON-LD.
- format(record)#
Set up fine-grain format and logging options.
- ripple1d.ripple1d_logger.configure_logging(level, logfile=None, milliseconds=False, verbose=False)#
Configure logging for ripple1d.
- ripple1d.ripple1d_logger.initialize_server_logger(log_dir='', log_level=20)#
Initialize log with JSON-LD style formatting and throttled level for AWS libs.
By default sends to StreamHandler (stdout/stderr), but can provide a filename to log to disk instead.
- Return type:
Logger
ripple1d.version module#
ripple1d version.
Module contents#
Ripple1D Package.
This package provides tools and utilities for managing 1-dimensional HEC-RAS simulations.