- Drop support for Python 3.8 since its end-of-life date is October 2024.
- Remove all exceptions from the main module and raise them from the
exceptions
module. This is to declutter the public API and make it easier to maintain.
- A release without change to match the version of other HyRiver packages.
- Add the
exceptions
module to the high-level API to declutter the main module. In the future, all exceptions will be raised from this module and not from the main module. For now, the exceptions are raised from both modules for backward compatibility. - Switch to using the
src
layout instead of theflat
layout for the package structure. This is to make the package more maintainable and to avoid any potential conflicts with other packages. - Add artifact attestations to the release workflow.
- In
check_3dep_availability
function, fix a bug where the function fails to return a valid response when the web service is down.
- In
add_elvation
function, fix a bug where the function fails to add elevation to axarray.Dataset
with x and y dims not beingx
andy
.
- Refactor
fill_depressions
function by porting the code frompyflwdir
and improve its performance and also now, it directly supportxarray.DataArray
. Now,pyflwdir
is not an optional dependency anymore. You can installnumba
to improve the performance of the function.
- The AirMap service has been deprecated and removed from the package. The
elevation_bycoords
function now only supports the the National Map and the 3DEP services.
- In the
check_3dep_availability
function when the web service is down the function raises aTypeError
instead of setting the value of the failed resolution toFailed
. This is fixed now. (:issue_3dep:`66`).
- Simplify the logic of adding elevation to a Dataset in the
add_elevation
function to avoid modifying CRS of the input Dataset.
- Add a new function called
get_map_vrt
for getting DEM within a bounding box and saving it as aVRT
file. This function has low memory usage and is useful for cases where the DEM is needed for a large area. Moreover, even for usual use cases it can be much faster thanget_dem
since it loads the data lazily, at the cost of higher disk usage. - In the
get_map
function, check if the input geometry is within the bounds of the 3DEP's WMS service and if not, raise an exception. - In the
fill_depressions
function add a new argument calledoutlets
for specifying outlet detection method: At the edge of all cells (edge
) or only the minimum elevation edge cell (min
; default). - Significantly improve the performance of
check_3dep_availability
function by minimizng the number of requests to the service and sending all requests asynchronously. Also, the returneddict
now usesFailed
for those resolutions where the service fails to return a valid response. It will remove the failed responses from the cache, so next time the function is called, it will try to get only the failed resolutions. - Add four new options to
add_elevation
:mask
for passing a mask andresolution
for specifying the resolution of the source DEM, andx_dim
andy_dim
for passing the names of spatial dimensions in the input dataset. Themask
option is useful for cases where the inputxarray.DataArray
orxarray.Dataset
has a mask and the user wants to use that mask for the elevation data as well. Theresolution
option is useful for cases where the user wants to get the elevation data at a higher resolution that will be downsampled by bilinear interpolation to the resolution of the inputxarray.DataArray
orxarray.Dataset
. The default isresolution=None
which means the resolution of the inputxarray.DataArray
orxarray.Dataset
will be used. Thex_dim
andy_dim
options are useful for cases where the inputxarray.DataArray
orxarray.Dataset
has different names for spatial dimensions thanx
andy
. The default isx_dim="x"
andy_dim="y"
.
- In the
elevation_profile
function remove theres
argument and use 10-m resolution DEM from 3DEP. Also, add two new attributes to the outputxarray.Dataset
:source
for the dataset to state the data source used andunits
for thedistance
variable to state the units of the distance, which is meters.
- Improve initial load time by moving
import pyflwdir
to thefill_depressions
function.
- Decrease the number of pixels per request from 10e6 to 8e6 to reduce the request load (:issue_3dep:`65`).
- Remove dependency on
dask
.
- Fix HyRiver libraries requirements by specifying a range instead
of exact version so
conda-forge
can resolve the dependencies.
From release 0.15 onward, all minor versions of HyRiver packages
will be pinned. This ensures that previous minor versions of HyRiver
packages cannot be installed with later minor releases. For example,
if you have py3dep==0.14.x
installed, you cannot install
pydaymet==0.15.x
. This is to ensure that the API is
consistent across all minor versions.
- In
static_3dep_dem
userioxarray
directly instead ofrasterio
since it can handle VRT files. - Improve performance and accuracy of
add_elevation
by using the dynamic 3DEP service and setting the resolution based on the inputxarray.DataArray
orxarray.Dataset
. - Improve the performance of
elevation_profile
by using the static 3DEP service when the input resolution is 10 m (which is the default for this function). - For now, retain compatibility with
shapely<2
while supportingshapley>=2
.
- In
add_elevation
, ensure that the resolution is in meters by reprojecting the input dataset to 5070 before extracting resolution and bound attributes.
- Add a new function called
add_elevation
for adding elevation data as a new variable to an inputxarray.DataArray
orxarray.Dataset
. - The
elevation_bycoords
function now accepts a single coordinate and returns a float in addition to a list of coordinates that returned a list of elevations. - Modify the
elevation_bycoords
function to use the new elevation point query service (EPQS) web service. This only affects thesource="tnm"
option.
- Bump the minimum required version of
shapely
to 2.0, and use its new API.
- Sync all minor versions of HyRiver packages to 0.14.0.
- Use pyflwdir package for
depression filling operation instead of
richdem
since it appears to be unmaintained. Note thatpyflwdir
is an optional dependency. Also,pyflwdir
depends onnumba
which is not available for Python 3.11 yet. You can follow the progress ofnumba
's support for Python 3.11 here. - Add a new function called
get_dem
for obtaining DEM that is a wrapper ofstatic_3dep_dem
andget_map
functions. Sincestatic_3dep_dem
is faster, if the requested resolution is 10 m, 30 m, or 60 m,static_3dep_dem
will be used. Otherwise,get_map
will be used.
- Significantly improve the performance of
elevation_bycoords
whentep
is used as the source by using the static DEM data instead of the dynamic DEM. - Fully migrate
setup.cfg
andsetup.py
topyproject.toml
. - Convert relative imports to absolute with
absolufy-imports
. - Sync all patch versions of HyRiver packages to x.x.12.
- Refactor the
show_versions
function to improve performance and print the output in a nicer table-like format.
- Fix a compatibility issue with the new
scipy
version inelevation_profile
where led to failure of interpolation.
- Add the missing annotation import to the
cache_keys
to ensure Python 3.8 and 3.9 work with Python 3.10 style type hinting.
- Add a new function called
static_3dep_dem
for getting only DEM data at 10 m, 30, or 60 m resolution. This is useful for cases where only DEM data (i.e., not slope, aspect, or other terrain attributes that the Dynamic 3DEP service provides) is needed. This function is faster thanget_map
but is less flexible.
- Modify the codebase based on Refurb suggestions.
- Use
pyupgrade
package to update the type hinting annotations to Python 3.10 style. - Bump the minimum required version of HyRiver dependencies to the latest versions.
- Add the missing PyPi classifiers for the supported Python versions.
- Append "Error" to all exception classes for conforming to PEP-8 naming conventions.
- Increase the pixel limit for 3DEP's WMS from 8M to 10M to reduce number of service calls and improve performance.
- Bump the minimum versions of
pygeoogc
andpygeoutils
to 0.13.5 and that ofasync-retriever
to 0.3.5.
- Fix a bug in
check_3dep_availability
where due to changes inpygeoogc
ZeroMatched
exception is raised instead ofTypeError
and as a resultcheck_3dep_availability
was not working as expected.
- 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.
- Use micromamba for running tests and use nox for linting in CI.
- In
deg2mpm
function look for_FillValue
andnodatavals
in the attributes and if not found, fall back tonumpy.nan
.
- Ensure that the
deg2mpm
function usesdask
if the input isdask
-enabled. - In the
elevation_profile
function use a bounding box to get DEM and a linear interpolation to get the elevation along the profile.
- Add a new function called
query_3dep_sources
for querying bounds of 3DEP's data sources within a bounding box. It returns a geo-dataframe that contains the bounding box of each data source and a columndem_res
identifying the resolution of the raw topographic data within each geometry. - Add a new function called
elevation_profile
for getting elevation profile along a line at a given spacing. This function converts the line to a B-spline and then calculates the elevation along the spline at a given uniform spacing.
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"
- Add a new DEM source to
elevation_bycoords
to get elevation from the National Map's 3DEP WMS service. This can replace thetnm
source sincetnm
is not stable. - Add a new function called
check_3dep_availability
to check the availability of 3DEP's native resolutions within an area of interest. It returns adict
with keys corresponding to the available resolutions and its values are boolean values indicating whether the resolution is available or not. - Replace no data values of
slope
indeg2mm
withnp.nan
, so they do not get converted to another value. The output of this function hasnp.float64
type.
- Refactor
ElevationByCoords
by using__post_init__
for validating the input parameters rather thanpydantic
's validators. - Refactor
elevation_bygrid
by usingget_map
to get DEM andrioxarray
for re-projection. - Add type checking with
typeguard
and fixed typing issues raised bytypeguard
. - Refactor
show_versions
to ensure getting correct versions of all dependencies.
- Use the three new
ar.retrieve_*
functions instead of the oldar.retrieve
function to improve type hinting and to make the API more consistent.
- Set the request caching's expiration time to never expire. Add two flags to all
functions to control the caching:
expire_after
anddisable_caching
.
- Add all the missing types so
mypy --strict
passes. - Improve performance of
elevation_bygrid
by ignoring unnecessary validation.
- Use
rioxarray
for dealing withGeoTIFF
binaries sincexarray
deprecated thexarray.open_rasterio
function, as it's discussed in this PR. - Use
importlib-metadata
for getting the version instead ofpkg_resources
to decrease import time as discussed in this issue.
- Rewrite the command-line interface using
click.group
to improve UX. The command is nowpy3dep [command] [args] [options]
. The two supported commands arecoords
for getting elevations of a dataframe of coordinates inEPSG:4326
CRS andgeometry
for getting the elevation of a geo-dataframe of geometries. Each sub-command now has a separate help message. The format of the input file for thecoords
command is nowcsv
and for thegeometry
command is.shp
or.gpkg
and must have acrs
attribute. Also, thegeometry
command now accepts multiple layers via the--layers
(-l
) option. More information and examples can be in theREADME.rst
file.
- Make
fill_depressions
function public. This function conditions an input DEM by applying depression filling and flat area resolution operations.
- The
get_map
function now checks for validation of the inputlayers
argument before sending the actual request with a more helpful message. - Improve docstrings.
- Move
deg2mpm
,fill_depressions
, andreproject_gtiff
functions to a new file calledutils
. Bothdeg2mpm
andfill_depressions
functions are still accessible frompy3dep
directly. - Increase the test coverage.
- Use one of the
click
's internal functions,click..testing.CliRunner
, to run the CLI tests.
- Fix a bug related to
elevation_bycoords
where CRS validation fails if its type ispyrpoj.CRS
by converting inputs with CRS types to string.
- Fix a couple of typing issues and update the
get_transform
API based on the recent changes inpygeoutils
v0.11.5.
The first highlight of this release is a major refactor of elevation_bycoords
by
adding support for the Bulk Point Query Service and improving the overall performance
of the function. Another highlight is support for performing depression filling
in elevation_bygrid
before sampling the underlying DEM.
- Refactor
elevation_bycoords
function to add support for getting elevations of a list of coordinates via The National Map's Point Query Service. This service is more accurate than Airmap, but it's limited to the US only. You can select the source via a new argument calledsource
. You can set it tosource=tnm
to use the TNM service. The default istnm
. - Refactor
elevation_bygrid
function to add a new capability viafill_depressions
argument for filling depressions in the obtained DEM before extracting elevation data for the input grid points. This is achieved via RichDEM that needs to be installed if this functionality is desired. You can install it viapip
orconda
(mamba
).
- Migrate to using
AsyncRetriever
for handling communications with web services. - Handle the interpolation step in
elevation_bygrid
function more efficiently usingxarray
.
- Added command-line interface (:issue_3dep:`10`).
- All feature query functions use persistent caching that can significantly improve the performance.
- Drop support for Python 3.6 since many of the dependencies such as
xarray
andpandas
have done so. - The returned
xarray
objects are in parallel mode, i.e., in some casescompute
method should be used to get the results. - Save the output as a
netcdf
instead ofraster
since conversion fromnc
totiff
can be easily done withrioxarray
.
- Add announcement regarding the new name for the software stack, HyRiver.
- Improve
pip
installation and release workflow.
- The first release after renaming hydrodata to PyGeoHydro.
- Make
mypy
checks more strict and fix all the errors and prevent possible bugs. - Speed up CI testing by using
mamba
and caching.
- Bump version to the same version as PyGeoHydro.
- Add support for saving maps as
geotiff
file(s). - Replace
Elevation Point Query Service
service withAirMap
for getting elevations for a list of coordinates in bulk sinceAirMap
is much faster. The resolution ofAirMap
is 30 m. - Use
cytoolz
for some operations for improving performance.
- Add support for multipolygon.
- Remove the
fill_hole
argument. - Add a new function to get elevations for a list of coordinates called
elevation_bycoords
. - Refactor
elevation_bygrid
function for increasing readability and performance.
- Added a rename operation to
get_map
to automatically rename the variables to a more sensible one. - Replaced
simplejson
withorjson
to speed-up JSON operations.
- Add a new function,
show_versions
, for getting versions of the installed dependencies which is useful for debugging and reporting. - Fix typos in the docs and improved the README.
- Improve testing and coverage.
- Fixed the geometry CRS issue
- Improved the documentation
- Refactor
get_map
to usepygeoutils
package. - Change the versioning method to
setuptools_scm
. - Polish README and add installation from
conda-forge
.
- First release on PyPI.