Releases: hyriver/pynhd
Releases · hyriver/pynhd
v0.14.0
Release Notes
New Features
- Rewrite the
GeoConnex
class to provide access to new capabilities of the web service. Support for spatial queries have been added via CQL queries. For more information, check out the updated GeoConnex example notebook. - Add a new property to
StreamCat
, calledmetrics_df
that gets a dataframe of metric names and their description. - Create a new private
StreamCatValidator
class to avoid polluting the publicStreamCat
class with private attributes and methods. Moreover, add a new alternative metric names attribute toStreamCat
calledalt_names
for handling those metric names that do not followMETRIC+YYYY
convention. This attribute is a dictionary that maps the alternative names to the actual metric names, so users can useMETRIC_NAME
column ofmetrics_df
and add a year suffix fromvalid_years
attribute ofStreamCat
to get the actual metric name. - In
navigate_by*
functions ofNLDI
addstop_comid
, which is another criterion for stopping the navigation in addition todistance
. - Improve
UserWarning
messages ofNLDI
andWaterData
.
Breaking Changes
- Remove
pynhd.geoconnex
function since more functionality has been added to the GeoConnex service that existence of this function does not make sense anymore. All queries should be done viapynhd.GeoConnex
class. - Rewrite
NLDI
to improve code readability and significantly improving performance. Now, its methods do now return tuples if there are failed requests, instead they will be shown as aUserWarning
. - Bump the minimum required version of
shapely
to 2.0, and use its new API.
Internal Changes
- Sync all minor versions of HyRiver packages to 0.14.0.
v0.13.12
Release Notes
New Features
- Update the link to version 2.0 of the ENHD dataset in
enhd_attrs
.
Internal Changes
- Improve columns data types in
enhd_attrs
andnhdplus_vaa
by usingint32
instead ofInt64
, where applicable. - Sync all patch versions of HyRiver packages to x.x.12.
v0.13.11
Release Notes
New Features
- The
prepare_nhdplus
now supports NHDPlus HR in addition to NHDPlus MR. It automatically detects the NHDPlus version based on the ID column name:nhdplusid
for HR andcomid
for MR.
Internal Changes
- Fully migrate
setup.cfg
andsetup.py
topyproject.toml
. - Convert relative imports to absolute with
absolufy-imports
. - Improve performance of
prepare_nhdplus
by usingpandas.merge
instead of applying a function to each row of the dataframe.
v0.13.10
Release Notes
New Features
- Add support for the new EPA's StreamCat RestFull API with over 500 NHDPlus catchment level metrics. One class is added for getting the service properties such as valid metrics, called
StreamCat
. You can usestreamcat
function to get the metrics as apandas.DataFrame
. - Refactor the
show_versions
function to improve performance and print the output in a nicer table-like format.
Internal Changes
- Skip 0.13.9 version so the minor version of all HyRiver packages become the same.
- Modify the codebase based on the latest changes in
geopandas
related to empty dataframes.
v0.13.8
Release Notes
New Features
- Add a new function, called
nhdplus_attrs_s3
, for accessing the recently released NHDPlus derived attributes on a USGS's S3 bucket. The attributes are provided in parquet files, so getting them is faster thannhdplus_attrs
. Also, you can request for multiple attributes at once whereas innhdplus_attrs
you had to request for each attribute one at a time. This function will replacenhdplus_attrs
in a future release, as soon as all data that are available on the ScienceBase version are also accessible from the S3 bucket. - Add two new functions called
mainstem_huc12_nx
andenhd_flowlines_nx
. These functions generate anetworkx
directed graph object of NHD HUC12 water boundaries and flowlines, respectively. They also return a dictionary mapping of COMID and HUC12 to the correspondingnetworkx
node. Additionally, a topologically sorted list of COMIDs/HUC12s are returned. The generated data are useful for doing US-scale network analysis and flow accumulation on the NHD network. The NHD graph has about 2.7 million edges and the mainstem HUC12 graph has about 80K edges. - Add a new function for getting the entire NHDPlus dataset for CONUS (Lower 48), called
nhdplus_l48
. The entire NHDPlus dataset is downloaded from here. This 7.3 GB file will take a while to download, depending on your internet connection. The first time you run this function, the file will be downloaded and stored in the./cache
directory. Subsequent calls will use the cached file. Moreover, there are two additional dependencies for using this function:pyogrio
andpy7zr
. These dependencies can be installed usingpip install pyogrio py7zr
orconda install -c conda-forge pyogrio py7zr
.
Internal Changes
- Refactor
vector_accumulation
for significant performance improvements. - Modify the codebase based on Refurb suggestions.
v0.13.7
Release Notes
New Features
- Add a new function called
epa_nhd_catchments
to access one of the EPA's HMS endpoints calledWSCatchment
. You can use this function to access 414 catchment-scale characteristics for all the NHDPlus catchments including 16-day average curve number. More information on the curve number dataset can be found at its project page here.
Bug Fixes
- Fix a bug in
NHDTools
where due to the recent changes inpandas
exception handling, theNHDTools
fails in converting columns withNaN
values to integer type. Now,pandas
throwsIntCastingNaNError
instead ofTypeError
when usingastype
method on a column.
Internal Changes
- Use
pyupgrade
package to update the type hinting annotations to Python 3.10 style.
v0.13.6
Release Notes
Internal Changes
- Add the missing PyPi classifiers for the supported Python versions.
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
pygeoogc
andpygeoutils
to 0.13.5 and that ofasync-retriever
to 0.3.5.
Bug Fixes
- Fix an issue in
nhdplus_vaa
andenhd_attrs
functions where ifcache
folder 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_write
function to download files innhdplus_vaa
andenhd_attrs
functions. This is more memory efficient. - Convert the type of list of not found items in
NLDI.comid_byloc
andNLDI.feature_byloc
to 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
json
format instead of returning the usual status errors. - Slice the ENHD dataframe in
NHDTools.clean_flowlines
before updating the flowline dataframe to reduce the required memory for theupdate
operation.
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
,rioxarray
have dropped support for Python 3.7.
Internal Changes
- Use micromamba for running tests and use nox for linting in CI.