Releases: hyriver/pynhd
Releases · hyriver/pynhd
v0.13.1
Release Notes
New Features
- Add support for all the GeoConnex web service endpoints. There are two ways to use it. For a single query, you can use the
geoconnex
function and for multiple queries, it's more efficient to use theGeoConnex
class. - Add support for passing any of the supported NLDI feature sources to the
get_basins
method of theNLDI
class. The default isnwissite
to retain backward compatibility.
Bug Fixes
- Set the type of "ReachCode" column to
str
instead ofint
inpygeoapi
andnhdplus_vaa
functions.
v0.13.0
Release Notes
New Features
- Add two new functions called
flowline_resample
andnetwork_resample
for resampling a flowline or network of flowlines based on a given spacing. This is useful for smoothing jagged flowlines similar to those in the NHDPlus database. - Add support for the new NLDI endpoint called "hydrolocation". The
NLDI
class now has two methods for getting features by coordinates:feature_byloc
andcomid_byloc
. Thefeature_byloc
method returns the flowline that is associated with the closest NHDPlus feature to the given coordinates. Thecomid_byloc
method returns a point on the closest downstream flowline to the given coordinates. - Add a new function called
pygeoapi
for calling the API in batch mode. This function accepts the input coordinates as ageopandas.GeoDataFrame
. It is more performant than calling its counteractPyGeoAPI
multiple times. It's recommended to switch to using this new batch function instead of thePyGeoAPI
class. Users just need to prepare an input data frame that has all the required service parameters as columns. - Add a new step to
prepare_nhdplus
to convertMultiLineString
toLineString
. - Add support for the
simplified
flag of NLDI'sget_basins
function. The default value isTrue
to retain the old behavior.
Breaking Changes
-
Remove caching-related arguments from all functions since now they can be set globally via three environmental variables:
HYRIVER_CACHE_NAME
: Path to the caching SQLite database.HYRIVER_CACHE_EXPIRE
: Expiration time for cached requests in seconds.HYRIVER_CACHE_DISABLE
: Disable reading/writing from/to the cache file.
You can do this like so:
import os
os.environ["HYRIVER_CACHE_NAME"] = "path/to/file.sqlite"
os.environ["HYRIVER_CACHE_EXPIRE"] = "3600"
os.environ["HYRIVER_CACHE_DISABLE"] = "true"
v0.12.2
Release Notes
New Features
- Add a new class called
NHD
for accessing the latest National Hydrography Dataset. More info regarding this data can be found here. - Add two new functions for getting cross-sections along a single flowline via
flowline_xsection
or throughout a network of flowlines vianetwork_xsection
. You can specify spacing and width parameters to control their location. For more information and examples please consult the documentations. - Add a new property to
AGRBase
calledservice_info
to include some useful info about the service includingfeature_types
which can be handy for converting numeric values of types to their string equivalent.
Internal Changes
- Use the new PyGeoAPI API.
- Refactor
prepare_nhdplus
for improving the performance and robustness of determiningtocomid
within a network of NHD flowlines. - Add empty geometries that
NLDI.getbasins
returns to the list ofnot found
IDs. This is because the NLDI service does not include non-network flowlines and instead returns an empty geometry for these flowlines. (:issue_nhd:[#48]{.title-ref})
v0.12.1
Release Notes
Internal Changes
- Use the three new
ar.retrieve_*
functions instead of the oldar.retrieve
function to improve type hinting and to make the API more consistent. - Revert to the original PyGeoAPI base URL.
v0.12.0
Release Notes
Breaking Changes
- Rewrite
ScienceBase
to make it generally usable for working with other ScienceBase items. A new function has been added for staging the Additional NHDPlus attributes items calledstage_nhdplus_attrs
. - Refactor
AGRBase
to remove unnecessary functions and make it more general. - Update
PyGeoAPI
class to conform to the newpygeoapi
API. This web service is undergoing some changes at the time of this release and API is not stable, might not work as expected. As soon as the web service is stable, a new version will be released.
New Features
- In
WaterData.byid
show a warning if there are any missing feature IDs that are requested but are not available in the dataset. - For all
by*
methods ofWaterData
throw aZeroMatched
exception if no features are found. - Add
expire_after
anddisable_caching
arguments to all functions that useasync_retriever
. Set the default request caching expiration time to never expire. You can usedisable_caching
if you don't want to use the cached responses. Please refer to documentations of the functions for more details.
Internal Changes
- Refactor
prepare_nhdplus
to reduce code complexity by grouping all the NHDPlus tools as a private class. - Modify
AGRBase
to reflect the latest API changes inpygeoogc.ArcGISRESTfull
class. - Refactor
prepare_nhdplus
by creating a private class that include all the previously used private functions. This will make the code more readable and easier to maintain. - Add all the missing types so
mypy --strict
passes.
v0.11.4
Release Notes
New Features
- Add a new argument to
NLDI.get_basins
calledsplit_catchment
which if set toTrue
will split the basin geometry at the watershed outlet.
Internal Changes
- Catch service errors in
PyGeoAPI
and show useful error messages. - Use
importlib-metadata
for getting the version insead ofpkg_resources
to decrease import time as discussed in this issue.
v0.11.3
Release Notes
Internal Changes
- More robust handling of inputs and outputs of
NLDI
's methods. - Use an alternative download link for NHDPlus VAA file on Hydroshare.
- Restructure the code base to reduce the complexity of
pynhd.py
file by dividing it into three files:pynhd
all classes that provide access to the supported web services,core
that includes base classes, andnhdplus_derived
that has functions for getting databases that provided additional attributes for the NHDPlus database.
v0.11.2
v0.11.1
Release Notes
New Features
- Add a function for getting all NHD Fcodes as a dataframe, called
nhd_fcode
. - Improve
prepare_nhdplus
function by removing all coastlines and
better detection of the terminal point in a network.
Internal Changes
- Migrate to using
AsyncRetriever
for handling communications with web services. - Catch the
ConnectionError
separately inNLDI
and raise a
ServiceError
instead. So user knows that data cannot be returned due to the out of service status of the server notZeroMatched
.
v0.11.0
Release Notes
New Features
- Add
nhdplus_vaa
to access NHDPlus Value Added Attributes for all its flowlines. - To see a list of available layers in NHDPlus HR, you can instantiate
its class without passing any argument like soNHDPlusHR()
.
Breaking Changes
- Drop support for Python 3.6 since many of the dependencies such as
xarray
andpandas
have done so.
Internal Changes
- Use persistent caching for all requests which can help speed up network responses significantly.
- Improve documnetation and testing.