pygwmodel: Python wrappers for building geographically weighted models
Overview
This package includes techniques from a particular branch of spatial statistics, termed geographically weighted (GW) models. GW models suit situations when data are not described well by some global model, but where there are spatial regions where a suitably localized calibration provides a better description.
The goal of pygwmodel is to provide conscious and easy-to-use user interface to high-performance C++ implementations of GW models (see libgwmodel) based on GeoPandas. We believe with the newly designed interfaces and the underlying C++ core, users will get fluent experiences.
Installation
We highly recommend installing this package in a conda environment, especially on Windows.
conda install armadillo gsl openblas catch2 numpy geopandas nanobind scikit-build-core
git clone https://github.com/GWmodel-Lab/pygwmodel.git
pip install ./pygwmodel
On Windows, it is very important to use the OpenBLAS library instead of that bundled with Python to avoid segmentation fault.
To do so, set the environment variable CMAKE_ARGS:
# powershell
$Env:CMAKE_ARGS="-DBLA_VENDOR=OpenBLAS"
pip install .
In command line prompt, it can be done like this:
set CMAKE_ARGS="-DBLA_VENDOR=OpenBLAS"
pip install .
Or using the following line to install this package:
pip install . --config-settings=cmake.args=-DBLA_VENDOR=OpenBLAS
Getting started
from pygwmodel import GWRBasic, BandwidthWeight, CRSDistance
algorithm = GWRBasic(data, y, x,
weight=BandwidthWeight(36.0, adaptive=True),
distance=CRSDistance()).fit()
Multiscale GWR (MGWR) assigns a separate bandwidth to each predictor:
from pygwmodel import GWRMultiscale, BandwidthWeight
n_var = 4 # intercept + 3 predictors
weights = [BandwidthWeight(36.0, adaptive=True) for _ in range(n_var)]
algorithm = GWRMultiscale(data, y, x, weights=weights).fit()
print(algorithm.diagnostic)
For full usage, please see the unit tests in test directory and the
documentation <https://gwmodel-lab.github.io/pygwmodel/>_.
Related work
This package is based on a pure C++ library --- libgwmodel. This library implements all models, and pygwmodel just calls this package by translating inputs and outputs. Besides, it also provides some handy functions for the convenience of python users.
Getting help
If you encounter a bug, please create an issue here. It would be better for us if a minimal reproducible example is also provided.
Metadata
Release files for pygwmodel 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygwmodel-0.0.1-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details |
| pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl | CPython 3.12 | abi3 | macOS 15.0+ ARM64 | Details |
Total release size: 73.5 MB
Release files / pygwmodel-0.0.1-cp312-abi3-win_amd64.whl
| Download URL | pygwmodel-0.0.1-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 13.3 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0b862e7b876528614f7474c0ec797c2e1f70b5cb7a79fa2dad6326b09aebc470
|
|
BLAKE2b-256 checksum How to use checksums |
881edde2c51e668b611685d97eb114c79427da66ab58a0de2a341a501035b4c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 29, 2026.
Transparency logRelease files / pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 46.1 MB |
| Tags | CPython 3.12 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f826072e7bb41bd9ffd25ca02835995e82f4475ce89d706c8b4dd871c1bc092d
|
|
BLAKE2b-256 checksum How to use checksums |
e5eaf7e630903685cb9a99a45c84e1db0d90deda08ba8b78f4547d725fe24b40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 29, 2026.
Transparency logRelease files / pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl
| Download URL | pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl |
|---|---|
| Size | 14.1 MB |
| Tags | CPython 3.12 abi3 macOS 15.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
228f972af0f4455a51ce7a0817309a7bc0a83def3eeebe8f82ad29316029653f
|
|
BLAKE2b-256 checksum How to use checksums |
29827a52693bf78146b8106be510b127332bbf7a22e381442b8335fc97268360
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 29, 2026.
Transparency logSecurity for pygwmodel 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 3 files in this release have been uploaded with provenance metadata.
Attestation for pygwmodel-0.0.1-cp312-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.