Releases: hyriver/pynhd
Releases · hyriver/pynhd
v0.13.5
Release Notes
Breaking Changes
- Append "Error" to all exception classes for conforming to PEP-8 naming conventions.
Internal Changes
- Bump the minimum versions of
pygeoogcandpygeoutilsto 0.13.5 and that ofasync-retrieverto 0.3.5.
Bug Fixes
- Fix an issue in
nhdplus_vaaandenhd_attrsfunctions where ifcachefolder does not exist, it would not have been created, thus resulting to an error.
v0.13.3
Release Notes
Internal Changes
- Use the new
async_retriever.stream_writefunction to download files innhdplus_vaaandenhd_attrsfunctions. This is more memory efficient. - Convert the type of list of not found items in
NLDI.comid_bylocandNLDI.feature_bylocto list of tuples of coordinates from list of strings. This matches the type of returned not found coordinates to that of the inputs. - Fix an issue with NLDI that was caused by the recent changes in the NLDI web service's error handling. The NLDI web service now returns more descriptive error messages in a
jsonformat instead of returning the usual status errors. - Slice the ENHD dataframe in
NHDTools.clean_flowlinesbefore updating the flowline dataframe to reduce the required memory for theupdateoperation.
v0.13.2
Release Notes
Breaking Changes
- Set the minimum supported version of Python to 3.8 since many of the dependencies such as
xarray,pandas,rioxarrayhave dropped support for Python 3.7.
Internal Changes
- Use micromamba for running tests and use nox for linting in CI.
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
geoconnexfunction and for multiple queries, it's more efficient to use theGeoConnexclass. - Add support for passing any of the supported NLDI feature sources to the
get_basinsmethod of theNLDIclass. The default isnwissiteto retain backward compatibility.
Bug Fixes
- Set the type of "ReachCode" column to
strinstead ofintinpygeoapiandnhdplus_vaafunctions.
v0.13.0
Release Notes
New Features
- Add two new functions called
flowline_resampleandnetwork_resamplefor 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
NLDIclass now has two methods for getting features by coordinates:feature_bylocandcomid_byloc. Thefeature_bylocmethod returns the flowline that is associated with the closest NHDPlus feature to the given coordinates. Thecomid_bylocmethod returns a point on the closest downstream flowline to the given coordinates. - Add a new function called
pygeoapifor calling the API in batch mode. This function accepts the input coordinates as ageopandas.GeoDataFrame. It is more performant than calling its counteractPyGeoAPImultiple times. It's recommended to switch to using this new batch function instead of thePyGeoAPIclass. Users just need to prepare an input data frame that has all the required service parameters as columns. - Add a new step to
prepare_nhdplusto convertMultiLineStringtoLineString. - Add support for the
simplifiedflag of NLDI'sget_basinsfunction. The default value isTrueto 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
NHDfor 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_xsectionor 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
AGRBasecalledservice_infoto include some useful info about the service includingfeature_typeswhich can be handy for converting numeric values of types to their string equivalent.
Internal Changes
- Use the new PyGeoAPI API.
- Refactor
prepare_nhdplusfor improving the performance and robustness of determiningtocomidwithin a network of NHD flowlines. - Add empty geometries that
NLDI.getbasinsreturns to the list ofnot foundIDs. 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.retrievefunction 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
ScienceBaseto 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
AGRBaseto remove unnecessary functions and make it more general. - Update
PyGeoAPIclass to conform to the newpygeoapiAPI. 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.byidshow a warning if there are any missing feature IDs that are requested but are not available in the dataset. - For all
by*methods ofWaterDatathrow aZeroMatchedexception if no features are found. - Add
expire_afteranddisable_cachingarguments to all functions that useasync_retriever. Set the default request caching expiration time to never expire. You can usedisable_cachingif you don't want to use the cached responses. Please refer to documentations of the functions for more details.
Internal Changes
- Refactor
prepare_nhdplusto reduce code complexity by grouping all the NHDPlus tools as a private class. - Modify
AGRBaseto reflect the latest API changes inpygeoogc.ArcGISRESTfullclass. - Refactor
prepare_nhdplusby 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 --strictpasses.
v0.11.4
Release Notes
New Features
- Add a new argument to
NLDI.get_basinscalledsplit_catchmentwhich if set toTruewill split the basin geometry at the watershed outlet.
Internal Changes
- Catch service errors in
PyGeoAPIand show useful error messages. - Use
importlib-metadatafor getting the version insead ofpkg_resourcesto 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.pyfile by dividing it into three files:pynhdall classes that provide access to the supported web services,corethat includes base classes, andnhdplus_derivedthat has functions for getting databases that provided additional attributes for the NHDPlus database.