Skip to main content

Regional growth, convergence, and inequality analysis on the PySAL stack.

Project description

geometrics

CI Docs PyPI Python License: MIT Ruff Open In Colab

geometrics studies regional growth, convergence, and inequality with explicit spatial methods. It builds on the excellent PySAL family — libpysal, esda, giddy, inequality, mapclassify, spreg, and mgwr — and wraps the standard analyses of the regional convergence literature into illustrative, easy-to-apply functions that return interactive Plotly figures, Great Tables, and tidy DataFrames.

It follows the design language of expdpy: every function returns a typed result object with .df, .fig, plain-language .interpret(), and concept .explain().

The data model: three inputs

Input What it is How it enters
gdf Geometry with only the entity ID — shapefile, zipped shapefile, GeoJSON, or GeoPackage (or a GeoDataFrame) gm.read_gdf("districts.gpkg", entity="district_id")
df A long-form panel — one row per (entity, time) gm.set_panel(df, entity="district_id", time="year")
df_dict A data dictionaryvar_name, var_def, label, type, role, can_be_na gm.set_labels(df, df_dict, set_panel=True)

Installation

pip install geometrics                 # core
pip install "geometrics[dynamics]"     # + Markov / spatial Markov (giddy)
pip install "geometrics[all]"          # everything, incl. PNG export

Bundled case studies

  • India — 520 districts observed by satellite nighttime lights (1996-2010), from Mendez, Kabiraj & Li (quarcs-lab/project2025s-py): gm.data.load_india(), load_india_states()
  • Bolivia — PWT-anchored local GDP (2021 PPP US$, 2012-2022) at three scales, derived from Rossi-Hansberg & Zhang (2026) and Penn World Table 11.0: gm.data.load_bolivia() (112 provinces), load_bolivia_departments() (9 departments), load_bolivia_grid() (1,603 cells) — see datasets/ for the citation-grade documentation

Quickstart: the Indian case study

import geometrics as gm

gdf, df, df_dict = gm.data.load_india()      # ID-only geometry, long panel, dictionary
df = gm.set_labels(df, df_dict, set_panel=True)

gm.explore_choropleth_map(df, "ntl_total", gdf=gdf, period=2010).fig
w = gm.make_weights(gdf, method="knn", k=6)
gm.explore_lisa_cluster_map(df, "log_ntl_pc_1996", gdf=gdf, w=w).fig

res = gm.analyze_beta_convergence(
    df, "ntl_total", model="sdm", gdf=gdf, w=w
)
print(res.interpret())                       # plain-language reading
res.fig                                      # convergence scatter

Features

  • Maps & ESDA — classified/animated choropleths (explore_choropleth_map), weights connectivity (explore_connectivity_map), Moran scatterplots, LISA cluster maps, Moran over time
  • Space-time dynamics — cross-sectional distribution evolution (explore_distribution_over_time), entity-by-time heatmaps
  • Convergence — β-convergence with OLS or spatial (SAR/SEM/SLX/SDM) estimators and LeSage-Pace impact decomposition, σ-convergence, Phillips-Sul convergence clubs with club maps
  • Spatial econometrics — the spreg suite (analyze_spatial_model), LM diagnostics with a model recommendation (analyze_spatial_diagnostics), alternative-weights robustness (analyze_spatial_model_by_weights)
  • Distribution dynamics — Markov and spatial Markov transition analysis (analyze_markov_transitions, analyze_spatial_markov)
  • Inequality — Gini/Theil trends with spatial decomposition (analyze_inequality_over_time), Theil between/within decomposition (analyze_theil_decomposition)
  • Local models — GWR and multiscale GWR with mapped local coefficients (analyze_gwr, analyze_mgwr)

Documentation

Development

git clone https://github.com/quarcs-lab/geometrics
cd geometrics
uv sync --locked --all-extras --group dev --group docs
make test && make lint && make typecheck

Citation

If you use geometrics in your research, please cite the repository (see CITATION.cff) and the underlying PySAL packages.

Acknowledgments

Developed at the QuaRCS Lab (Quantitative Regional and Computational Science). geometrics stands on the shoulders of the PySAL project, geopandas, Plotly, and Great Tables.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geometrics-0.1.1.tar.gz (312.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geometrics-0.1.1-py3-none-any.whl (217.0 kB view details)

Uploaded Python 3

File details

Details for the file geometrics-0.1.1.tar.gz.

File metadata

  • Download URL: geometrics-0.1.1.tar.gz
  • Upload date:
  • Size: 312.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geometrics-0.1.1.tar.gz
Algorithm Hash digest
SHA256 15622389357bbf8dc0abf6838172f3edbce07ec91fb044334c00a1592adf4c36
MD5 78312eac9c66798216156b9854df06ab
BLAKE2b-256 efd7105e203a7b40096f46d26e7eded5f72076ae1c041bc76266452bcab6ff7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for geometrics-0.1.1.tar.gz:

Publisher: release.yml on quarcs-lab/geometrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file geometrics-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: geometrics-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 217.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geometrics-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbeb89799e31dacb16e228dbac65345c4aa01a0a5fc1257016a171bad16454ce
MD5 849a36caa2d967884695bcc6c959abd2
BLAKE2b-256 9acaea5525e53f23aaa2d948ba9169b3c6316285f2f1432dae002bddcb4b2fab

See more details on using hashes here.

Provenance

The following attestation bundles were made for geometrics-0.1.1-py3-none-any.whl:

Publisher: release.yml on quarcs-lab/geometrics

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page