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_utc(datetime.astype(numpy.int64), 6)
print([hex(i) for i in index])

index = pystare.from_utc(datetime.astype(numpy.int64), 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

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

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

pystare-0.8.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

pystare-0.8.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.8 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

File details

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

File metadata

File hashes

Hashes for pystare-0.8.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e3a217bbd9a892fc4a02b91840c36eccaffa5db401df68b0c1adeb1de5e9f4a0
MD5 85a35a138cfff2dacbe3b575a462cfff
BLAKE2b-256 7de89da0bcc1176b3765ace6438557e1536c8068f73bb512aeaeb10030fcf147

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pystare-0.8.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8bf444425c2b1157580c38f12ff15c36a5c64fdddd4e9282c19b73ae569d85c9
MD5 140e40adf7fa6db62bae13482244f280
BLAKE2b-256 ed7c5cf4882189aea9d507e4cb3bf20a6010b731b17741b420e207df9753487e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pystare-0.8.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b0a1ccc692e03c7d954074ae4fa8b71752ea6d0d196cc8be9ae85e9ff5a1b958
MD5 43f13c617778d9992d74ad5057aff59b
BLAKE2b-256 83e3228df7056150d628c2288a06a5b6022942a391d4a96433733f70b1a8f76d

See more details on using hashes here.

File details

Details for the file pystare-0.8.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 3f8f19a226f6ab1d6feb5fb8444993e1707567b0a9abadb079e03595ef772a41
MD5 fae3a5b7c217acdeffd509932c37a1d4
BLAKE2b-256 867b1a82887faabd01d9ab53be356ea1831f90bb7a79e16ef99c15ce342ea509

See more details on using hashes here.

File details

Details for the file pystare-0.8.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for pystare-0.8.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 537cf4f57e34ecaf65a5f954e731c4a35721eb0939e4f1dddccf6f2503cf8227
MD5 87d358dd8198c0c52054c7ed124b2b29
BLAKE2b-256 00749f5db5fde50b6032b7a74e573d523eadda31fd44689d00b1fc537fdfc64e

See more details on using hashes here.

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