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 ../
make
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==0.8.1
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.
Runpytest
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
print('Spatial tests')
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
print('Datetime tests')
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])
Project details
Release history Release notifications | RSS feed
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
Close
Hashes for pystare-0.8.2-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b24068a7a62787fc3974e8feee712f99496e1c84cf8a28f2558482a5513bfb2f |
|
MD5 | 83628aa47464b82d9d543019c8aac29d |
|
BLAKE2b-256 | f64effd6d8228307ad484e4ebafabd7c25d02eab188105604ed31735d9d83c51 |
Close
Hashes for pystare-0.8.2-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26ec363667b9f9bb7bb17a1e97e15eec2f80c3380a207e7574f5c085452c0565 |
|
MD5 | f570a47d296e2e9d41ebe6a6447d4bc8 |
|
BLAKE2b-256 | 37c89980049789e6ecf77f56a7ab7bbefdbb621776ecff3ffcfe36c7eb666a4b |
Close
Hashes for pystare-0.8.2-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e9c28fd2c4ddb19dd996f3a25c82f3d2108daccc51a1ecdfedde059efe5e5eb |
|
MD5 | 265dbe6f432dc77d5efd58c64540af0a |
|
BLAKE2b-256 | de64e6a741d393470d3bff9a109a9687938c7e6ccddc8202fb486fb047024361 |
Close
Hashes for pystare-0.8.2-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5732c27c122a56c78f8bb1475b9a17daee3c8768e93f717639fab608a419d31b |
|
MD5 | 8ae58582488c975a60d91d1f864b11a8 |
|
BLAKE2b-256 | e9ee1400447fe3fb0c784da3047bc2a514d5f08a319768174211f6bc4c102307 |