pyhigh


Namepyhigh JSON
Version 0.0.6 PyPI version JSON
download
home_pagehttps://github.com/sgherbst/pyhigh
SummaryPython library to get elevation data
upload_time2024-08-23 03:51:19
maintainerNone
docs_urlNone
authorSteven Herbst
requires_python>=3.7
licenseMIT
keywords elevation
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pyhigh
[![Actions Status](https://github.com/sgherbst/pyhigh/workflows/Regression/badge.svg)](https://github.com/sgherbst/pyhigh/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![PyPI version](https://badge.fury.io/py/pyhigh.svg)](https://badge.fury.io/py/pyhigh)

``pyhigh`` is a Python package for accessing elevation data, which is retrieved from a [USGS dataset](https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/).  The package uses caching to avoid unecessary downloads from the USGS dataset, but please respect their download policies.

## Installation

```shell
> pip install pyhigh
```

## Usage

### Command-line utility

The ``pyhigh`` Python package includes a command-line tool of the same name to retreive the elevation at a particular latitude and longitude:

```shell
> pyhigh --lat 36.52011 --lon -118.671
1884
```

As necessary, files will be download from a USGS dataset and cache in the folder ``pyhigh/pyhigh/.cache``.  To clear this cache, use the ``--clean`` argument:

```shell
> pyhigh --clean
```

### Python API

The ``get_elevation`` function returns the elevation, in meters, at the given latitude and longitude.

```python
>>> from pyhigh import get_elevation
>>> get_elevation(lat=36.52011, lon=-118.671)
1884
```

It is also possible to request a bunch elevations for a bunch of latitudes and longitudes at once.  The result returned is a NumPy array of elevations.

```python
>>> from pyhigh import get_elevation_batch
>>> get_elevation_batch([(36.52011, -118.671),
...                      (36.62011, -118.771)])
array([1884., 2438.])
```
This is more efficient than individual calls to ``get_elevation`` because elevation reads are pooled together to avoid reading the same ``*.hgt`` file multiple times.

Finally, the ``pyhigh`` cache of ``*.hgt`` files can be cleared with the API function ``clear_cache``:

```python
>>> from pyhigh import clear_cache
>>> clear_cache()
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/sgherbst/pyhigh",
    "name": "pyhigh",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "elevation",
    "author": "Steven Herbst",
    "author_email": "sherbst@stanford.edu",
    "download_url": "https://files.pythonhosted.org/packages/db/8b/f8101acb032d7a9c1bd5023678831ff04edaf2d42ad78d0deca1b89ed805/pyhigh-0.0.6.tar.gz",
    "platform": null,
    "description": "# pyhigh\n[![Actions Status](https://github.com/sgherbst/pyhigh/workflows/Regression/badge.svg)](https://github.com/sgherbst/pyhigh/actions)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![PyPI version](https://badge.fury.io/py/pyhigh.svg)](https://badge.fury.io/py/pyhigh)\n\n``pyhigh`` is a Python package for accessing elevation data, which is retrieved from a [USGS dataset](https://dds.cr.usgs.gov/srtm/version2_1/SRTM3/North_America/).  The package uses caching to avoid unecessary downloads from the USGS dataset, but please respect their download policies.\n\n## Installation\n\n```shell\n> pip install pyhigh\n```\n\n## Usage\n\n### Command-line utility\n\nThe ``pyhigh`` Python package includes a command-line tool of the same name to retreive the elevation at a particular latitude and longitude:\n\n```shell\n> pyhigh --lat 36.52011 --lon -118.671\n1884\n```\n\nAs necessary, files will be download from a USGS dataset and cache in the folder ``pyhigh/pyhigh/.cache``.  To clear this cache, use the ``--clean`` argument:\n\n```shell\n> pyhigh --clean\n```\n\n### Python API\n\nThe ``get_elevation`` function returns the elevation, in meters, at the given latitude and longitude.\n\n```python\n>>> from pyhigh import get_elevation\n>>> get_elevation(lat=36.52011, lon=-118.671)\n1884\n```\n\nIt is also possible to request a bunch elevations for a bunch of latitudes and longitudes at once.  The result returned is a NumPy array of elevations.\n\n```python\n>>> from pyhigh import get_elevation_batch\n>>> get_elevation_batch([(36.52011, -118.671),\n...                      (36.62011, -118.771)])\narray([1884., 2438.])\n```\nThis is more efficient than individual calls to ``get_elevation`` because elevation reads are pooled together to avoid reading the same ``*.hgt`` file multiple times.\n\nFinally, the ``pyhigh`` cache of ``*.hgt`` files can be cleared with the API function ``clear_cache``:\n\n```python\n>>> from pyhigh import clear_cache\n>>> clear_cache()\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python library to get elevation data",
    "version": "0.0.6",
    "project_urls": {
        "Download": "https://github.com/sgherbst/pyhigh/archive/v0.0.6.tar.gz",
        "Homepage": "https://github.com/sgherbst/pyhigh"
    },
    "split_keywords": [
        "elevation"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db8bf8101acb032d7a9c1bd5023678831ff04edaf2d42ad78d0deca1b89ed805",
                "md5": "7b804dd9e6834c0ac49d9dc2312094d6",
                "sha256": "e10df65fc0ca79a57cb8f0cb10b4a6fefa19b2c4e5d28a1c46cb6b4e37f48be8"
            },
            "downloads": -1,
            "filename": "pyhigh-0.0.6.tar.gz",
            "has_sig": false,
            "md5_digest": "7b804dd9e6834c0ac49d9dc2312094d6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 5535,
            "upload_time": "2024-08-23T03:51:19",
            "upload_time_iso_8601": "2024-08-23T03:51:19.622660Z",
            "url": "https://files.pythonhosted.org/packages/db/8b/f8101acb032d7a9c1bd5023678831ff04edaf2d42ad78d0deca1b89ed805/pyhigh-0.0.6.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-23 03:51:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "sgherbst",
    "github_project": "pyhigh",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pyhigh"
}
        
Elapsed time: 3.35739s