Reach-Tools Documentation

This documentation is generated from the template defined in ./docsrc/source/index.rst. This location and file is the place to start creating documentation for your project.

reStructured Text

Since not everybody knows the reStructured Text syntax cold, it does help to have a good reference or two.

NBSphinx

Since frequently Jupyter Notebooks are valuable documentation in themselves, using NBSphinx you can include them directly in the documentation. Just ensure you start the notebook with a markdown cell using a level one header (# Level One Title).

Contents

reacher_tools

Example using the Sphinx Autodoc extension to document the automatically included support library for this project located in ./src/reacher_tools.

class reach_tools.Reach(reach_id)[source]
property attributes: dict

Non-geometry properties for the reach.

property centroid

Get a point geometry centroid for the hydroline.

Returns:

Point Geometry Centroid representing the reach location as a point.

property centroid_feature: arcgis.features.Feature

Get a feature with the centroid geometry. :return: Feature with point geometry for the reach centroid.

property ewkt: str

Reach polyline geometry in EWKT format.

property extent

Provide the extent of the reach as (xmin, ymin, xmax, ymax) :return: Set (xmin, ymin, xmax, ymax)

classmethod from_aw(reach_id)[source]

Get a reach by retrieving JSON directly from American Whitewater.

Parameters:

reach_id (Union[str, int]) – American Whitewater reach ID.

Return type:

Reach

classmethod from_aw_json(raw_aw_json)[source]

Create a reach from a raw AW JSON string representation of reach data.

Parameters:

raw_aw_json (Union[str, dict]) – Raw AW JSON string representation of reach data.

Return type:

Reach

property geojson: dict

Reach polyline geometry in GeoJSON format.

property geometry: arcgis.geometry.Polyline

Reach polyline geometry.

property line_feature: arcgis.features.Feature

ArcGIS Python API Feature object for the reach.

property reach_points_dataframe

Get the reach points as an Esri Spatially Enabled Pandas DataFrame. :return:

property reach_points_features

Get all the reach points as a list of features. :return: List of ArcGIS Python API Feature objects.

property wkb: bytes

Reach polyline geometry in WKB format.

property wkt: str

Reach polyline geometry in WKT format.

class reach_tools.ReachPoint(reach_id, geometry, point_type, uid=None, subtype=None, name=None, side_of_river=None, update_date=None, notes=None, description=None, difficulty=None, **kwargs)[source]

Discrete object facilitating working with reach points.

property dictionary

Get the point as a dictionary of values making it easier to build DataFrames. :return: Dictionary of all properties, with a little modification for geometries.

property ewkt: str

Access point geometry in EWKT format.

property feature

Get the access as an ArcGIS Python API Feature object. :return: ArcGIS Python API Feature object representing the access.

property geojson: dict

Access point geometry in GeoJSON format.

property geometry

Point geometry for the access.

set_geometry(geometry)[source]

Set the geometry for the point.

Parameters:

geometry – ArcGIS Python API Point Geometry object.

set_side_of_river(side_of_river)[source]

Set the side of the river the access is located on.

Parameters:

side_of_riverleft or right when facing downstream.

property wkb: bytes

Access point geometry in WKB format.

property wkt: str

Access point geometry in WKT format.

reach_tools.utils

These utilities are included by default to speed up the development process.

reach_tools.utils.build_data_directory(dir_path)[source]

Create a directory in the specified path.

Note

If the parents for the directory path do not exist, they will automatically be created.

Parameters:

dir_path (Union[str, Path]) – Path where directory shall be created.

Return type:

Path

Returns:

Path to directory location.

reach_tools.utils.cleanup_string(input_string)[source]

Helper function to clean up description strings.

Return type:

str

reach_tools.utils.configure_logging(level='INFO', logfile_path=None, propagate=False)[source]

Get Python Logger configured to provide stream, file or, if available, ArcPy output. The way the method is set up, logging will be routed through ArcPy messaging using ArcpyHandler if ArcPy is available. If ArcPy is not available, messages will be sent to the console using a StreamHandler. Next, if the logfile_path is provided, log messages will also be written to the provided path to a logfile using a FileHandler.

Valid log_level inputs include: * DEBUG - Detailed information, typically of interest only when diagnosing problems. * INFO - Confirmation that things are working as expected. * WARNING or WARN - An indication that something unexpected happened, or indicative of some problem in the

near future (e.g. ‘disk space low’). The software is still working as expected.

  • ERROR - Due to a more serious problem, the software has not been able to perform some function.

  • CRITICAL - A serious error, indicating that the program itself may be unable to continue running.

Parameters:
  • level (Union[str, int, None]) – Logging level to use. Default is ‘INFO’.

  • logfile_path (Union[Path, str, None]) – Where to save the logfile if file output is desired.

Return type:

Logger

# only output to console and potentially Pro if ArcPy is available
configure_logging('DEBUG')
logging.debug('nauseatingly detailed debugging message')
logging.info('something actually useful to know')
logging.warning('The sky may be falling')
logging.error('The sky is falling.)
logging.critical('The sky appears to be falling because a giant meteor is colliding with the earth.')
reach_tools.utils.strip_html_tags(html)[source]

Remove HTML tags from a string.

Parameters:

html (str) – HTML string to be cleaned.

Return type:

str

Returns:

String with HTML tags removed.

Indices and tables