Skip to main content

No project description provided

Project description

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:

# 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:

# 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

import cProfile
cProfile.run('function_to_profile()', filename='output.cprof')
brew install qcachegrind
pip install pyprof2calltree
pyprof2calltree -k -i /pythonprofiling/profiler/first_iteration.cprof

Release process

For internal reference:

# Run the tests
pytest

# Update the setup.py
dephell convert
black setup.py

# Ensure poetry.lock is up to date
poetry lock

export VERSION="VERSION HERE"

# Version bump
poetry version $VERSION


# 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-srtm-0.3.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

python_srtm-0.3.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file python-srtm-0.3.0.tar.gz.

File metadata

  • Download URL: python-srtm-0.3.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.1 Darwin/18.7.0

File hashes

Hashes for python-srtm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4a61742b29f81a7b9500b5f8202ece9778abfcd153a11335c637ba4ce8e202f4
MD5 0b0664b405d7c1b5ee693da335057bc6
BLAKE2b-256 62e1d78985ba9ba6145c30883b79b3bb37195c3b2c037c0f4df28a25b7ea0da1

See more details on using hashes here.

File details

Details for the file python_srtm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: python_srtm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.2 CPython/3.8.1 Darwin/18.7.0

File hashes

Hashes for python_srtm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e08d6091d880c9a8754d6901669c2e490e04f1c41e3bfba78e741c2eab135838
MD5 fa07c540b44d475dc77a78e682009d10
BLAKE2b-256 d7fc83bf898bbe96aad5652d38b44ff4ef65ccc1e9a93d6309032fa69857efb5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page