A Python binding for GWmodel
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygwmodel-0.0.1-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: pygwmodel-0.0.1-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 13.3 MB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b862e7b876528614f7474c0ec797c2e1f70b5cb7a79fa2dad6326b09aebc470
|
|
| MD5 |
ec6113815d73505960c783a63c396493
|
|
| BLAKE2b-256 |
881edde2c51e668b611685d97eb114c79427da66ab58a0de2a341a501035b4c7
|
Provenance
The following attestation bundles were made for pygwmodel-0.0.1-cp312-abi3-win_amd64.whl:
Publisher:
cd.yml on GWmodel-Lab/pygwmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygwmodel-0.0.1-cp312-abi3-win_amd64.whl -
Subject digest:
0b862e7b876528614f7474c0ec797c2e1f70b5cb7a79fa2dad6326b09aebc470 - Sigstore transparency entry: 1666958613
- Sigstore integration time:
-
Permalink:
GWmodel-Lab/pygwmodel@217a6640f63ae3ab19785358465219475f0afc59 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/GWmodel-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@217a6640f63ae3ab19785358465219475f0afc59 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 46.1 MB
- Tags: CPython 3.12+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f826072e7bb41bd9ffd25ca02835995e82f4475ce89d706c8b4dd871c1bc092d
|
|
| MD5 |
839eae69f0462e9ae66e11634c1c8be4
|
|
| BLAKE2b-256 |
e5eaf7e630903685cb9a99a45c84e1db0d90deda08ba8b78f4547d725fe24b40
|
Provenance
The following attestation bundles were made for pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:
Publisher:
cd.yml on GWmodel-Lab/pygwmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl -
Subject digest:
f826072e7bb41bd9ffd25ca02835995e82f4475ce89d706c8b4dd871c1bc092d - Sigstore transparency entry: 1666958482
- Sigstore integration time:
-
Permalink:
GWmodel-Lab/pygwmodel@217a6640f63ae3ab19785358465219475f0afc59 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/GWmodel-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@217a6640f63ae3ab19785358465219475f0afc59 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl.
File metadata
- Download URL: pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl
- Upload date:
- Size: 14.1 MB
- Tags: CPython 3.12+, macOS 15.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
228f972af0f4455a51ce7a0817309a7bc0a83def3eeebe8f82ad29316029653f
|
|
| MD5 |
ee0149705973750108520e112d6ada25
|
|
| BLAKE2b-256 |
29827a52693bf78146b8106be510b127332bbf7a22e381442b8335fc97268360
|
Provenance
The following attestation bundles were made for pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl:
Publisher:
cd.yml on GWmodel-Lab/pygwmodel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl -
Subject digest:
228f972af0f4455a51ce7a0817309a7bc0a83def3eeebe8f82ad29316029653f - Sigstore transparency entry: 1666958371
- Sigstore integration time:
-
Permalink:
GWmodel-Lab/pygwmodel@217a6640f63ae3ab19785358465219475f0afc59 -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/GWmodel-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@217a6640f63ae3ab19785358465219475f0afc59 -
Trigger Event:
push
-
Statement type: