ripple1d.conflate package#
Submodules#
ripple1d.conflate.plotter module#
Plotting functions for geometry data.
- ripple1d.conflate.plotter.plot_conflation_results(rfc, fim_stream, key, bucket=None, s3_client=None, limit_plot_to_nearby_reaches=True)#
Create/write png to s3. The png contains RAS centerline and cross sections and nearby NWM branches.
ripple1d.conflate.rasfim module#
Conflation classes and functions.
- class ripple1d.conflate.rasfim.RasFimConflater(nwm_pq, source_model_directory, load_data=True, output_concave_hull_path=None)#
Bases:
objectConflate NWM and RAS data for a single river reach.
- Parameters:
nwm_parquet (str) – Path to the NWM Parquet file converted to parquet from: s3://noaa-nws-owp-fim/rasfim/inputs/X-National_Datasets/nwm_flows.gpkg
ras_gpkg (str) – Path to the RAS GeoPackage
load_data (bool, optional) – Load the data on initialization. Defaults to True.
- Raises:
ValueError – Required layer not found in the GeoPackage:
DriverError – Unable to read the GeoPackage:
- add_hull(xs_gdf, reach)#
Add the concave hull to the GeoDataFrame.
- check_centerline()#
Ensure that ras_centerline is available and that the centerline is specified.
Helper function.
If the centerline is not specified, the first centerline is used, with a check that there is only one centerline.
- property common_crs#
Return the common CRS for the NWM and RAS data.
- determine_station_order(xs_gdf, reach)#
Detemine the order based on stationing of the cross sections along the reach.
- ensure_data_loaded()#
Ensure that the data is loaded before accessing the properties Decorator.
- get_projected_bbox(gdf)#
Return the bounding box for the GeoDataFrame in the common CRS.
- Return type:
Polygon
- load_data()#
Load the NWM and RAS data from the GeoPackages.
- load_gpkg(gpkg)#
Load the RAS data from the GeoPackage.
- load_pq(nwm_pq)#
Load the NWM data from the Parquet file.
- property local_gages: dict#
Local gages for the NWM reaches.
- local_lakes()#
Local lakes for the NWM reaches.
- local_nwm_reaches(river_reach_name=None, buffer=0)#
NWM reaches that intersect the RAS cross sections.
- Return type:
GeoDataFrame
- property nwm_reaches#
- populate_r_station(row, assume_ft=True)#
Populate the r value for a cross section. The r value is the ratio of the station to actual cross section length.
- Return type:
str
- property primary_flow_file#
The primary flow file for the HEC-RAS Model.
- property primary_geom_file#
The primary geometry file for the HEC-RAS Model.
- property primary_plan_file#
The primary plan file for the HEC-RAS Model.
- property ras_banks#
Return the banks of the RAS cross sections.
- ras_centerline_by_river_reach_name(river_reach_name)#
Return the centerline for the specified river reach.
- Return type:
LineString
- property ras_centerlines#
- property ras_junctions#
- property ras_metadata: Polygon#
RAS metadata.
- property ras_project_file#
The source HEC-RAS project file.
- property ras_river_reach_names#
- ras_start_end_points(*args, **kwargs)#
- property ras_structures#
- property ras_xs#
- property ras_xs_bbox: Polygon#
Return the bounding box for the RAS cross sections.
- ras_xs_concave_hull(river_reach_name=None)#
Return the concave hull of the cross sections.
- Return type:
Polygon
- ras_xs_convex_hull(river_reach_name=None)#
Return the convex hull of the cross sections.
- set_ras_gpkg(ras_gpkg, load_data=True)#
Set the RAS GeoPackage and optionally load the data.
- property stac_api#
The stac_api for the HEC-RAS Model.
- property stac_collection_id#
The stac_collection_id for the HEC-RAS Model.
- property stac_item_id#
The stac_item_id for the HEC-RAS Model.
- write_hulls()#
Write the hulls to a GeoPackage.
- xs_by_river_reach_name(river_reach_name)#
Return the cross sections for the specified river reach.
- Return type:
GeoDataFrame
- ripple1d.conflate.rasfim.cacl_avg_nearest_points(reference_gdf, compare_points_gdf)#
Calculate the average distance between the reference points and the nearest points in the comparison GeoDataFrame.
- Return type:
float
- ripple1d.conflate.rasfim.convert_linestring_to_points(linestring, crs, point_spacing=5)#
Convert a LineString to a GeoDataFrame of Points.
- Return type:
GeoDataFrame
- ripple1d.conflate.rasfim.count_intersecting_lines(ras_xs, nwm_reaches)#
Return the number of intersecting lines between the RAS cross sections and the NWM reaches.
- Return type:
int
- ripple1d.conflate.rasfim.endpoints_from_multiline(mline)#
Return the start and end points of a MultiLineString.
- Return type:
Tuple[Point,Point]
- ripple1d.conflate.rasfim.ensure_geometry_column(gdf)#
Confirm that there exists a geometry column in the GeoDataFrame.
- Return type:
GeoDataFrame
- ripple1d.conflate.rasfim.get_us_most_xs_from_junction(rfc, us_river, us_reach)#
Search for river reaches at junctions and return xs closest ds reach at junciton.
- ripple1d.conflate.rasfim.map_reach_xs(rfc, reach)#
Map the upstream and downstream cross sections for the nwm reach.
TODO: This function needs helper functions to extract the datasets from the GeoDataFrames.
- Return type:
dict
- ripple1d.conflate.rasfim.nearest_line_to_point(lines, point, column_id='ID', start_reach_distance=1000000000.0)#
Return the ID of the line closest to the point.
- Return type:
int
- ripple1d.conflate.rasfim.ras_reaches_metadata(rfc, candidate_reaches, river_reach_name)#
Return the metadata for the RAS reaches.
- ripple1d.conflate.rasfim.ras_xs_geometry_data(rfc, xs_id)#
Return the geometry data (max/min xs elevation) for the specified cross section.
- Return type:
dict
- ripple1d.conflate.rasfim.walk_network(gdf, start_id, stop_id, river_reach_name)#
Walk the network from the start ID to the stop ID.
- Return type:
List[int]
Module contents#
Initialize conflate.