Skip to main content

rHP-Pandas

Package rhppandas intends to recreate for rHEALPix what h3pandas, developed by Daniel Jahn (https://github.com/DahnJ/H3-Pandas), does for h3-py, the Python binding for Uber's H3 DGGS. It provides a bridge between package rhealpixdggs and the dataframes used by pandas and geopandas.

Comments, bug reports and suggestions are all welcome.

In other words: the package in its current form is mostly meant for developers, or maybe for experienced end users.

Conda Environment

Use yaml file environment.yml to create a conda environment for basic use if you'd like to give the package a spin.

Adding yaml file environment-dev.yml to your conda environment will add the packages you need to run the automated tests.

Usage Examples

Using a basic dataframe with lat/lng coordinates:

> from rhppandas import rhppandas
> import pandas as pd
>
> basic_dataframe = pd.DataFrame({"lat": [50, 51], "lng": [14, 15]})
> basic_dataframe
       lat  lng
    0   50   14
    1   51   15
  • Add rhealpixdggs cell indices as the first column in the dataframe:
> geo2rhp = basic_dataframe.rhp.geo_to_rhp(9)
> geo2rhp
               lat  lng
    rhp_09              
    N216055147   50   14
    N208518546   51   15
  • Turn DGGS cell indices into points and add them in the geometry column:
> rhp2geo = geo2rhp.rhp.rhp_to_geo()
> rhp2geo
                lat  lng                   geometry
    rhp_09                                         
    N216055147   50   14    POINT (14.0006 49.9997)
    N208518546   51   15  POINT (15.00186 50.99928)
  • Add cell boundaries as the geometry column:
> rhp2geoboundary = geo2rhp.rhp.rhp_to_geo_boundary()
> rhp2geoboundary
                lat  lng                                           geometry
    rhp_09                                                                 
    N216055147   50   14  POLYGON ((13.99601 50.00223, 14.00145 50.00223...
    N208518546   51   15  POLYGON ((14.99721 51.0018, 15.00279 51.0018, ...
  • Add a colum with cell resolutions to the dataframe:
> withresolution = geo2rhp.rhp.rhp_get_resolution()
> withresolution
                lat  lng  rhp_resolution
    rhp_09                              
    N216055147   50   14               9
    N208518546   51   15               9
  • Add a column with the parent cell at resolution 0:
> withbasecell = geo2rhp.rhp.rhp_get_base_cell()
> withbasecell
                lat  lng rhp_base_cell
    rhp_09                            
    N216055147   50   14             N
    N208518546   51   15             N
  • Add a column with the parent cell indices at resolution 5:
> withparent = geo2rhp.rhp.rhp_to_parent(5)
> withparent
                lat  lng  rhp_05
    rhp_09                      
    N216055147   50   14  N21605
    N208518546   51   15  N20851
  • Add a column with the cell area:
> withcellarea = geo2rhp.rhp.cell_area()
> withcellarea
                lat  lng  rhp_cell_area
    rhp_09                             
    N216055147   50   14       0.219428
    N208518546   51   15       0.219428

Running Tests

rhppandas uses pytest as its test framework. Make sure that your environment includes both environment.yml and environment-dev.yml and is activated. Then type pytest in a shell with the active conda environment.

Typing pytest --cov will run the tests and print some info on test coverage of the code base.

Deployment

There is a PyPI and conda package rhppandas. The conda package is maintained at conda-forge.

Metadata

Release files for rhppandas 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rhppandas 0.3.0
File Size Uploaded
rhppandas-0.3.0.tar.gz 26.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rhppandas 0.3.0
File Interpreter ABI Platform
rhppandas-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.2 kB

Release files / rhppandas-0.3.0.tar.gz

Download URL rhppandas-0.3.0.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
775ed4af085107fe913f98393c2b54dde69195b3ad7aa7f2db6a45d46bfd5f02
BLAKE2b-256 checksum
How to use checksums
822daacf1f28f5495868debc7711ef61784aae3a9da37a2156a7b99e682b6557
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release files / rhppandas-0.3.0-py3-none-any.whl

Download URL rhppandas-0.3.0-py3-none-any.whl
Size 22.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e9e5e774c519b9ad538e7519e15bab1b19fc4f81612da830dacf35f0f925d1e
BLAKE2b-256 checksum
How to use checksums
df9ceb9d7d768c6f958d5fd17e74eb0550099ab83dc4fd36ab2788e92926ba26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.12

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.1

2 release files

This release

0.3.0 This release

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page