History#
0.18.1 (2024-XX-XX)#
New Features#
Add a function called
sample_window
to remsample a raster dataset using a window size and arasterio
supported resampling method. This is an efficient way of sampling large raster datasets without reading the entire dataset into memory. The function returns a generator that yields the sampled values in the order of the input coordinates. This function is based on therasterio.sample.sample_gen
function.
0.18.0 (2024-10-05)#
New Features#
Add a function called
achored_amoothin``to smooth a ``LineString
using Cubnic splines that anchores the first and last points of theLineString
.Add a function called
smooth_multilinestring
to smooth aMultiLineString
using the newanchored_smoothin
function.In
line_curvature
usespline_curvature
to calculate the curvature of aLineString
at all points along theLineString
. This is more accurate than the previous method and users can now specify the smoothing factor (s
) and degree of the spline (k
) to control the smoothness of the spline that is used to calculate the curvature.
Breaking Changes#
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.
Internal Changes#
Move all spline and smoothing functions to a new module called
smoothing
.
0.17.1 (2024-09-14)#
Internal Changes#
Drop support for Python 3.8 since its end-of-life date is October 2024.
0.16.3 (2024-05-16)#
Internal Changes#
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.Improve robustness of
json2geodf
by ensuring that all geojsons are in the same CRS.
0.16.1 (2024-01-15)#
Bug Fixes#
pyproj
uses its own env variables for SSL certification. This release fixes the issue withpyproj
not being able to download the grid database when using DOI SSL certification file. This release usespyproj.network.set_ca_bundle_path
for setting the SSL certification file given by the user viaHYRIVER_SSL_CERT
env variable.Ignore
FutureWarning
of pandas 2.1.0 for all-NaN columns injson2geodf
.
Internal Changes#
For
Attrs
class, usedataclass
instead for better performance and consistency.
0.16.0 (2024-01-03)#
Breaking Changes#
Refactor the spline generation functions to make them more efficient, more accurate, and more robust. Switched to using
UnivariateSpline
fromscipy
instead ofBSpline
. This allows for more control over smoothness of the spline via thesmooth
parameter. References to BSpline has been removed from the functions and a new functionality has been added. The new spline generation functions areGeoSpline
,make_spline
,spline_linestring
,smooth_linestring
,spline_curvature
, andline_curvature
. Thesmooth_linestring
function now returns aLineString
instead of aSpline
object. This function is intended for smoothing aLineString
when curvature, radius of curvature, and tangent angles are not needed. Thespline_linestring
function now returns aSpline
object that contains the smoothedLineString
and curvature, radius of curvature, and tangent angles. Also,line_curvature
function can be used to compute curvature, radius of curvature, and tangent angles of aLineString
at all point along theLineString
.
New Features#
Add a new function called
gtiff2vrt
for creating a VRT file from a list of GeoTiff files. Note that this new function requiresgdal
to be installed.The
xd_write_crs
function now keepsspatial_ref
attribute of the inputxarray.DataArray
orxarray.Dataset
to retain CF compliance.
0.15.2 (2023-09-22)#
New Features#
Add
geometry_reproject
function for reprojecting a geometry (bounding box, list of coordinates, or anyshapely.geometry
) to a new CRS.Add
smooth_linestring
function for smoothing aLineString
using B-splines.Make
make_bspline
andbspline_curvature
functions public. Themake_bspline
function usesscipy
to generate aBSplines
object and thebspline_curvature
function calculates the tangent angles, curvature, and radius of curvature of a B-spline at any point along the B-spline.Improve the accuracy and performance of B-spline generation functions.
Internal Changes#
Remove dependency on
dask
.
0.15.0 (2023-05-07)#
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.
New Features#
For now, retain compatibility with
shapely<2
while supportingshapley>=2
.
0.14.0 (2023-03-05)#
New Features#
Ignore index when concatenating multiple responses in
json2geodf
to ensure indices are uniqueAdd a new function, called
coords_list
, for converting/validating input coordinates of any type to alist
oftuple
, i.e.,[(x1, y1), (x2, y2), ...]
.Make
xd_write_crs
function public.In
xarray_geomask
if the input geometry is very small return at least one pixel.Add a new function, called
multi2poly
, for converting aMultiPolygon
to aPolygon
in aGeoDataFrame
. This function tries to convertMultiPolygon
toPolygon
by first checking ifMultiPolygon
can be directly converted using their exterior boundaries. If not, will try to remove those small sub-Polygon
that their area is less than 1% of the total area of theMultiPolygon
. If this fails, the originalMultiPolygon
will be returned.
Breaking Changes#
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.
0.13.12 (2023-02-10)#
Breaking Changes#
The input
GeoDataFrame
tobreak_lines
now should be in a projected CRS.
New Features#
Significant improvements in the accuracy and performance of
nested_``Polygon``
by changing the logic. Now, the function first determines the nestedPolygon
by comparing the centroids of the geometries with their geometry and then picks the largest geometry from each group of nested geometries.Add a new function called
query_indicies
which is a wrapper aroundgeopandas.sindex.query_bulk
. However, instead of returning an array of positional indices, it returns a dictionary of indices where keys are the indices of the input geometry and values are a list of indices of the tree geometries that intersect with the input geometry.
Internal Changes#
Simplify
geo2polygon
by making the two CRS arguments optional and only reproject if CRS values are given and different.Apply the geometry mask in
gtiff2xarray
even if the input geometry is a bounding box since the mask might not be the same geometry as the one that was used during data query.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.
0.13.11 (2023-01-08)#
Bug Fixes#
Fix an in issue
xarray_geomask
where for geometries that are smaller than a single pixel, the bbox clipping operation fails. This is fixed by using theauto_expand
option ofrioxarray.clip_box
.
0.13.10 (2022-12-09)#
New Features#
Add a new function called
nested_``Polygon``
for determining nested (multi)``Polygon`` in agepandas.GeoDataFrame
orgeopandas.GeoSeries
.Add a new function called
geodf2xarray
for rasterizing ageopandas.GeoDataFrame
to axarray.DataArray
.
Internal Changes#
Modify the codebase based on Refurb suggestions.
In
xarray_geomask
, ifdrop=True
recalculate its transform to ensure the correct geo references are set if the shape of the dataset changes.
0.13.8 (2022-11-04)#
Internal Changes#
Improve the performance of
xarray_geomask
significantly by first clipping the data to the geometry’s bounding box, then if the geometry is a polygon, masking the data with the polygon. This is much faster than directly masking the data with the polygon. Also, support passing a bounding box toxarray_geomask
in addition to polygon andMultiPolygon
.Fix deprecation warning of
pandas
when changing the geometry column of aGeoDataFrame
in thenbreak_lines
function.
0.13.7 (2022-11-04)#
Internal Changes#
When combining the responses, now
dask
handles data chunking more efficiently. This is especially important for handling large responses from WMS services.Improve type hints for CRS-related arguments of all functions by including string, integer, and
pyproj.CRS
types.In
gtiff2xarray
userasterio
engine to make sure allrioxarray
attrs are read.
0.13.6 (2022-08-30)#
Internal Changes#
Add the missing PyPi classifiers for the supported Python versions.
0.13.5 (2022-08-29)#
Breaking Changes#
Append “Error” to all exception classes for conforming to PEP-8 naming conventions.
0.13.2 (2022-06-14)#
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.Bump min versions of
rioxarray
to 0.10 since it adds reading/writing GCPs.
Internal Changes#
Use micromamba for running tests and use nox for linting in CI.
0.13.1 (2022-06-11)#
New Features#
Add support for passing a custom bounding box in the
Coordinates
class. The default is the bounds ofEPSG:4326
to retain backward compatibility. This new class parameter allows a user to check if a list of coordinates is within a custom bounding box. The bounds should be theEPSG:4326
coordinate system.Add a new function called
geometry_list
for converting a list of multi-geometries to a list of geometries.
0.13.0 (2022-03-03)#
Internal Changes#
Write
nodata
attribute usingrioxarray
ingeotiff2xarray
since the clipping operation ofrioxarray
uses this value as fill value.
Bug Fixes#
In the
break_lines
function, convertMultiLineString
intoLineString
sinceshapely.ops.substring
only acceptsLineString
.
0.12.3 (2022-02-04)#
New Features#
Add a function called
break_lines
for breaking lines at given points.Add a function called
snap2nearest
for snapping points to the nearest point on a line with a given tolerance. It accepts ageopandas.GeoSeries
of points and ageopandas.GeoSeries
orgeopandas.GeoDataFrame
of lines. It automatically snaps to the closest lines in the input data.
0.12.2 (2022-01-15)#
New Features#
Add a new class called
GeoBSpline
that generates B-splines from a set of coordinates. Thespline
attribute of this class has five attributes:x
andy
coordinates,phi
andradius
which are curvature and radius of curvature, respectively, anddistance
which is the total distance of each point along the B-spline from the starting points.Add a new class called
Coordinates
that validates a set of lon/lat coordinates. It normalizes longitudes to the range [-180, 180) and has apoints
property that isgeopandas.GeoSeries
with validated coordinates. It uses spatial indexing to speed up the validation and should be able to handle large datasets efficiently.Make
transform2tuple
a public function.
Internal Changes#
The
geometry
andgeo_crs
arguments ofgtiff2xarray
are now optional. This is useful for cases when the inputGeoTiff
response is the results of a bounding box query and there is no need for a geometry mask.Replace the missing values after adding geometry mask via
xarray_geomask
by thenodatavals
attribute of the inputxarray.DataArray
orxarray.Dataset
. Therefore, the data type of the inputxarray.DataArray
orxarray.Dataset
is conserved.Expose
connectivity
argument ofrasterio.features.shapes
function inxarray2geodf
function.Move all private functions to a new module to make the main module less cluttered.
0.12.1 (2021-12-31)#
Internal Changes#
Refactor
arcgis2geojson
for better readability and maintainability.In
arcgis2geojson
set the geometry to null if its type is not supported, such as curved polylines.
0.12.0 (2021-12-27)#
Internal Changes#
Add all the missing types so
mypy --strict
passes.Bump version to 0.12.0 to match the release of
pygeoogc
.
0.11.7 (2021-11-09)#
Internal Changes#
0.11.6 (2021-10-06)#
New Features#
Add a new function,
xarray2geodf
, to convert axarray.DataArray
to ageopandas.GeoDataFrame
.
0.11.5 (2021-06-16)#
Bug Fixes#
Fix an issue with
gtiff2xarray
where thescales
andoffsets
attributes of the outputDataArray
were floats rather than tuples (GH 30).
Internal Changes#
Add a new function,
transform2tuple
, for convertingAffine
transforms to a tuple. Previously, theAffine
transform was converted to a tuple usingto_gdal()
method ofrasterio.Affine
which was not compatible withrioxarray
.
0.11.4 (2021-08-26)#
Internal Changes#
Use
ujson
for JSON parsing instead oforjson
sinceorjson
only serializes tobytes
which is not compatible withaiohttp
.Convert the transform attribute data type from
Affine
totuple
since saving a data array tonetcdf
cannot handle theAffine
type.
0.11.3 (2021-08-19)#
Fix an issue in
geotiff2xarray
related to saving axarray
object to NetCDF when its transform attribute hasAffine
type rather than a tuple.
0.11.2 (2021-07-31)#
The highlight of this release is performance improvement in gtiff2xarray
for
handling large responses.
New Features#
Automatic detection of the driver by default in
gtiff2xarray
as opposed to it beingGTiff
.
Internal Changes#
Make
geo2polygon
,get_transform
, andget_nodata_crs
public functions since other packages use it.Make
xarray_mask
a public function and simplifygtiff2xarray
.Remove
MatchCRS
since it’s already available inpygeoogc
.Validate input geometry in
geo2polygon
.Refactor
gtiff2xarray
to check for theds_dims
outside the main loops to improve the performance. Also, the function tries to detect the dimension names automatically ifds_dims
is not provided by the user, explicitly.Improve performance of
json2geodf
by using list comprehension and performing checks outside the main loop.
Bug Fixes#
Add the missing arguments for masking the data in
gtiff2xarray
.
0.11.1 (2021-06-19)#
Bug Fixes#
In some edge cases the y-coordinates of a response might not be monotonically sorted so
dask
fails. This release sorts them to address this issue.
0.11.0 (2021-06-19)#
New Features#
Function
gtiff2xarray
returns a parallelizedxarray.Dataset
orxarray.DataAraay
that can handle large responses much more efficiently. This is achieved usingdask
.
Breaking Changes#
Drop support for Python 3.6 since many of the dependencies such as
xarray
andpandas
have done so.Refactor
MatchCRS
. Now, it should be instantiated by providing the in and out CRSs like so:MatchCRS(in_crs, out_crs)
. Then its methods, namely,geometry
,bounds
andcoords
, can be called. These methods now have only one input, geometry.Change input and output types of
MatchCRS.coords
from tuple of lists of coordinates to list of(x, y)
coordinates.Remove
xarray_mask
andgtiff2file
sincerioxarray
is more general and suitable.
Internal Changes#
Remove unnecessary type checks for private functions.
Refactor
json2geodf
to improve robustness. Useget
method ofdict
for checking key availability.
0.10.1 (2021-03-27)#
Setting transform of the merged dataset explicitly (GH 3).
Add announcement regarding the new name for the software stack, HyRiver.
Improve
pip
installation and release workflow.
0.10.0 (2021-03-06)#
The first release after renaming
hydrodata
toPyGeoHydro
.Address GH 1 by sorting y coordinate after merge.
Make
mypy
checks more strict and fix all the errors and prevent possible bugs.Speed up CI testing by using
mamba
and caching.
0.9.0 (2021-02-14)#
Bump version to the same version as PyGeoHydro.
Add
gtiff2file
for saving raster responses asgeotiff
file(s).Fix an error in
_get_nodata_crs
for handling no data value when its value in the source is None.Fix the warning during the
GeoDataFrame
generation injson2geodf
when there is no geometry column in the input JSON.
0.2.0 (2020-12-06)#
Added checking the validity of input arguments in
gtiff2xarray
function and provide useful messages for debugging.Add support for
MultiPolygon
.Remove the
fill_hole
argument.Fixed a bug in
xarray_geomask
for getting the transform.
0.1.10 (2020-08-18)#
Fixed the
gtiff2xarray
issue with high resolution requests and improved robustness of the function.Replaced
simplejson
withorjson
to speed up JSON operations.
0.1.9 (2020-08-11)#
Modified
griff2xarray
to reflect the latest changes inpygeoogc
0.1.7.
0.1.8 (2020-08-03)#
Retained the compatibility with
xarray
0.15 by removing theattrs
flag.Added
xarray_geomask
function and made it a public function.More efficient handling of large GeoTiff responses by cropping the response before converting it into a dataset.
Added a new function called
geo2polygon
for converting and transforming a polygon or bounding box into a Shapely’s Polygon in the target CRS.
0.1.6 (2020-07-23)#
Fixed the issue with flipped mask in
WMS
.Removed
drop_duplicates
since it may cause issues in some instances.
0.1.4 (2020-07-22)#
Refactor
griff2xarray
and added support for WMS 1.3.0 and WFS 2.0.0.Add
MatchCRS
class.Remove dependency on PyGeoOGC.
Increase test coverage.
0.1.3 (2020-07-21)#
Remove duplicate rows before returning the dataframe in the
json2geodf
function.Add the missing dependency
0.1.0 (2020-07-21)#
First release on PyPI.