pygeoutils
A part of HyRiver software stack for handling geospatial data manipulations
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: joss.theoj.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (4.7%) to scientific vocabulary
Keywords
geodata
geospatial
hydrology
python
webservices
Keywords from Contributors
mesh
daymet
wms-service
digital-elevation-model
exoplanet
energy-system
caching
climate
requests
usgs
Last synced: 6 months ago
·
JSON representation
·
Repository
A part of HyRiver software stack for handling geospatial data manipulations
Basic Info
- Host: GitHub
- Owner: hyriver
- License: other
- Language: Python
- Default Branch: main
- Homepage: https://docs.hyriver.io
- Size: 646 KB
Statistics
- Stars: 8
- Watchers: 1
- Forks: 4
- Open Issues: 0
- Releases: 46
Topics
geodata
geospatial
hydrology
python
webservices
Created over 5 years ago
· Last pushed 8 months ago
Metadata Files
Readme
Changelog
Contributing
Funding
License
Code of conduct
Citation
Authors
README.rst
.. image:: https://raw.githubusercontent.com/hyriver/HyRiver-examples/main/notebooks/_static/pygeoutils_logo.png
:target: https://github.com/hyriver/HyRiver
|
.. image:: https://joss.theoj.org/papers/b0df2f6192f0a18b9e622a3edff52e77/status.svg
:target: https://joss.theoj.org/papers/b0df2f6192f0a18b9e622a3edff52e77
:alt: JOSS
|
.. |pygeohydro| image:: https://github.com/hyriver/pygeohydro/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pygeohydro/actions/workflows/test.yml
:alt: Github Actions
.. |pygeoogc| image:: https://github.com/hyriver/pygeoogc/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pygeoogc/actions/workflows/test.yml
:alt: Github Actions
.. |pygeoutils| image:: https://github.com/hyriver/pygeoutils/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pygeoutils/actions/workflows/test.yml
:alt: Github Actions
.. |pynhd| image:: https://github.com/hyriver/pynhd/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pynhd/actions/workflows/test.yml
:alt: Github Actions
.. |py3dep| image:: https://github.com/hyriver/py3dep/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/py3dep/actions/workflows/test.yml
:alt: Github Actions
.. |pydaymet| image:: https://github.com/hyriver/pydaymet/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pydaymet/actions/workflows/test.yml
:alt: Github Actions
.. |pygridmet| image:: https://github.com/hyriver/pygridmet/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pygridmet/actions/workflows/test.yml
:alt: Github Actions
.. |pynldas2| image:: https://github.com/hyriver/pynldas2/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/pynldas2/actions/workflows/test.yml
:alt: Github Actions
.. |async| image:: https://github.com/hyriver/async-retriever/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/async-retriever/actions/workflows/test.yml
:alt: Github Actions
.. |signatures| image:: https://github.com/hyriver/hydrosignatures/actions/workflows/test.yml/badge.svg
:target: https://github.com/hyriver/hydrosignatures/actions/workflows/test.yml
:alt: Github Actions
================ ====================================================================
Package Description
================ ====================================================================
PyNHD_ Navigate and subset NHDPlus (MR and HR) using web services
Py3DEP_ Access topographic data through National Map's 3DEP web service
PyGeoHydro_ Access NWIS, NID, WQP, eHydro, NLCD, CAMELS, and SSEBop databases
PyDaymet_ Access daily, monthly, and annual climate data via Daymet
PyGridMET_ Access daily climate data via GridMET
PyNLDAS2_ Access hourly NLDAS-2 data via web services
HydroSignatures_ A collection of tools for computing hydrological signatures
AsyncRetriever_ High-level API for asynchronous requests with persistent caching
PyGeoOGC_ Send queries to any ArcGIS RESTful-, WMS-, and WFS-based services
PyGeoUtils_ Utilities for manipulating geospatial, (Geo)JSON, and (Geo)TIFF data
================ ====================================================================
.. _PyGeoHydro: https://github.com/hyriver/pygeohydro
.. _AsyncRetriever: https://github.com/hyriver/async-retriever
.. _PyGeoOGC: https://github.com/hyriver/pygeoogc
.. _PyGeoUtils: https://github.com/hyriver/pygeoutils
.. _PyNHD: https://github.com/hyriver/pynhd
.. _Py3DEP: https://github.com/hyriver/py3dep
.. _PyDaymet: https://github.com/hyriver/pydaymet
.. _PyGridMET: https://github.com/hyriver/pygridmet
.. _PyNLDAS2: https://github.com/hyriver/pynldas2
.. _HydroSignatures: https://github.com/hyriver/hydrosignatures
PyGeoUtils: Utilities for (Geo)JSON and (Geo)TIFF Conversion
------------------------------------------------------------
.. image:: https://img.shields.io/pypi/v/pygeoutils.svg
:target: https://pypi.python.org/pypi/pygeoutils
:alt: PyPi
.. image:: https://img.shields.io/conda/vn/conda-forge/pygeoutils.svg
:target: https://anaconda.org/conda-forge/pygeoutils
:alt: Conda Version
.. image:: https://codecov.io/gh/hyriver/pygeoutils/branch/main/graph/badge.svg
:target: https://codecov.io/gh/hyriver/pygeoutils
:alt: CodeCov
.. image:: https://img.shields.io/pypi/pyversions/pygeoutils.svg
:target: https://pypi.python.org/pypi/pygeoutils
:alt: Python Versions
.. image:: https://static.pepy.tech/badge/pygeoutils
:target: https://pepy.tech/project/pygeoutils
:alt: Downloads
|
.. image:: https://www.codefactor.io/repository/github/hyriver/pygeoutils/badge
:target: https://www.codefactor.io/repository/github/hyriver/pygeoutils
:alt: CodeFactor
.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json
:target: https://github.com/astral-sh/ruff
:alt: Ruff
.. image:: https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white
:target: https://github.com/pre-commit/pre-commit
:alt: pre-commit
.. image:: https://mybinder.org/badge_logo.svg
:target: https://mybinder.org/v2/gh/hyriver/HyRiver-examples/main?urlpath=lab/tree/notebooks
:alt: Binder
|
Features
--------
PyGeoUtils is a part of `HyRiver `__ software stack that
is designed to aid in hydroclimate analysis through web services. This package provides
utilities for manipulating (Geo)JSON and (Geo)TIFF responses from web services.
These utilities are:
- ``Coordinates``: Generate validated and normalized coordinates in WGS84.
- ``GeoBSpline``: Create B-spline from a ``geopandas.GeoDataFrame`` of points.
- ``smooth_linestring``: Smooth a ``shapely.geometry.LineString`` using B-spline.
- ``bspline_curvature``: Compute tangent angles, curvature, and radius of curvature
of a B-Spline at any points along the curve.
- ``arcgis2geojson``: Convert ESRIGeoJSON format to GeoJSON.
- ``break_lines``: Break lines at specified points in a given direction.
- ``gtiff2xarray``: Convert (Geo)Tiff byte responses to ``xarray.Dataset``.
- ``json2geodf``: Create ``geopandas.GeoDataFrame`` from (Geo)JSON responses
- ``snap2nearest``: Find the nearest points on a line to a set of points.
- ``xarray2geodf``: Vectorize a ``xarray.DataArray`` to a ``geopandas.GeoDataFrame``.
- ``geodf2xarray``: Rasterize a ``geopandas.GeoDataFrame`` to a ``xarray.DataArray``.
- ``xarray_geomask``: Mask a ``xarray.Dataset`` based on a geometry.
- ``query_indices``: A wrapper around
``geopandas.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.
- ``nested_polygons``: Determining nested (multi)polygons in a
``geopandas.GeoDataFrame``.
- ``multi2poly``: For converting a ``MultiPolygon`` to a ``Polygon``
in a ``geopandas.GeoDataFrame``.
- ``geometry_reproject``: For reprojecting a geometry
(bounding box, list of coordinates, or any ``shapely.geometry``) to
a new CRS.
- ``gtiff2vrt``: For converting a list of GeoTIFF files to a VRT file.
- ``sample_window``: Sample a raster dataset at specified coordinates
using a window size and a ``rasterio`` 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.
You can find some example notebooks `here `__.
You can also try using PyGeoUtils without installing
it on your system by clicking on the binder badge. A Jupyter Lab
instance with the HyRiver stack pre-installed will be launched in your web browser, and you
can start coding!
Moreover, requests for additional functionalities can be submitted via
`issue tracker `__.
Citation
--------
If you use any of HyRiver packages in your research, we appreciate citations:
.. code-block:: bibtex
@article{Chegini_2021,
author = {Chegini, Taher and Li, Hong-Yi and Leung, L. Ruby},
doi = {10.21105/joss.03175},
journal = {Journal of Open Source Software},
month = {10},
number = {66},
pages = {1--3},
title = {{HyRiver: Hydroclimate Data Retriever}},
volume = {6},
year = {2021}
}
Installation
------------
You can install PyGeoUtils using ``pip`` after installing ``libgdal`` on your system
(for example, in Ubuntu run ``sudo apt install libgdal-dev``).
.. code-block:: console
$ pip install pygeoutils
Alternatively, PyGeoUtils can be installed from the ``conda-forge`` repository
using `Conda `__:
.. code-block:: console
$ conda install -c conda-forge pygeoutils
Quick start
-----------
We start by smoothing a ``shapely.geometry.LineString`` using B-spline:
.. code-block:: python
import pygeoutils as pgu
from shapely import LineString
line = LineString(
[
(-97.06138, 32.837),
(-97.06133, 32.836),
(-97.06124, 32.834),
(-97.06127, 32.832),
]
)
line = pgu.geometry_reproject(line, 4326, 5070)
sp = pgu.smooth_linestring(line, 5070, 5)
line_sp = pgu.geometry_reproject(sp.line, 5070, 4326)
Next, we use
`PyGeoOGC `__ to access
`National Wetlands Inventory `__ from WMS, and
`FEMA National Flood Hazard `__
via WFS, then convert the output to ``xarray.Dataset`` and ``GeoDataFrame``, respectively.
.. code-block:: python
from pygeoogc import WFS, WMS, ServiceURL
from shapely.geometry import Polygon
geometry = Polygon(
[
[-118.72, 34.118],
[-118.31, 34.118],
[-118.31, 34.518],
[-118.72, 34.518],
[-118.72, 34.118],
]
)
crs = 4326
wms = WMS(
ServiceURL().wms.mrlc,
layers="NLCD_2011_Tree_Canopy_L48",
outformat="image/geotiff",
crs=crs,
)
r_dict = wms.getmap_bybox(
geometry.bounds,
1e3,
box_crs=crs,
)
canopy = pgu.gtiff2xarray(r_dict, geometry, crs)
mask = canopy > 60
canopy_gdf = pgu.xarray2geodf(canopy, "float32", mask)
url_wfs = "https://hazards.fema.gov/gis/nfhl/services/public/NFHL/MapServer/WFSServer"
wfs = WFS(
url_wfs,
layer="public_NFHL:Base_Flood_Elevations",
outformat="esrigeojson",
crs=4269,
)
r = wfs.getfeature_bybox(geometry.bounds, box_crs=crs)
flood = pgu.json2geodf(r.json(), 4269, crs)
Contributing
------------
Contributions are very welcomed. Please read
`CONTRIBUTING.rst `__
file for instructions.
Owner
- Name: HyRiver
- Login: hyriver
- Kind: organization
- Location: United States of America
- Website: https://docs.hyriver.io
- Repositories: 11
- Profile: https://github.com/hyriver
A suite of Python packages that provides a unified API for retrieving geospatial/temporal data from various web services
Citation (CITATION.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Chegini"
given-names: "Taher"
orcid: "https://orcid.org/0000-0002-5430-6000"
- family-names: "Li"
given-names: "Hong-Yi"
orcid: "https://orcid.org/0000-0002-9807-3851"
- family-names: "Leung"
given-names: "L. Ruby"
orcid: "https://orcid.org/0000-0002-3221-9467"
title: "HyRiver: Hydroclimate Data Retriever"
version: 0.11
doi: 10.21105/joss.03175
date-released: 2021-10-27
url: "https://github.com/cheginit/HyRiver"
preferred-citation:
type: article
authors:
- family-names: "Chegini"
given-names: "Taher"
orcid: "https://orcid.org/0000-0002-5430-6000"
- family-names: "Li"
given-names: "Hong-Yi"
orcid: "https://orcid.org/0000-0002-9807-3851"
- family-names: "Leung"
given-names: "L. Ruby"
orcid: "https://orcid.org/0000-0002-3221-9467"
doi: "10.21105/joss.03175"
journal: "Journal of Open Source Software"
month: 10
start: 1
end: 3
title: "HyRiver: Hydroclimate Data Retriever"
issue: 66
volume: 6
year: 2021
GitHub Events
Total
- Release event: 4
- Watch event: 2
- Delete event: 2
- Issue comment event: 2
- Push event: 16
- Pull request event: 4
- Create event: 6
Last Year
- Release event: 4
- Watch event: 2
- Delete event: 2
- Issue comment event: 2
- Push event: 16
- Pull request event: 4
- Create event: 6
Committers
Last synced: about 2 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| cheginit | c****t@g****m | 725 |
| cheginit | t****i@g****m | 82 |
| dependabot[bot] | 4****] | 26 |
| pre-commit-ci[bot] | 6****] | 16 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 1
- Total pull requests: 54
- Average time to close issues: 28 minutes
- Average time to close pull requests: about 16 hours
- Total issue authors: 1
- Total pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 1.0
- Merged pull requests: 42
- Bot issues: 0
- Bot pull requests: 54
Past Year
- Issues: 0
- Pull requests: 3
- Average time to close issues: N/A
- Average time to close pull requests: 1 day
- Issue authors: 0
- Pull request authors: 1
- Average comments per issue: 0
- Average comments per pull request: 1.0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 3
Top Authors
Issue Authors
Pull Request Authors
- dependabot[bot] (39)
- pre-commit-ci[bot] (20)
Top Labels
Issue Labels
Pull Request Labels
dependencies (39)
Packages
- Total packages: 1
-
Total downloads:
- pypi 30,755 last-month
- Total dependent packages: 7
- Total dependent repositories: 8
- Total versions: 51
- Total maintainers: 1
pypi.org: pygeoutils
Utilities for manipulating geospatial, (Geo)JSON, and (Geo)TIFF data.
- Homepage: https://docs.hyriver.io/readme/pygeoutils.html
- Documentation: https://pygeoutils.readthedocs.io/
- License: MIT
-
Latest release: 0.19.5
published 12 months ago
Rankings
Dependent packages count: 1.4%
Dependent repos count: 5.2%
Downloads: 8.5%
Average: 10.7%
Forks count: 16.9%
Stargazers count: 21.5%
Maintainers (1)
Last synced:
6 months ago
Dependencies
.github/workflows/codeql-analysis.yml
actions
- actions/checkout v3 composite
- github/codeql-action/analyze v2 composite
- github/codeql-action/autobuild v2 composite
- github/codeql-action/init v2 composite
.github/workflows/pre-commit.yml
actions
- actions/checkout v3 composite
- excitedleigh/setup-nox v2.1.0 composite
.github/workflows/release.yml
actions
- actions/checkout v3 composite
- actions/setup-python master composite
- docker://pandoc/core * composite
- pypa/gh-action-pypi-publish master composite
- softprops/action-gh-release v1 composite
.github/workflows/test.yml
actions
- actions/checkout v3 composite
- codecov/codecov-action v3 composite
- mamba-org/provision-with-micromamba main composite
pyproject.toml
pypi
- cytoolz *
- dask *
- geopandas >=0.10
- netcdf4 *
- numpy >=1.21
- pyproj >=2.2
- rasterio >=1.2
- rioxarray >=0.11
- scipy *
- shapely >=1.8
- ujson *
- xarray >=2022.03
ci/requirements/environment.yml
conda
- aiodns
- aiohttp-client-cache >=0.8.1
- bottleneck
- brotli
- cytoolz
- defusedxml
- fiona
- geopandas-base >=0.7
- joblib
- multidict
- nest-asyncio
- netcdf4
- numpy >=1.21
- owslib >=0.27.2
- pip
- psutil
- pyproj >=3.0.1
- pyproj >=2.2
- pytest-cov
- pytest-xdist
- rasterio >=1.2
- requests
- requests-cache >=0.9.6
- rioxarray >=0.11
- scipy
- shapely >=2.0.0
- shapely >=2.0
- ujson
- url-normalize >=1.4
- urllib3
- xarray >=2023.01.0
- yarl