pystare


Namepystare JSON
Version 0.8.13 PyPI version JSON
download
home_pagehttps://github.com/SpatioTemporal/pystare
SummaryPySTARE exposes the STARE library to python.
upload_time2023-10-13 21:25:15
maintainer
docs_urlNone
authorNiklasGriessbaum
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```bash
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:

```bash
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
 
```bash
pip install pystare
```

### Or install from source:

```bash
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

```shell
python3 setup.py build_ext --inplace 
python3 setup.py bdist_wheel
python3 setup.py sdist
```
    
## Tests
pystare uses [pytest](https://docs.pytest.org/en/6.2.x/). Pytest is configured in ```pytest.ini.```

Run ```pytest``` to run all tests.

To run the doctest,

```shell
pytest --doctest-modules 
```

To run tests of a specific module

```shell
pytest /path/to/module.py
```

## Documentation
pystare uses sphinx

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


## Usage

### Spatial
```python
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
```python
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`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SpatioTemporal/pystare",
    "name": "pystare",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "NiklasGriessbaum",
    "author_email": "griessbaum@ucsb.edu",
    "download_url": "",
    "platform": null,
    "description": "# PySTARE\n\n## Introduction\nPySTARE exposes the STARE library to python.\n\n\n## Requirements\nPystare requires STARE to be installed.\nIt expects either:\n\n- ```libSTARE.a``` in /usr/local/lib/ and STARE.h in /usr/local/include/ or\n- the variables STARE_LIB_DIR and STARE_INCLUDE_DIR to be set e.g. with:\n\n```bash\nexport STARE_INCLUDE_DIR=/path/to/directory-containing-stare.h/\nexport STARE_LIB_DIR=/path/to/directory-containing-stare.a/\n```\n\n\nBuild and install STARE e.g. with:\n\n```bash\ngit clone https://github.com/SpatioTemporal/STARE\ncd STARE\nmkdir build\ncd build\ncmake -DSTARE_INSTALL_LIBDIR=lib -DBUILD_SHARED_LIBS=NO ../\nmake -j4\nsudo make install\n```\n\n\nIt may be necessary to set PYTHON_INCLUDE_DIRS, if, for example, numpy\nheaders cannot be found.\n\n## Installation\nWheels for manylinux exist on pypi\n \n```bash\npip install pystare\n```\n\n### Or install from source:\n\n```bash\nexport STARE_INCLUDE_DIR=/path/to/directory-containing-stare.h/\nexport STARE_LIB_DIR=/path/to/directory-containing-stare.a/\n        \ngit clone https://github.com/SpatioTemporal/pystare \npip3 install pystare/\n```\n    \n### Manual build\n\n```shell\npython3 setup.py build_ext --inplace \npython3 setup.py bdist_wheel\npython3 setup.py sdist\n```\n    \n## Tests\npystare uses [pytest](https://docs.pytest.org/en/6.2.x/). Pytest is configured in ```pytest.ini.```\n\nRun ```pytest``` to run all tests.\n\nTo run the doctest,\n\n```shell\npytest --doctest-modules \n```\n\nTo run tests of a specific module\n\n```shell\npytest /path/to/module.py\n```\n\n## Documentation\npystare uses sphinx\n\n```bash\npip install sphinx-markdown-tables \n            sphinx-automodapi \n            myst_parser \n            nbsphinx \n            numpydoc \n            pydata-sphinx-theme\n```\n\n\n## Usage\n\n### Spatial\n```python\nimport numpy\nimport pystare\n    \n\nlat = numpy.array([30,45,60], dtype=numpy.double)\nlon = numpy.array([45,60,10], dtype=numpy.double)\n\nindices = pystare.from_latlon(lat, lon, 12)\nprint('0 indices: ', [hex(i) for i in indices])\n\nlat, lon = pystare.to_latlon(indices)\nprint(lat, lon)\n\nlat, lon, level = pystare.to_latlonlevel(indices)\nprint(lat, lon, level)\n\nlevel = pystare.to_level(indices)\nprint(level)\n\narea = pystare.to_area(indices)\nprint(area)\n```\n \n\n### Temporal\n```python\nimport numpy\nimport pystare\n\ndatetime = numpy.array(['1970-01-01T00:00:00', \n                        '2000-01-01T00:00:00', \n                        '2002-02-03T13:56:03.172', \n                        '2016-01-05T17:26:00.172'], dtype=numpy.datetime64)\nprint(datetime)\nprint(datetime.astype(numpy.int64))\n    \nindex = pystare.from_utc(datetime.astype(numpy.int64), 6)\nprint([hex(i) for i in index])\n\nindex = pystare.from_utc(datetime.astype(numpy.int64), 27)\nprint([hex(i) for i in index])\n\n```\n\n\n    \n### Common issues when building\n`undefined symbol`\n\n1. STARE and pystare out of sync. Are we building against the correct STARE version?\n2. Stale pystare targets. `python setup.py clean` might help\n3. Missing function headers in `PySTARE.h`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "PySTARE exposes the STARE library to python.",
    "version": "0.8.13",
    "project_urls": {
        "Bug Tracker": "https://github.com/SpatioTemporal/pystare/issues",
        "Homepage": "https://github.com/SpatioTemporal/pystare"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed7c5cf4882189aea9d507e4cb3bf20a6010b731b17741b420e207df9753487e",
                "md5": "140e40adf7fa6db62bae13482244f280",
                "sha256": "8bf444425c2b1157580c38f12ff15c36a5c64fdddd4e9282c19b73ae569d85c9"
            },
            "downloads": -1,
            "filename": "pystare-0.8.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "140e40adf7fa6db62bae13482244f280",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 3863829,
            "upload_time": "2023-10-13T21:25:15",
            "upload_time_iso_8601": "2023-10-13T21:25:15.669390Z",
            "url": "https://files.pythonhosted.org/packages/ed/7c/5cf4882189aea9d507e4cb3bf20a6010b731b17741b420e207df9753487e/pystare-0.8.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7de89da0bcc1176b3765ace6438557e1536c8068f73bb512aeaeb10030fcf147",
                "md5": "85a35a138cfff2dacbe3b575a462cfff",
                "sha256": "e3a217bbd9a892fc4a02b91840c36eccaffa5db401df68b0c1adeb1de5e9f4a0"
            },
            "downloads": -1,
            "filename": "pystare-0.8.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "85a35a138cfff2dacbe3b575a462cfff",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 3877245,
            "upload_time": "2023-10-13T21:25:17",
            "upload_time_iso_8601": "2023-10-13T21:25:17.785705Z",
            "url": "https://files.pythonhosted.org/packages/7d/e8/9da0bcc1176b3765ace6438557e1536c8068f73bb512aeaeb10030fcf147/pystare-0.8.13-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "00749f5db5fde50b6032b7a74e573d523eadda31fd44689d00b1fc537fdfc64e",
                "md5": "87d358dd8198c0c52054c7ed124b2b29",
                "sha256": "537cf4f57e34ecaf65a5f954e731c4a35721eb0939e4f1dddccf6f2503cf8227"
            },
            "downloads": -1,
            "filename": "pystare-0.8.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "87d358dd8198c0c52054c7ed124b2b29",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 3837894,
            "upload_time": "2023-10-13T21:25:20",
            "upload_time_iso_8601": "2023-10-13T21:25:20.370894Z",
            "url": "https://files.pythonhosted.org/packages/00/74/9f5db5fde50b6032b7a74e573d523eadda31fd44689d00b1fc537fdfc64e/pystare-0.8.13-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "867b1a82887faabd01d9ab53be356ea1831f90bb7a79e16ef99c15ce342ea509",
                "md5": "fae3a5b7c217acdeffd509932c37a1d4",
                "sha256": "3f8f19a226f6ab1d6feb5fb8444993e1707567b0a9abadb079e03595ef772a41"
            },
            "downloads": -1,
            "filename": "pystare-0.8.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "fae3a5b7c217acdeffd509932c37a1d4",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 3853089,
            "upload_time": "2023-10-13T21:25:22",
            "upload_time_iso_8601": "2023-10-13T21:25:22.919685Z",
            "url": "https://files.pythonhosted.org/packages/86/7b/1a82887faabd01d9ab53be356ea1831f90bb7a79e16ef99c15ce342ea509/pystare-0.8.13-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83e3228df7056150d628c2288a06a5b6022942a391d4a96433733f70b1a8f76d",
                "md5": "43f13c617778d9992d74ad5057aff59b",
                "sha256": "b0a1ccc692e03c7d954074ae4fa8b71752ea6d0d196cc8be9ae85e9ff5a1b958"
            },
            "downloads": -1,
            "filename": "pystare-0.8.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "has_sig": false,
            "md5_digest": "43f13c617778d9992d74ad5057aff59b",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 3862968,
            "upload_time": "2023-10-13T21:25:24",
            "upload_time_iso_8601": "2023-10-13T21:25:24.882630Z",
            "url": "https://files.pythonhosted.org/packages/83/e3/228df7056150d628c2288a06a5b6022942a391d4a96433733f70b1a8f76d/pystare-0.8.13-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-13 21:25:15",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SpatioTemporal",
    "github_project": "pystare",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "pystare"
}
        
Elapsed time: 0.25562s