Skip to main content

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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

pygwmodel-0.0.1-cp312-abi3-win_amd64.whl (13.3 MB view details)

Uploaded CPython 3.12+Windows x86-64

pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (46.1 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl (14.1 MB view details)

Uploaded CPython 3.12+macOS 15.0+ ARM64

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

Hashes for pygwmodel-0.0.1-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 0b862e7b876528614f7474c0ec797c2e1f70b5cb7a79fa2dad6326b09aebc470
MD5 ec6113815d73505960c783a63c396493
BLAKE2b-256 881edde2c51e668b611685d97eb114c79427da66ab58a0de2a341a501035b4c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for pygwmodel-0.0.1-cp312-abi3-win_amd64.whl:

Publisher: cd.yml on GWmodel-Lab/pygwmodel

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

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

File hashes

Hashes for pygwmodel-0.0.1-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f826072e7bb41bd9ffd25ca02835995e82f4475ce89d706c8b4dd871c1bc092d
MD5 839eae69f0462e9ae66e11634c1c8be4
BLAKE2b-256 e5eaf7e630903685cb9a99a45c84e1db0d90deda08ba8b78f4547d725fe24b40

See more details on using hashes here.

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

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

File details

Details for the file pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for pygwmodel-0.0.1-cp312-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 228f972af0f4455a51ce7a0817309a7bc0a83def3eeebe8f82ad29316029653f
MD5 ee0149705973750108520e112d6ada25
BLAKE2b-256 29827a52693bf78146b8106be510b127332bbf7a22e381442b8335fc97268360

See more details on using hashes here.

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

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