Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adamcharnock/python-srtm
Python API for reading NASA's SRTM `.hgt` or `.hgt.zip` altitude files.
https://github.com/adamcharnock/python-srtm
altitude elevation-profile geospatial nasa srtm srtm-data srtm1 srtm3
Last synced: about 2 months ago
JSON representation
Python API for reading NASA's SRTM `.hgt` or `.hgt.zip` altitude files.
- Host: GitHub
- URL: https://github.com/adamcharnock/python-srtm
- Owner: adamcharnock
- Created: 2020-04-12T19:33:37.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-03-20T18:19:10.000Z (9 months ago)
- Last Synced: 2024-10-11T11:22:28.948Z (2 months ago)
- Topics: altitude, elevation-profile, geospatial, nasa, srtm, srtm-data, srtm1, srtm3
- Language: Python
- Homepage: https://pypi.org/project/python-srtm/
- Size: 127 KB
- Stars: 24
- Watchers: 3
- Forks: 7
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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-srtmexport 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
pytestexport VERSION="VERSION HERE"
# Version bump
poetry version $VERSION# Update the setup.py
dephell convert
black setup.py# 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" \
masterpoetry publish --build
```