Skip to main content

Rasterize vector features to grids

Project description

Rastafari

Rasterize vector features. This library is built to rasterize emission sources in the CLAIR air quality modelling system. In contrast to most available libraries used to rasterize vector features, this library produces rasters with weights proportional to the fraction of each cell that is covered by a feature.

Features:

  • line rasterization using DDA algorithm, producing weights proportional to fraction of line intersected by each cell
  • polygon rasterization using even-odd rule, producing weights proportional to fraction of polygon included in each cell
  • mass-consistent resampling of a raster using inverse nearest neighbour algorithm, allowing for different projections in source and target

See rastafari/tests for examples.

Install

Use pip to install Rastafari:

python -m pip install rastafari

Development

To install Rastafari in a local venv for development, run:

git clone https://gitlab.com/foclair/rastafari.git
cd rastafari
python -m venv .venv
. .venv/bin/activate
python -m pip install -U pip
python -m pip install cython wheel
RASTAFARI_USE_CYTHON=1 python -m pip install --no-build-isolation -e .[test]

Rastafari uses pre-commit. Install it and run pre-commit install to run its checks every time you commit. Run the checks manually with

pre-commit run -a

pytest is used as a test runner:

pytest

Rastafari comes fully typed. Use mypy to check the type annotations:

mypy .

All these tools will be run in CI in case you forget.

Maintenance

This package is maintained by David Segersson at SMHI.

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

rastafari-0.2.3.tar.gz (169.2 kB view hashes)

Uploaded Source

Built Distributions

rastafari-0.2.3-pp310-pypy310_pp73-win_amd64.whl (81.7 kB view hashes)

Uploaded PyPy Windows x86-64

rastafari-0.2.3-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (97.8 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-pp310-pypy310_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (98.9 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

rastafari-0.2.3-pp39-pypy39_pp73-win_amd64.whl (81.7 kB view hashes)

Uploaded PyPy Windows x86-64

rastafari-0.2.3-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (97.7 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-pp39-pypy39_pp73-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (98.6 kB view hashes)

Uploaded PyPy manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

rastafari-0.2.3-cp312-cp312-win_amd64.whl (87.9 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

rastafari-0.2.3-cp312-cp312-win32.whl (76.9 kB view hashes)

Uploaded CPython 3.12 Windows x86

rastafari-0.2.3-cp312-cp312-musllinux_1_1_x86_64.whl (601.0 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

rastafari-0.2.3-cp312-cp312-musllinux_1_1_i686.whl (563.2 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

rastafari-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (602.3 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (573.2 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

rastafari-0.2.3-cp311-cp311-win_amd64.whl (87.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

rastafari-0.2.3-cp311-cp311-win32.whl (76.0 kB view hashes)

Uploaded CPython 3.11 Windows x86

rastafari-0.2.3-cp311-cp311-musllinux_1_1_x86_64.whl (597.8 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

rastafari-0.2.3-cp311-cp311-musllinux_1_1_i686.whl (563.5 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

rastafari-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (592.5 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (568.3 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

rastafari-0.2.3-cp310-cp310-win_amd64.whl (87.1 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

rastafari-0.2.3-cp310-cp310-win32.whl (76.2 kB view hashes)

Uploaded CPython 3.10 Windows x86

rastafari-0.2.3-cp310-cp310-musllinux_1_1_x86_64.whl (551.1 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

rastafari-0.2.3-cp310-cp310-musllinux_1_1_i686.whl (522.3 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

rastafari-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (548.0 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (528.3 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

rastafari-0.2.3-cp39-cp39-win_amd64.whl (87.7 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

rastafari-0.2.3-cp39-cp39-win32.whl (76.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

rastafari-0.2.3-cp39-cp39-musllinux_1_1_x86_64.whl (553.8 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

rastafari-0.2.3-cp39-cp39-musllinux_1_1_i686.whl (524.8 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

rastafari-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (549.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

rastafari-0.2.3-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl (531.0 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686 manylinux: glibc 2.5+ i686

Supported by

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