vgridpandas 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- vgridpandas/__init__.py +7 -0
- vgridpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/easepandas/__init__.py +1 -0
- vgridpandas/easepandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/easepandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/easepandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/easepandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/easepandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/easepandas/easepandas.py +171 -0
- vgridpandas/easepandas/util/__init__.py +0 -0
- vgridpandas/easepandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/easepandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/easepandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/easepandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/easepandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/easepandas/util/const.py +2 -0
- vgridpandas/easepandas/util/decorator.py +97 -0
- vgridpandas/easepandas/util/functools.py +8 -0
- vgridpandas/easepandas/util/geometry.py +104 -0
- vgridpandas/garspandas/__init__.py +1 -0
- vgridpandas/garspandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/garspandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/georefpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/maidenheadpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/quadkeypandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/__pycache__/tilecodepandas.cpython-312.pyc +0 -0
- vgridpandas/garspandas/garspandas.py +171 -0
- vgridpandas/garspandas/util/__init__.py +0 -0
- vgridpandas/garspandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/garspandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/garspandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/garspandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/garspandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/garspandas/util/const.py +2 -0
- vgridpandas/garspandas/util/decorator.py +97 -0
- vgridpandas/garspandas/util/functools.py +8 -0
- vgridpandas/garspandas/util/geometry.py +84 -0
- vgridpandas/geohashpandas/__init__.py +1 -0
- vgridpandas/geohashpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/geohashpandas.py +171 -0
- vgridpandas/geohashpandas/util/__init__.py +0 -0
- vgridpandas/geohashpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/geohashpandas/util/const.py +2 -0
- vgridpandas/geohashpandas/util/decorator.py +97 -0
- vgridpandas/geohashpandas/util/functools.py +8 -0
- vgridpandas/geohashpandas/util/geometry.py +96 -0
- vgridpandas/georefpandas/__init__.py +1 -0
- vgridpandas/georefpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/georefpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/georefpandas.py +171 -0
- vgridpandas/georefpandas/util/__init__.py +0 -0
- vgridpandas/georefpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/georefpandas/util/const.py +2 -0
- vgridpandas/georefpandas/util/decorator.py +97 -0
- vgridpandas/georefpandas/util/functools.py +8 -0
- vgridpandas/georefpandas/util/geometry.py +95 -0
- vgridpandas/h3pandas/__init__.py +1 -0
- vgridpandas/h3pandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/__pycache__/const.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/__pycache__/h3pandas.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/h3pandas.py +891 -0
- vgridpandas/h3pandas/util/__init__.py +0 -0
- vgridpandas/h3pandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/__pycache__/const.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/h3pandas/util/const.py +2 -0
- vgridpandas/h3pandas/util/decorator.py +97 -0
- vgridpandas/h3pandas/util/functools.py +8 -0
- vgridpandas/h3pandas/util/geometry.py +126 -0
- vgridpandas/isea4tpandas/__init__.py +1 -0
- vgridpandas/isea4tpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/isea4tpandas.py +171 -0
- vgridpandas/isea4tpandas/util/__init__.py +0 -0
- vgridpandas/isea4tpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/isea4tpandas/util/const.py +2 -0
- vgridpandas/isea4tpandas/util/decorator.py +97 -0
- vgridpandas/isea4tpandas/util/functools.py +8 -0
- vgridpandas/isea4tpandas/util/geometry.py +107 -0
- vgridpandas/maidenheadpandas/__init__.py +1 -0
- vgridpandas/maidenheadpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/georefpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/maidenheadpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/quadkeypandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/__pycache__/tilecodepandas.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/maidenheadpandas.py +171 -0
- vgridpandas/maidenheadpandas/util/__init__.py +0 -0
- vgridpandas/maidenheadpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/maidenheadpandas/util/const.py +2 -0
- vgridpandas/maidenheadpandas/util/decorator.py +97 -0
- vgridpandas/maidenheadpandas/util/functools.py +8 -0
- vgridpandas/maidenheadpandas/util/geometry.py +91 -0
- vgridpandas/mgrspandas/__init__.py +1 -0
- vgridpandas/mgrspandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/mgrspandas.py +171 -0
- vgridpandas/mgrspandas/util/__init__.py +0 -0
- vgridpandas/mgrspandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/mgrspandas/util/const.py +2 -0
- vgridpandas/mgrspandas/util/decorator.py +97 -0
- vgridpandas/mgrspandas/util/functools.py +8 -0
- vgridpandas/mgrspandas/util/geometry.py +115 -0
- vgridpandas/mgrspandas/util/gzd.geojson +1208 -0
- vgridpandas/olcpandas/__init__.py +1 -0
- vgridpandas/olcpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/olcpandas.py +171 -0
- vgridpandas/olcpandas/util/__init__.py +0 -0
- vgridpandas/olcpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/olcpandas/util/const.py +2 -0
- vgridpandas/olcpandas/util/decorator.py +97 -0
- vgridpandas/olcpandas/util/functools.py +8 -0
- vgridpandas/olcpandas/util/geometry.py +98 -0
- vgridpandas/qtmpandas/__init__.py +1 -0
- vgridpandas/qtmpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/qtmpandas.py +171 -0
- vgridpandas/qtmpandas/util/__init__.py +0 -0
- vgridpandas/qtmpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/qtmpandas/util/const.py +2 -0
- vgridpandas/qtmpandas/util/decorator.py +97 -0
- vgridpandas/qtmpandas/util/functools.py +8 -0
- vgridpandas/qtmpandas/util/geometry.py +86 -0
- vgridpandas/quadkeypandas/__init__.py +1 -0
- vgridpandas/quadkeypandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/georefpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/quadkeypandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/__pycache__/tilecodepandas.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/quadkeypandas.py +171 -0
- vgridpandas/quadkeypandas/util/__init__.py +0 -0
- vgridpandas/quadkeypandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/quadkeypandas/util/const.py +2 -0
- vgridpandas/quadkeypandas/util/decorator.py +97 -0
- vgridpandas/quadkeypandas/util/functools.py +8 -0
- vgridpandas/quadkeypandas/util/geometry.py +100 -0
- vgridpandas/rhealpixpandas/__init__.py +1 -0
- vgridpandas/rhealpixpandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/rhealpixpandas.py +172 -0
- vgridpandas/rhealpixpandas/util/__init__.py +0 -0
- vgridpandas/rhealpixpandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/rhealpixpandas/util/const.py +2 -0
- vgridpandas/rhealpixpandas/util/decorator.py +97 -0
- vgridpandas/rhealpixpandas/util/functools.py +8 -0
- vgridpandas/rhealpixpandas/util/geometry.py +99 -0
- vgridpandas/s2pandas/__init__.py +1 -0
- vgridpandas/s2pandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/__pycache__/s2pandas.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/s2pandas.py +893 -0
- vgridpandas/s2pandas/util/__init__.py +0 -0
- vgridpandas/s2pandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/s2pandas/util/const.py +2 -0
- vgridpandas/s2pandas/util/decorator.py +97 -0
- vgridpandas/s2pandas/util/functools.py +8 -0
- vgridpandas/s2pandas/util/geometry.py +98 -0
- vgridpandas/tilecodepandas/__init__.py +1 -0
- vgridpandas/tilecodepandas/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/easepandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/geohashpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/georefpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/isea4tpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/mgrspandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/olcpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/qtmpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/rhealpixpandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/__pycache__/tilecodepandas.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/tilecodepandas.py +171 -0
- vgridpandas/tilecodepandas/util/__init__.py +0 -0
- vgridpandas/tilecodepandas/util/__pycache__/__init__.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/util/__pycache__/decorator.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/util/__pycache__/functools.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/util/__pycache__/geometry.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/util/__pycache__/shapely.cpython-312.pyc +0 -0
- vgridpandas/tilecodepandas/util/const.py +2 -0
- vgridpandas/tilecodepandas/util/decorator.py +97 -0
- vgridpandas/tilecodepandas/util/functools.py +8 -0
- vgridpandas/tilecodepandas/util/geometry.py +101 -0
- vgridpandas-1.0.0.dist-info/METADATA +157 -0
- vgridpandas-1.0.0.dist-info/RECORD +272 -0
- vgridpandas-1.0.0.dist-info/WHEEL +5 -0
- vgridpandas-1.0.0.dist-info/licenses/LICENSE +21 -0
- vgridpandas-1.0.0.dist-info/top_level.txt +1 -0
vgridpandas/__init__.py
ADDED
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .easepandas import EASEPandas # noqa: F401
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from typing import Union, Callable, Sequence, Any
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import shapely
|
|
8
|
+
import pandas as pd
|
|
9
|
+
import geopandas as gpd
|
|
10
|
+
|
|
11
|
+
from vgrid.conversion.latlon2dggs import latlon2ease
|
|
12
|
+
from pandas.core.frame import DataFrame
|
|
13
|
+
from geopandas.geodataframe import GeoDataFrame
|
|
14
|
+
|
|
15
|
+
from .util.functools import wrapped_partial
|
|
16
|
+
from .util.geometry import cell_to_boundary
|
|
17
|
+
from .util.decorator import catch_invalid_ease_id
|
|
18
|
+
|
|
19
|
+
AnyDataFrame = Union[DataFrame, GeoDataFrame]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pd.api.extensions.register_dataframe_accessor("ease")
|
|
23
|
+
class EASEPandas:
|
|
24
|
+
def __init__(self, df: DataFrame):
|
|
25
|
+
self._df = df
|
|
26
|
+
|
|
27
|
+
# EASE API
|
|
28
|
+
# These methods simply mirror the Vgrid EASE API and apply EASE functions to all rows
|
|
29
|
+
|
|
30
|
+
def latlon2ease(
|
|
31
|
+
self,
|
|
32
|
+
resolution: int,
|
|
33
|
+
lat_col: str = "lat",
|
|
34
|
+
lon_col: str = "lon",
|
|
35
|
+
set_index: bool = True,
|
|
36
|
+
) -> AnyDataFrame:
|
|
37
|
+
"""Adds EASE ID to (Geo)DataFrame.
|
|
38
|
+
|
|
39
|
+
pd.DataFrame: uses `lat_col` and `lon_col` (default `lat` and `lon`)
|
|
40
|
+
gpd.GeoDataFrame: uses `geometry`
|
|
41
|
+
|
|
42
|
+
Assumes coordinates in epsg=4326.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
resolution : int
|
|
47
|
+
EASE resolution
|
|
48
|
+
lat_col : str
|
|
49
|
+
Name of the latitude column (if used), default 'lat'
|
|
50
|
+
lon_col : str
|
|
51
|
+
Name of the longitude column (if used), default 'lon'
|
|
52
|
+
set_index : bool
|
|
53
|
+
If True, the columns with EASE ID is set as index, default 'True'
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
(Geo)DataFrame with EASE IDs added
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
if not isinstance(resolution, int) or resolution not in range(0, 7):
|
|
61
|
+
raise ValueError("Resolution must be an integer in range [0, 6]")
|
|
62
|
+
|
|
63
|
+
if isinstance(self._df, gpd.GeoDataFrame):
|
|
64
|
+
lons = self._df.geometry.x
|
|
65
|
+
lats = self._df.geometry.y
|
|
66
|
+
else:
|
|
67
|
+
lons = self._df[lon_col]
|
|
68
|
+
lats = self._df[lat_col]
|
|
69
|
+
|
|
70
|
+
ease_ids = [
|
|
71
|
+
latlon2ease(lat, lon, resolution) for lat, lon in zip(lats, lons)
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
colname = self._format_resolution(resolution)
|
|
75
|
+
assign_arg = {colname: ease_ids}
|
|
76
|
+
df = self._df.assign(**assign_arg)
|
|
77
|
+
if set_index:
|
|
78
|
+
return df.set_index(colname)
|
|
79
|
+
return df
|
|
80
|
+
|
|
81
|
+
def ease2geo(self) -> GeoDataFrame:
|
|
82
|
+
"""Add `geometry` with EASE geometry to the DataFrame. Assumes EASE ID.
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
GeoDataFrame with EASE geometry
|
|
87
|
+
|
|
88
|
+
Raises
|
|
89
|
+
------
|
|
90
|
+
ValueError
|
|
91
|
+
When an invalid EASE ID is encountered
|
|
92
|
+
"""
|
|
93
|
+
return self._apply_index_assign(
|
|
94
|
+
wrapped_partial(cell_to_boundary),
|
|
95
|
+
"geometry",
|
|
96
|
+
finalizer=lambda x: gpd.GeoDataFrame(x, crs="epsg:4326"),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def _apply_index_assign(
|
|
100
|
+
self,
|
|
101
|
+
func: Callable,
|
|
102
|
+
column_name: str,
|
|
103
|
+
processor: Callable = lambda x: x,
|
|
104
|
+
finalizer: Callable = lambda x: x,
|
|
105
|
+
) -> Any:
|
|
106
|
+
"""Helper method. Applies `func` to index and assigns the result to `column`.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
func : Callable
|
|
111
|
+
single-argument function to be applied to each S2 Token
|
|
112
|
+
column_name : str
|
|
113
|
+
name of the resulting column
|
|
114
|
+
processor : Callable
|
|
115
|
+
(Optional) further processes the result of func. Default: identity
|
|
116
|
+
finalizer : Callable
|
|
117
|
+
(Optional) further processes the resulting dataframe. Default: identity
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
Dataframe with column `column` containing the result of `func`.
|
|
122
|
+
If using `finalizer`, can return anything the `finalizer` returns.
|
|
123
|
+
"""
|
|
124
|
+
func = catch_invalid_ease_id(func)
|
|
125
|
+
result = [processor(func(ease_id)) for ease_id in self._df.index]
|
|
126
|
+
assign_args = {column_name: result}
|
|
127
|
+
return finalizer(self._df.assign(**assign_args))
|
|
128
|
+
|
|
129
|
+
def _apply_index_explode(
|
|
130
|
+
self,
|
|
131
|
+
func: Callable,
|
|
132
|
+
column_name: str,
|
|
133
|
+
processor: Callable = lambda x: x,
|
|
134
|
+
finalizer: Callable = lambda x: x,
|
|
135
|
+
) -> Any:
|
|
136
|
+
"""Helper method. Applies a list-making `func` to index and performs
|
|
137
|
+
a vertical explode.
|
|
138
|
+
Any additional values are simply copied to all the rows.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
func : Callable
|
|
143
|
+
single-argument function to be applied to each S2 Token
|
|
144
|
+
column_name : str
|
|
145
|
+
name of the resulting column
|
|
146
|
+
processor : Callable
|
|
147
|
+
(Optional) further processes the result of func. Default: identity
|
|
148
|
+
finalizer : Callable
|
|
149
|
+
(Optional) further processes the resulting dataframe. Default: identity
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
Dataframe with column `column` containing the result of `func`.
|
|
154
|
+
If using `finalizer`, can return anything the `finalizer` returns.
|
|
155
|
+
"""
|
|
156
|
+
func = catch_invalid_ease_id(func)
|
|
157
|
+
result = (
|
|
158
|
+
pd.DataFrame.from_dict(
|
|
159
|
+
{ease_id: processor(func(ease_id)) for ease_id in self._df.index},
|
|
160
|
+
orient="index",
|
|
161
|
+
)
|
|
162
|
+
.stack()
|
|
163
|
+
.to_frame(column_name)
|
|
164
|
+
.reset_index(level=1, drop=True)
|
|
165
|
+
)
|
|
166
|
+
result = self._df.join(result)
|
|
167
|
+
return finalizer(result)
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def _format_resolution(resolution: int) -> str:
|
|
171
|
+
return f"ease_{str(resolution).zfill(2)}"
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
from functools import wraps
|
|
2
|
+
from typing import Callable, Iterator
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def catch_invalid_ease_id(f: Callable) -> Callable:
|
|
6
|
+
"""Wrapper that catches potential invalid EASE ID.
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
----------
|
|
10
|
+
f : Callable
|
|
11
|
+
|
|
12
|
+
Returns
|
|
13
|
+
-------
|
|
14
|
+
The return value of f, or a ValueError if f threw ValueError, TypeError,
|
|
15
|
+
or QTMCellError
|
|
16
|
+
|
|
17
|
+
Raises
|
|
18
|
+
------
|
|
19
|
+
ValueError
|
|
20
|
+
When an invalid EASE ID is encountered
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@wraps(f)
|
|
24
|
+
def safe_f(*args, **kwargs):
|
|
25
|
+
try:
|
|
26
|
+
return f(*args, **kwargs)
|
|
27
|
+
except (TypeError, ValueError) as e:
|
|
28
|
+
message = "EASE method raised an error. Is the EASE ID correct?"
|
|
29
|
+
message += f"\nCaller: {f.__name__}({_print_signature(*args, **kwargs)})"
|
|
30
|
+
message += f"\nOriginal error: {repr(e)}"
|
|
31
|
+
raise ValueError(message)
|
|
32
|
+
|
|
33
|
+
return safe_f
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def sequential_deduplication(func: Iterator[str]) -> Iterator[str]:
|
|
37
|
+
"""
|
|
38
|
+
Decorator that doesn't permit two consecutive items of an iterator
|
|
39
|
+
to be the same.
|
|
40
|
+
|
|
41
|
+
Parameters
|
|
42
|
+
----------
|
|
43
|
+
f : Callable
|
|
44
|
+
|
|
45
|
+
Returns
|
|
46
|
+
-------
|
|
47
|
+
Yields from f, but won't yield two items in a row that are the same.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
def inner(*args):
|
|
51
|
+
iterable = func(*args)
|
|
52
|
+
last = None
|
|
53
|
+
while (cell := next(iterable, None)) is not None:
|
|
54
|
+
if cell != last:
|
|
55
|
+
yield cell
|
|
56
|
+
last = cell
|
|
57
|
+
|
|
58
|
+
return inner
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
# TODO: Test
|
|
62
|
+
def doc_standard(column_name: str, description: str) -> Callable:
|
|
63
|
+
"""Wrapper to provide a standard apply-to-ease-id docstring"""
|
|
64
|
+
|
|
65
|
+
def doc_decorator(f):
|
|
66
|
+
@wraps(f)
|
|
67
|
+
def doc_f(*args, **kwargs):
|
|
68
|
+
return f(*args, **kwargs)
|
|
69
|
+
|
|
70
|
+
parameters = f.__doc__ or ""
|
|
71
|
+
|
|
72
|
+
doc = f"""Adds the column `{column_name}` {description}. Assumes ease ID.
|
|
73
|
+
{parameters}
|
|
74
|
+
Returns
|
|
75
|
+
-------
|
|
76
|
+
Geo(DataFrame) with `{column_name}` column added
|
|
77
|
+
|
|
78
|
+
Raises
|
|
79
|
+
------
|
|
80
|
+
ValueError
|
|
81
|
+
When an invalid ease address is encountered
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
doc_f.__doc__ = doc
|
|
85
|
+
return doc_f
|
|
86
|
+
|
|
87
|
+
return doc_decorator
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def _print_signature(*args, **kwargs):
|
|
91
|
+
signature = []
|
|
92
|
+
if args:
|
|
93
|
+
signature.append(", ".join([repr(a) for a in args]))
|
|
94
|
+
if kwargs:
|
|
95
|
+
signature.append(", ".join({f"{repr(k)}={repr(v)}" for k, v in kwargs.items()}))
|
|
96
|
+
|
|
97
|
+
return ", ".join(signature)
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
from typing import Union, Set, Iterator
|
|
2
|
+
from shapely.geometry import Polygon, MultiPolygon, LineString, MultiLineString
|
|
3
|
+
from shapely.wkt import loads
|
|
4
|
+
from shapely.ops import transform
|
|
5
|
+
from .decorator import sequential_deduplication
|
|
6
|
+
from vgrid.utils.easedggs.constants import levels_specs
|
|
7
|
+
from vgrid.utils.easedggs.dggs.grid_addressing import grid_ids_to_geos
|
|
8
|
+
|
|
9
|
+
MultiPolyOrPoly = Union[Polygon, MultiPolygon]
|
|
10
|
+
MultiLineOrLine = Union[LineString, MultiLineString]
|
|
11
|
+
|
|
12
|
+
def cell_to_boundary(ease_id: str) -> Polygon:
|
|
13
|
+
"""ease.ease_to_geo_boundary equivalent for shapely
|
|
14
|
+
|
|
15
|
+
Parameters
|
|
16
|
+
----------
|
|
17
|
+
ease_id : str
|
|
18
|
+
EASE ID to convert to a boundary
|
|
19
|
+
|
|
20
|
+
Returns
|
|
21
|
+
-------
|
|
22
|
+
Polygon representing the ease cell boundary
|
|
23
|
+
"""
|
|
24
|
+
# Base octahedral face definitions
|
|
25
|
+
level = int(ease_id[1])
|
|
26
|
+
level_spec = levels_specs[level]
|
|
27
|
+
n_row = level_spec["n_row"]
|
|
28
|
+
n_col = level_spec["n_col"]
|
|
29
|
+
geo = grid_ids_to_geos([ease_id])
|
|
30
|
+
center_lon, center_lat = geo["result"]["data"][0]
|
|
31
|
+
cell_min_lat = center_lat - (180 / (2 * n_row))
|
|
32
|
+
cell_max_lat = center_lat + (180 / (2 * n_row))
|
|
33
|
+
cell_min_lon = center_lon - (360 / (2 * n_col))
|
|
34
|
+
cell_max_lon = center_lon + (360 / (2 * n_col))
|
|
35
|
+
cell_polygon = Polygon(
|
|
36
|
+
[
|
|
37
|
+
[cell_min_lon, cell_min_lat],
|
|
38
|
+
[cell_max_lon, cell_min_lat],
|
|
39
|
+
[cell_max_lon, cell_max_lat],
|
|
40
|
+
[cell_min_lon, cell_max_lat],
|
|
41
|
+
[cell_min_lon, cell_min_lat],
|
|
42
|
+
]
|
|
43
|
+
)
|
|
44
|
+
return cell_polygon
|
|
45
|
+
|
|
46
|
+
# def polyfill(geometry: MultiPolyOrPoly, resolution: int) -> Set[str]:
|
|
47
|
+
# """ease.polyfill accepting a shapely (Multi)Polygon
|
|
48
|
+
|
|
49
|
+
# Parameters
|
|
50
|
+
# ----------
|
|
51
|
+
# geometry : Polygon or Multipolygon
|
|
52
|
+
# Polygon to fill
|
|
53
|
+
# resolution : int
|
|
54
|
+
# ease resolution of the filling cells
|
|
55
|
+
|
|
56
|
+
# Returns
|
|
57
|
+
# -------
|
|
58
|
+
# Set of ease addresses
|
|
59
|
+
|
|
60
|
+
# Raises
|
|
61
|
+
# ------
|
|
62
|
+
# TypeError if geometry is not a Polygon or MultiPolygon
|
|
63
|
+
# """
|
|
64
|
+
# if isinstance(geometry, (Polygon, MultiPolygon)):
|
|
65
|
+
# qtmshape = ease.geo_to_qtmshape(geometry)
|
|
66
|
+
# return set(ease.polygon_to_cells(qtmshape, resolution))
|
|
67
|
+
# else:
|
|
68
|
+
# raise TypeError(f"Unknown type {type(geometry)}")
|
|
69
|
+
|
|
70
|
+
# @sequential_deduplication
|
|
71
|
+
# def linetrace(geometry: MultiLineOrLine, resolution: int) -> Iterator[str]:
|
|
72
|
+
# """ease.polyfill equivalent for shapely (Multi)LineString
|
|
73
|
+
# Does not represent lines with duplicate sequential cells,
|
|
74
|
+
# but cells may repeat non-sequentially to represent
|
|
75
|
+
# self-intersections
|
|
76
|
+
|
|
77
|
+
# Parameters
|
|
78
|
+
# ----------
|
|
79
|
+
# geometry : LineString or MultiLineString
|
|
80
|
+
# Line to trace with ease cells
|
|
81
|
+
# resolution : int
|
|
82
|
+
# ease resolution of the tracing cells
|
|
83
|
+
|
|
84
|
+
# Returns
|
|
85
|
+
# -------
|
|
86
|
+
# Set of ease addresses
|
|
87
|
+
|
|
88
|
+
# Raises
|
|
89
|
+
# ------
|
|
90
|
+
# TypeError if geometry is not a LineString or a MultiLineString
|
|
91
|
+
# """
|
|
92
|
+
# if isinstance(geometry, MultiLineString):
|
|
93
|
+
# # Recurse after getting component linestrings from the multiline
|
|
94
|
+
# for line in map(lambda geom: linetrace(geom, resolution), geometry.geoms):
|
|
95
|
+
# yield from line
|
|
96
|
+
# elif isinstance(geometry, LineString):
|
|
97
|
+
# coords = zip(geometry.coords, geometry.coords[1:])
|
|
98
|
+
# while (vertex_pair := next(coords, None)) is not None:
|
|
99
|
+
# i, j = vertex_pair
|
|
100
|
+
# a = ease.latlng_to_cell(*i[::-1], resolution)
|
|
101
|
+
# b = ease.latlng_to_cell(*j[::-1], resolution)
|
|
102
|
+
# yield from ease.grid_path_cells(a, b) # inclusive of a and b
|
|
103
|
+
# else:
|
|
104
|
+
# raise TypeError(f"Unknown type {type(geometry)}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .garspandas import GARSPandas # noqa: F401
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
from typing import Union, Callable, Sequence, Any
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
4
|
+
from typing import Literal
|
|
5
|
+
|
|
6
|
+
import numpy as np
|
|
7
|
+
import shapely
|
|
8
|
+
import pandas as pd
|
|
9
|
+
import geopandas as gpd
|
|
10
|
+
|
|
11
|
+
from vgrid.conversion.latlon2dggs import latlon2gars
|
|
12
|
+
from pandas.core.frame import DataFrame
|
|
13
|
+
from geopandas.geodataframe import GeoDataFrame
|
|
14
|
+
|
|
15
|
+
from .util.functools import wrapped_partial
|
|
16
|
+
from .util.geometry import cell_to_boundary
|
|
17
|
+
from .util.decorator import catch_invalid_gars_id
|
|
18
|
+
|
|
19
|
+
AnyDataFrame = Union[DataFrame, GeoDataFrame]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@pd.api.extensions.register_dataframe_accessor("gars")
|
|
23
|
+
class GARSPandas:
|
|
24
|
+
def __init__(self, df: DataFrame):
|
|
25
|
+
self._df = df
|
|
26
|
+
|
|
27
|
+
# gars API
|
|
28
|
+
# These methods simply mirror the Vgrid gars API and apply gars functions to all rows
|
|
29
|
+
|
|
30
|
+
def latlon2gars(
|
|
31
|
+
self,
|
|
32
|
+
resolution: int,
|
|
33
|
+
lat_col: str = "lat",
|
|
34
|
+
lon_col: str = "lon",
|
|
35
|
+
set_index: bool = True,
|
|
36
|
+
) -> AnyDataFrame:
|
|
37
|
+
"""Adds gars ID to (Geo)DataFrame.
|
|
38
|
+
|
|
39
|
+
pd.DataFrame: uses `lat_col` and `lon_col` (default `lat` and `lon`)
|
|
40
|
+
gpd.GeoDataFrame: uses `geometry`
|
|
41
|
+
|
|
42
|
+
Assumes coordinates in epsg=4326.
|
|
43
|
+
|
|
44
|
+
Parameters
|
|
45
|
+
----------
|
|
46
|
+
resolution : int
|
|
47
|
+
gars resolution
|
|
48
|
+
lat_col : str
|
|
49
|
+
Name of the latitude column (if used), default 'lat'
|
|
50
|
+
lon_col : str
|
|
51
|
+
Name of the longitude column (if used), default 'lon'
|
|
52
|
+
set_index : bool
|
|
53
|
+
If True, the columns with gars ID is set as index, default 'True'
|
|
54
|
+
|
|
55
|
+
Returns
|
|
56
|
+
-------
|
|
57
|
+
(Geo)DataFrame with gars IDs added
|
|
58
|
+
"""
|
|
59
|
+
|
|
60
|
+
if not isinstance(resolution, int) or resolution not in range(1, 5):
|
|
61
|
+
raise ValueError("Resolution must be an integer in range [1, 4]")
|
|
62
|
+
|
|
63
|
+
if isinstance(self._df, gpd.GeoDataFrame):
|
|
64
|
+
lons = self._df.geometry.x
|
|
65
|
+
lats = self._df.geometry.y
|
|
66
|
+
else:
|
|
67
|
+
lons = self._df[lon_col]
|
|
68
|
+
lats = self._df[lat_col]
|
|
69
|
+
|
|
70
|
+
gars_ids = [
|
|
71
|
+
latlon2gars(lat, lon, resolution) for lat, lon in zip(lats, lons)
|
|
72
|
+
]
|
|
73
|
+
|
|
74
|
+
colname = self._format_resolution(resolution)
|
|
75
|
+
assign_arg = {colname: gars_ids}
|
|
76
|
+
df = self._df.assign(**assign_arg)
|
|
77
|
+
if set_index:
|
|
78
|
+
return df.set_index(colname)
|
|
79
|
+
return df
|
|
80
|
+
|
|
81
|
+
def gars2geo(self) -> GeoDataFrame:
|
|
82
|
+
"""Add `geometry` with gars geometry to the DataFrame. Assumes gars ID.
|
|
83
|
+
|
|
84
|
+
Returns
|
|
85
|
+
-------
|
|
86
|
+
GeoDataFrame with gars geometry
|
|
87
|
+
|
|
88
|
+
Raises
|
|
89
|
+
------
|
|
90
|
+
ValueError
|
|
91
|
+
When an invalid gars ID is encountered
|
|
92
|
+
"""
|
|
93
|
+
return self._apply_index_assign(
|
|
94
|
+
wrapped_partial(cell_to_boundary),
|
|
95
|
+
"geometry",
|
|
96
|
+
finalizer=lambda x: gpd.GeoDataFrame(x, crs="epsg:4326"),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
def _apply_index_assign(
|
|
100
|
+
self,
|
|
101
|
+
func: Callable,
|
|
102
|
+
column_name: str,
|
|
103
|
+
processor: Callable = lambda x: x,
|
|
104
|
+
finalizer: Callable = lambda x: x,
|
|
105
|
+
) -> Any:
|
|
106
|
+
"""Helper method. Applies `func` to index and assigns the result to `column`.
|
|
107
|
+
|
|
108
|
+
Parameters
|
|
109
|
+
----------
|
|
110
|
+
func : Callable
|
|
111
|
+
single-argument function to be applied to each S2 Token
|
|
112
|
+
column_name : str
|
|
113
|
+
name of the resulting column
|
|
114
|
+
processor : Callable
|
|
115
|
+
(Optional) further processes the result of func. Default: identity
|
|
116
|
+
finalizer : Callable
|
|
117
|
+
(Optional) further processes the resulting dataframe. Default: identity
|
|
118
|
+
|
|
119
|
+
Returns
|
|
120
|
+
-------
|
|
121
|
+
Dataframe with column `column` containing the result of `func`.
|
|
122
|
+
If using `finalizer`, can return anything the `finalizer` returns.
|
|
123
|
+
"""
|
|
124
|
+
func = catch_invalid_gars_id(func)
|
|
125
|
+
result = [processor(func(gars_id)) for gars_id in self._df.index]
|
|
126
|
+
assign_args = {column_name: result}
|
|
127
|
+
return finalizer(self._df.assign(**assign_args))
|
|
128
|
+
|
|
129
|
+
def _apply_index_explode(
|
|
130
|
+
self,
|
|
131
|
+
func: Callable,
|
|
132
|
+
column_name: str,
|
|
133
|
+
processor: Callable = lambda x: x,
|
|
134
|
+
finalizer: Callable = lambda x: x,
|
|
135
|
+
) -> Any:
|
|
136
|
+
"""Helper method. Applies a list-making `func` to index and performs
|
|
137
|
+
a vertical explode.
|
|
138
|
+
Any additional values are simply copied to all the rows.
|
|
139
|
+
|
|
140
|
+
Parameters
|
|
141
|
+
----------
|
|
142
|
+
func : Callable
|
|
143
|
+
single-argument function to be applied to each S2 Token
|
|
144
|
+
column_name : str
|
|
145
|
+
name of the resulting column
|
|
146
|
+
processor : Callable
|
|
147
|
+
(Optional) further processes the result of func. Default: identity
|
|
148
|
+
finalizer : Callable
|
|
149
|
+
(Optional) further processes the resulting dataframe. Default: identity
|
|
150
|
+
|
|
151
|
+
Returns
|
|
152
|
+
-------
|
|
153
|
+
Dataframe with column `column` containing the result of `func`.
|
|
154
|
+
If using `finalizer`, can return anything the `finalizer` returns.
|
|
155
|
+
"""
|
|
156
|
+
func = catch_invalid_gars_id(func)
|
|
157
|
+
result = (
|
|
158
|
+
pd.DataFrame.from_dict(
|
|
159
|
+
{gars_id: processor(func(gars_id)) for gars_id in self._df.index},
|
|
160
|
+
orient="index",
|
|
161
|
+
)
|
|
162
|
+
.stack()
|
|
163
|
+
.to_frame(column_name)
|
|
164
|
+
.reset_index(level=1, drop=True)
|
|
165
|
+
)
|
|
166
|
+
result = self._df.join(result)
|
|
167
|
+
return finalizer(result)
|
|
168
|
+
|
|
169
|
+
@staticmethod
|
|
170
|
+
def _format_resolution(resolution: int) -> str:
|
|
171
|
+
return f"gars_{str(resolution).zfill(2)}"
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|