Skip to content

Releases: hyriver/pynhd

v0.14.0

05 Mar 16:50
Compare
Choose a tag to compare

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, called metrics_df that gets a dataframe of metric names and their description.
  • Create a new private StreamCatValidator class to avoid polluting the public StreamCat class with private attributes and methods. Moreover, add a new alternative metric names attribute to StreamCat called alt_names for handling those metric names that do not follow METRIC+YYYY convention. This attribute is a dictionary that maps the alternative names to the actual metric names, so users can use METRIC_NAME column of metrics_df and add a year suffix from valid_years attribute of StreamCat to get the actual metric name.
  • In navigate_by* functions of NLDI add stop_comid, which is another criterion for stopping the navigation in addition to distance.
  • Improve UserWarning messages of NLDI and WaterData.

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 via pynhd.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 a UserWarning.
  • 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

10 Feb 16:19
Compare
Choose a tag to compare

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 and nhdplus_vaa by using int32 instead of Int64, where applicable.
  • Sync all patch versions of HyRiver packages to x.x.12.

v0.13.11

24 Jan 22:24
Compare
Choose a tag to compare

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 and comid for MR.

Internal Changes

  • Fully migrate setup.cfg and setup.py to pyproject.toml.
  • Convert relative imports to absolute with absolufy-imports.
  • Improve performance of prepare_nhdplus by using pandas.merge instead of applying a function to each row of the dataframe.

v0.13.10

09 Jan 04:40
Compare
Choose a tag to compare

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 use streamcat function to get the metrics as a pandas.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

09 Dec 22:52
Compare
Choose a tag to compare

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 than nhdplus_attrs. Also, you can request for multiple attributes at once whereas in nhdplus_attrs you had to request for each attribute one at a time. This function will replace nhdplus_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 and enhd_flowlines_nx. These functions generate a networkx directed graph object of NHD HUC12 water boundaries and flowlines, respectively. They also return a dictionary mapping of COMID and HUC12 to the corresponding networkx 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 and py7zr. These dependencies can be installed using pip install pyogrio py7zr or conda 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

04 Nov 22:14
Compare
Choose a tag to compare

Release Notes

New Features

  • Add a new function called epa_nhd_catchments to access one of the EPA's HMS endpoints called WSCatchment. 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 in pandas exception handling, the NHDTools fails in converting columns with NaN values to integer type. Now, pandas throws IntCastingNaNError instead of TypeError when using astype method on a column.

Internal Changes

  • Use pyupgrade package to update the type hinting annotations to Python 3.10 style.

v0.13.6

30 Aug 17:29
Compare
Choose a tag to compare

Release Notes

Internal Changes

  • Add the missing PyPi classifiers for the supported Python versions.

v0.13.5

29 Aug 21:35
Compare
Choose a tag to compare

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 and pygeoutils to 0.13.5 and that of async-retriever to 0.3.5.

Bug Fixes

  • Fix an issue in nhdplus_vaa and enhd_attrs functions where if cache folder does not exist, it would not have been created, thus resulting to an error.

v0.13.3

31 Jul 15:19
Compare
Choose a tag to compare

Release Notes

Internal Changes

  • Use the new async_retriever.stream_write function to download files in nhdplus_vaa and enhd_attrs functions. This is more memory efficient.
  • Convert the type of list of not found items in NLDI.comid_byloc and NLDI.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 the update operation.

v0.13.2

14 Jun 05:31
Compare
Choose a tag to compare

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.