Skip to main content

Raster and shape tools

Project description

RasterToolkit

RasterToolkit is a Python package for processing rasters with minimal dependencies. For example, with rastertoolkit you can extract populations corresponding to an administrative shapefile from a raster file.

Setup

Install from github:

pip install git+https://github.com/InstituteforDiseaseModeling/RasterToolkit.git

Getting Started

A typical raster_clip API usage scenario:

    from rastertoolkit import raster_clip

    # Clipping raster with shapes  
    pop_dict = raster_clip(raster_file, shape_file)  

See the complete code in the WorldPop example (examples/worldpop)

A typical shape_subdivide API usage scenario:

    from rastertoolkit import shape_subdivide

    # Create shape subdivision layer
    subdiv_stem = shape_subdivide(shape_stem=shape_file)

See the complete code in the Shape Subdivision example (examples/shape_subdivide)

Developer Setup

  1. Clone or download this GitHub repo and navigate to the root directory.
    git clone git@github.com:InstituteforDiseaseModeling/RasterToolkit.git
    cd RasterToolkit
  1. Create a Python virtual environment (here useing uv; see https://astral.sh/uv/):
    uv venv --python 3.10
    source .venv/bin/activate
  1. Install this package in editable mode (this also installs all the requirements).::
    uv pip install -e .   

Running Tests

Install additional packages (like pytest)::

    uv pip install -r requirements-test.txt

Run pytest command::

    # Run unit tests (recommended during development)
    pytest -m unit -v

    # Run test for a specific module, for example
    pytest tests/test_shape.py -v     # run shape unit tests
    pytest tests/test_download.py -v  # run GDx download tests

    # All tests (before a commit or merging a PR)
    pytest -v

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

rastertoolkit-0.3.12.tar.gz (34.9 MB view details)

Uploaded Source

Built Distribution

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

rastertoolkit-0.3.12-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file rastertoolkit-0.3.12.tar.gz.

File metadata

  • Download URL: rastertoolkit-0.3.12.tar.gz
  • Upload date:
  • Size: 34.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rastertoolkit-0.3.12.tar.gz
Algorithm Hash digest
SHA256 5033f3c7990429aeffdf5c100da94987b86b8a75f7e0ab2853cbf413baec99e1
MD5 a4ee72fc0203c779b5e8e188fa782075
BLAKE2b-256 90855581d04b13bcd713c02f706650a12d36161711a2cc717f70c8b5644ac7b5

See more details on using hashes here.

Provenance

The following attestation bundles were made for rastertoolkit-0.3.12.tar.gz:

Publisher: publish_pypi.yml on InstituteforDiseaseModeling/RasterToolkit

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

File details

Details for the file rastertoolkit-0.3.12-py3-none-any.whl.

File metadata

  • Download URL: rastertoolkit-0.3.12-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rastertoolkit-0.3.12-py3-none-any.whl
Algorithm Hash digest
SHA256 37004518b1004933ef1abe400ea76727561e7937e74c2cab6a01b177a03198fd
MD5 f10459529f686bdaea4785d8e7fc816d
BLAKE2b-256 4293099110861d75748b58179bdf382da9c3ce2a02cd79b26b1fbfaf0dfbd654

See more details on using hashes here.

Provenance

The following attestation bundles were made for rastertoolkit-0.3.12-py3-none-any.whl:

Publisher: publish_pypi.yml on InstituteforDiseaseModeling/RasterToolkit

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