Skip to main content

PySTARE exposes the STARE library to python.

Project description

PySTARE

Introduction

PySTARE exposes the STARE library to python.

Requirements

Pystare requires STARE to be installed. It expects either:

  • libSTARE.a in /usr/local/lib/ and STARE.h in /usr/local/include/ or
  • the variables STARE_LIB_DIR and STARE_INCLUDE_DIR to be set e.g. with:
export STARE_INCLUDE_DIR=/path/to/directory-containing-stare.h/
export STARE_LIB_DIR=/path/to/directory-containing-stare.a/

Build and install STARE e.g. with:

git clone https://github.com/SpatioTemporal/STARE
cd STARE
mkdir build
cd build
cmake -DSTARE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=NO ../
make -j4
sudo make install

It may be necessary to set PYTHON_INCLUDE_DIRS, if, for example, numpy headers cannot be found.

Installation

Wheels for manylinux exist on pypi

pip install pystare

Or install from source:

export STARE_INCLUDE_DIR=/path/to/directory-containing-stare.h/
export STARE_LIB_DIR=/path/to/directory-containing-stare.a/
        
git clone https://github.com/SpatioTemporal/pystare 
pip3 install pystare/

Manual build

python3 setup.py build_ext --inplace 
python3 setup.py bdist_wheel
python3 setup.py sdist

Tests

pystare uses pytest. Pytest is configured in pytest.ini.

Run pytest to run all tests.

To run the doctest,

pytest --doctest-modules 

To run tests of a specific module

pytest /path/to/module.py

Documentation

pystare uses sphinx

pip install sphinx-markdown-tables 
            sphinx-automodapi 
            myst_parser 
            nbsphinx 
            numpydoc 
            pydata-sphinx-theme

Usage

Spatial

import numpy
import pystare
    

lat = numpy.array([30,45,60], dtype=numpy.double)
lon = numpy.array([45,60,10], dtype=numpy.double)

indices = pystare.from_latlon(lat, lon, 12)
print('0 indices: ', [hex(i) for i in indices])

lat, lon = pystare.to_latlon(indices)
print(lat, lon)

lat, lon, level = pystare.to_latlonlevel(indices)
print(lat, lon, level)

level = pystare.to_level(indices)
print(level)

area = pystare.to_area(indices)
print(area)

Temporal

import numpy
import pystare

datetime = numpy.array(['1970-01-01T00:00:00', 
                        '2000-01-01T00:00:00', 
                        '2002-02-03T13:56:03.172', 
                        '2016-01-05T17:26:00.172'], dtype=numpy.datetime64)
print(datetime)
print(datetime.astype(numpy.int64))
    
index = pystare.from_ms_since_epoch_utc(datetime.astype(numpy.int64), 6, 6)
print([hex(i) for i in index])

index = pystare.from_ms_since_epoch_utc(datetime.astype(numpy.int64), 27, 27)
print([hex(i) for i in index])

Common issues when building

undefined symbol

  1. STARE and pystare out of sync. Are we building against the correct STARE version?
  2. Stale pystare targets. python setup.py clean might help
  3. Missing function headers in PySTARE.h

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.

pystare-0.8.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

pystare-0.8.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

pystare-0.8.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

pystare-0.8.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

pystare-0.8.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

File details

Details for the file pystare-0.8.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.16-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ccd93d698ddae5ef5f031253551af3cea2ed8b9b65e3f2fcd3b523df3590d0c
MD5 628218ad53455bf865f63b677bb482f7
BLAKE2b-256 65f9a0efaf9ad86ceaab913bb07115d1bf1797c466acebbcbaf461e39a79f011

See more details on using hashes here.

File details

Details for the file pystare-0.8.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.16-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0f78e2420d2691ee098cd788e55965fb3a03981b68204604ae5eca8f4095a674
MD5 5b1bae6f1fa778ffdb19f0b793edad3a
BLAKE2b-256 91641312c99f77474af8863d9c8d25f3d5026d0c1e92441440f05cd2742c8726

See more details on using hashes here.

File details

Details for the file pystare-0.8.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.16-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e7fad7456b521aec35c4a3abd4c79a0fe2f55dd85a0a320986ff36989595041a
MD5 bcdb9090d31d909baf435f2119cfc910
BLAKE2b-256 97a2189687a022fcec61835745c2187c0cba532431ce23ecfee6a4ffa54b19f7

See more details on using hashes here.

File details

Details for the file pystare-0.8.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.16-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 26733cb0bf7768d686799f0263a166790213925354abc2db6098a57fbf5b5497
MD5 25f16bfcf61e5ae101fa8a206d94aee6
BLAKE2b-256 22e547f1cbcc0ef53f4fc1a5a8bd73d4fbcf6f595fe7d11ff64af01b0bfe8d84

See more details on using hashes here.

File details

Details for the file pystare-0.8.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.16-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8c50aa9074bb8926377f48ff19fea7bdbcab15b7d9743dc7cec1c1a8b89b3555
MD5 b39aaae3d3d071f2f3976a66c5a85ca8
BLAKE2b-256 d060b194ecf1a9e3ec7e2da5af72d800e48753598fd80576a1f57727f3f6900e

See more details on using hashes here.

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