# NASA SRTM altitude data parsing in Python
Provides an API onto SRTM `.hgt` or `.hgt.zip` files.
Requires Python 3.8, **may** work with Python 3.6 & 3.7.
## Installation
```
pip install python-srtm
export SRTM1_DIR=/path/to/srtm1/
export SRTM3_DIR=/path/to/srtm3/
```
## Use
You can access either SRTM1 or SRTM3 data. SRTM 1, for example:
```python
# SRTM1 - 30m resolution
>>> from srtm import Srtm1HeightMapCollection
>>> srtm1_data = Srtm1HeightMapCollection()
>>> srtm1_data.get_altitude(latitude=40.123, longitude=-7.456)
615
>>> Srtm1HeightMapCollection().get_elevation_profile(40.123, -7.456, 40.129, -7.460)
[615, 620, 618, 620, 616, 603, 593, 582, 575, 579, 580, 589, 589, 581, 565, 553, 545, 541, 534, 533, 529, 520, 514]
```
Or SRTM3:
```python
# SRTM3 - 90m resolution
>>> from srtm import Srtm3HeightMapCollection
>>> srtm3_data = Srtm3HeightMapCollection()
>>> srtm3_data.get_altitude(latitude=40.123, longitude=-7.456)
608
>>> Srtm3HeightMapCollection().get_elevation_profile(40.123, -7.456, 40.129, -7.460)
[626, 616, 585, 593, 577, 548, 528, 514]
```
## Profiling
```python
import cProfile
cProfile.run('function_to_profile()', filename='output.cprof')
```
```bash
brew install qcachegrind
pip install pyprof2calltree
pyprof2calltree -k -i /pythonprofiling/profiler/first_iteration.cprof
```
## Release process
For internal reference:
```
# Run the tests
pytest
export VERSION="VERSION HERE"
# Version bump
poetry version $VERSION
# Ensure poetry.lock is up to date
poetry lock
# Commit
git add .
git commit -m "Releasing version $VERSION"
# Tagging and branching
git tag "v$VERSION"
git branch "v$VERSION"
git push origin \
refs/tags/"v$VERSION" \
refs/heads/"v$VERSION" \
master
poetry publish --build
```
Raw data
{
"_id": null,
"home_page": "https://github.com/adamcharnock/python-srtm",
"name": "python-srtm",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "nasa, geospatial, altitude, elevation-profile",
"author": "Adam Charnock",
"author_email": "adam@adamcharnock.com",
"download_url": "https://files.pythonhosted.org/packages/54/57/15689e6a4eac07edd4187f57d2b467ede3e408f0bbd9ae31c002b2aabece/python_srtm-0.6.0.tar.gz",
"platform": null,
"description": "# NASA SRTM altitude data parsing in Python\n\nProvides an API onto SRTM `.hgt` or `.hgt.zip` files.\n\nRequires Python 3.8, **may** work with Python 3.6 & 3.7.\n\n## Installation\n\n```\npip install python-srtm\n\nexport SRTM1_DIR=/path/to/srtm1/\nexport SRTM3_DIR=/path/to/srtm3/\n```\n\n## Use\n\nYou can access either SRTM1 or SRTM3 data. SRTM 1, for example:\n\n```python\n# SRTM1 - 30m resolution\n>>> from srtm import Srtm1HeightMapCollection\n>>> srtm1_data = Srtm1HeightMapCollection()\n>>> srtm1_data.get_altitude(latitude=40.123, longitude=-7.456)\n615\n>>> Srtm1HeightMapCollection().get_elevation_profile(40.123, -7.456, 40.129, -7.460)\n[615, 620, 618, 620, 616, 603, 593, 582, 575, 579, 580, 589, 589, 581, 565, 553, 545, 541, 534, 533, 529, 520, 514]\n```\n\nOr SRTM3:\n\n```python\n# SRTM3 - 90m resolution\n>>> from srtm import Srtm3HeightMapCollection\n>>> srtm3_data = Srtm3HeightMapCollection()\n>>> srtm3_data.get_altitude(latitude=40.123, longitude=-7.456)\n608\n>>> Srtm3HeightMapCollection().get_elevation_profile(40.123, -7.456, 40.129, -7.460)\n[626, 616, 585, 593, 577, 548, 528, 514]\n```\n\n## Profiling\n\n```python\nimport cProfile\ncProfile.run('function_to_profile()', filename='output.cprof')\n```\n\n```bash\nbrew install qcachegrind\npip install pyprof2calltree\npyprof2calltree -k -i /pythonprofiling/profiler/first_iteration.cprof\n```\n\n## Release process\n\nFor internal reference:\n\n```\n# Run the tests\npytest\n\nexport VERSION=\"VERSION HERE\"\n\n# Version bump\npoetry version $VERSION\n\n# Ensure poetry.lock is up to date\npoetry lock\n\n# Commit\ngit add .\ngit commit -m \"Releasing version $VERSION\"\n\n# Tagging and branching\ngit tag \"v$VERSION\"\ngit branch \"v$VERSION\"\ngit push origin \\\n refs/tags/\"v$VERSION\" \\\n refs/heads/\"v$VERSION\" \\\n master\n\npoetry publish --build\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": null,
"version": "0.6.0",
"project_urls": {
"Homepage": "https://github.com/adamcharnock/python-srtm",
"Repository": "https://github.com/adamcharnock/python-srtm"
},
"split_keywords": [
"nasa",
" geospatial",
" altitude",
" elevation-profile"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1d938a573174a8c45a634a01d3d1602952ef033ae898b02fdadc6e01fbc95c54",
"md5": "27060116a0ce1cbe73bea1dbf70bc92d",
"sha256": "27e584ab4f0ca2103b0d6aff52e3e4cc7b70d9ed2787ff4c0c7025329b1e11ff"
},
"downloads": -1,
"filename": "python_srtm-0.6.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "27060116a0ce1cbe73bea1dbf70bc92d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 8998,
"upload_time": "2024-11-06T13:44:23",
"upload_time_iso_8601": "2024-11-06T13:44:23.742713Z",
"url": "https://files.pythonhosted.org/packages/1d/93/8a573174a8c45a634a01d3d1602952ef033ae898b02fdadc6e01fbc95c54/python_srtm-0.6.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "545715689e6a4eac07edd4187f57d2b467ede3e408f0bbd9ae31c002b2aabece",
"md5": "80b53c3a0574030df767e795f86b1b1b",
"sha256": "778a2f172c394295f934bf6ad5228a13de3575ee78ced965a7e05c88f5312b2b"
},
"downloads": -1,
"filename": "python_srtm-0.6.0.tar.gz",
"has_sig": false,
"md5_digest": "80b53c3a0574030df767e795f86b1b1b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 8104,
"upload_time": "2024-11-06T13:44:25",
"upload_time_iso_8601": "2024-11-06T13:44:25.434507Z",
"url": "https://files.pythonhosted.org/packages/54/57/15689e6a4eac07edd4187f57d2b467ede3e408f0bbd9ae31c002b2aabece/python_srtm-0.6.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-06 13:44:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "adamcharnock",
"github_project": "python-srtm",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "python-srtm"
}