Skip to content
Snippets Groups Projects
Commit ffb6b1c7 authored by Wieferich, Daniel Joseph's avatar Wieferich, Daniel Joseph
Browse files

Merge branch 'hydrolink_tweaks' into 'main'

Hydrolink tweaks

See merge request !4
parents e51ebc35 5c28ed10
Branches main
No related tags found
1 merge request!4Hydrolink tweaks
# hydrolink
![Generic badge](https://img.shields.io/badge/Version-1.0.0-<COLOR>.svg)
![Generic badge](https://img.shields.io/badge/Version-1.0.1-<COLOR>.svg)
The term "hydrolink" refers to the process of linking spatial data to a stream network. This is similar to the analogy of providing an address on a road network and provides locational context and position within a stream network. Hydrolinking data to a common stream network allows information to be centralized, supporting landscape scale analyses and modeling efforts. Versions of the National Hydrography Dataset (NHD) are often used as a spatial framework for modeling and describing aquatic biological and hydrologic systems at larger geographic scales.
......@@ -21,7 +21,7 @@ Daniel Wieferich - dwieferich@usgs.gov
## USGS Software Release Information
Wieferich, D.J., Serna, B. 2023. hydrolink Version-1.0.0. U.S. Geological Survey software release. https://doi.org/10.5066/P9DGZVXW.
Wieferich, D.J., Serna, B., Labriola, L. 2023. hydrolink Version-1.0.1. U.S. Geological Survey software release. https://doi.org/10.5066/P9DGZVXW.
IP-`151836`
......
......@@ -5,4 +5,4 @@ __author__ = """Daniel J Wieferich"""
__email__ = 'dwieferich@usgs.gov'
# provide version, PEP - three components ("major.minor.micro")
__version__ = '1.0.0'
__version__ = '1.0.1'
......@@ -22,6 +22,7 @@ from shapely.geometry import Point
NHD_BASE_URL = "https://hydromaintenance.nationalmap.gov/arcgis/rest/services/HEM/NHDHigh/MapServer"
class HighResPoint:
"""Class specific for hydrolinking point data to the NHDHR."""
......@@ -114,7 +115,7 @@ class HighResPoint:
hydro_type='flowline',
outfile_name='nhdhr_hydrolink_output.csv',
similarity_cutoff=0.6
):
):
"""Build hydrolinking pipeline based on specified method and hydro_type.
Description
......@@ -150,7 +151,7 @@ class HighResPoint:
"""
# Currently these options are hard coded to force a standard approach
hydro_type_options = ['flowline','waterbody']
hydro_type_options = ['flowline', 'waterbody']
method_options = ['name_match', 'closest']
similarity_cutoff_max = 1.0
similarity_cutoff_min = 0.6
......@@ -158,15 +159,15 @@ class HighResPoint:
if hydro_type not in hydro_type_options:
self.message = f'Parameter hydro_type is restricted to options: {hydro_type_options}.'
self.error_handling()
if method not in method_options:
self.message = f'Parameter method is restricted to options: {method_options}.'
self.error_handling()
if 0.6 > similarity_cutoff or 1.0 < similarity_cutoff:
self.message = f'Parameter similarity_cutoff should be a float between min: {similarity_cutoff_min} and max: {similarity_cutoff_max}.'
self.error_handling()
if self.status == 1:
self.build_nhd_query(query=['hem_flowline', 'hem_waterbody'])
if hydro_type == 'waterbody':
......@@ -211,7 +212,7 @@ class HighResPoint:
are not currently included in the tool. In some cases these services split flowlines into multiple layers
(e.g., in-network and non-network) and will require multiple service calls (not handled in current code).
These services can be accessed at https://hydro.nationalmap.gov/arcgis/rest/services/.
"""
# hem flowlines within a buffer of coordinates
......
......@@ -23,6 +23,7 @@ from shapely.geometry import Point
NHD_BASE_URL = "https://watersgeo.epa.gov/arcgis/rest/services/NHDPlus/NHDPlus/MapServer"
class MedResPoint:
"""Class specific for hydrolinking point data to the NHDPlusV2.1."""
......@@ -143,7 +144,7 @@ class MedResPoint:
Values between 0 and 1.0, range of similarity between 0 representing no match to 1.0 being perfect match.
"""
hydro_type_options = ['flowline','waterbody']
hydro_type_options = ['flowline', 'waterbody']
method_options = ['name_match', 'closest']
similarity_cutoff_max = 1.0
similarity_cutoff_min = 0.6
......@@ -151,11 +152,11 @@ class MedResPoint:
if hydro_type not in hydro_type_options:
self.message = f'Parameter hydro_type is restricted to options: {hydro_type_options}.'
self.error_handling()
if method not in method_options:
self.message = f'Parameter method is restricted to options: {method_options}.'
self.error_handling()
if 0.6 > similarity_cutoff or 1.0 < similarity_cutoff:
self.message = f'Parameter similarity_cutoff should be a float between min: {similarity_cutoff_min} and max: {similarity_cutoff_max}.'
self.error_handling()
......
......@@ -2,4 +2,5 @@ requests==2.28.2
geopandas==0.12.2
pytest==7.2.2
black==23.1.0
validators==0.20.0
\ No newline at end of file
validators==0.20.0
bumpversion==0.6.0
\ No newline at end of file
[bumpversion]
current_version = 1.0.0
current_version = 1.0.1
commit = True
tag = True
......@@ -7,8 +7,6 @@ tag = True
[bumpversion:file:hydrolink/__init__.py]
[bumpversion:file:code.json]
[bumpversion:file:README.md]
search = Version-{current_version}
replace = Version-{new_version}
......
......@@ -38,6 +38,6 @@ setup(
test_suite='tests',
tests_require=test_requirements,
url='https://code.usgs.gov/sas/bioscience/hlt/hydrolink',
version='1.0.0',
version='1.0.1',
zip_safe=False,
)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment