Skip to main content

Topo calculations like gradient and sky view

Project description

topocalc

Pypi version Coverage Status Maintainability

The topocalc package is a collection of functions to calculate various metrics on a digital elevation model (DEM). The calculations follow the equations laid out in Dozier and Frew, 1990 for the gradient, horizon and sky view factor. Currently the supported calculations are:

  1. Gradient for slope and aspect
  2. Horizon angles for an azimuth
  3. Sky view factor for percent of the sky that is visible from a point on the DEM

Background

Azimuth convention

For the azimuth's and aspects, the convention is that South is 0 degrees (0 radians) with positive values to the East (+90 degrees or pi/4 radians) and negative values to the West (-90 degrees or -pi/4 radians). North is -180 degrees or -pi/2.

Gradient for slope and aspect

The gradient method calculates the slope and aspect of the input DEM. There are two methods in topocalc.gradient the gradient_d4 and gradient_d8.

gradient_d4 mimics the slope and aspect calculations of the IPW gradient function. This calculates the slope for a finite difference in just the x/y direction.

gradient_d8 (the default) uses a second order finite difference for a 3x3 square around a given point on the DEM.

The gradient is used to calculate the aspect from North (0 degrees). A conversion function will take the aspect in degrees and convert to radians with South being 0.

Horizon angles

The horizon angle for a point on the DEM is the angle from zenith to the horizon for a given azimuth. Following the methods laid out in Dozier and Frew, 1990 and in IPW horizon the grid is rotated in the direction of the azimuth to make it a one dimensional problem.

The horizon function will search the entire DEM profile for the horizon by finding the maximum slope along the profile. This search is performed in C to significantly speed up the computation.

The values reported from horizon are cosine of the horizon angle.

Sky view factor

The sky view factor (svf) is the amount of the sky that is visible to a particular point. The svf is between 0 and 1 with 1 indicating no obstructions from surrounding terrain and 0 indicating full obstruction. The svf uses the slope, aspect and horizon angles for 72 directions to estimate the sky view factor for the DEM.

Usage

Installation

NOTE: topocalc has only been tested for Python 3.6 to 3.9 on Linux and MacOSX environments. If building from source, topocalc must be compiled with gcc, clang will not work if on MacOS.

To install:

pip install topocalc

Gradient usage

from topocalc.gradient import gradient_d8

# Load the DEM into a numpy array
dem = load_dem(path_to_dem)

# grid cell spacing for the DEM
dem_dx = 30
dem_dy = 30

slope, aspect = gradient_d8(dem, dem_dx, dem_dy)

Sky view factor usage

from topocalc.viewf import viewf

# Load the DEM into a numpy array
dem = load_dem(path_to_dem)

# grid cell spacing for the DEM
dem_spacing = 30

svf, tvf = viewf(dem, spacing=dem_spacing)

Command Line Interface

Comming soon!

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

topocalc-0.5.0.tar.gz (7.7 MB view details)

Uploaded Source

Built Distributions

topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.9

topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.8

topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.7m

topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl (4.3 MB view details)

Uploaded CPython 3.6m

topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file topocalc-0.5.0.tar.gz.

File metadata

  • Download URL: topocalc-0.5.0.tar.gz
  • Upload date:
  • Size: 7.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1d808c6e9fb688ac65043dfa87967c444cf75de6b9db97c38da1c22393de6dac
MD5 20df27d0921cc3235500fa0495b7370b
BLAKE2b-256 53d406d34bc7f7cb67d499d790275cd6f00472a5f5d2bd07d7e37ce7b6973aea

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.9, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 37763ee2ddff97f9a92f3164ca93c1cdb6de0571285d36c647a8e5f98bc5fe06
MD5 d79d7e56de0081d5e0e4c49341505304
BLAKE2b-256 2bd7539e6a530a3be96d22b5ee4a5bd3d45df1249f47cd48022e5be98ea4a118

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.9
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 20688abf0c224779a00f33ae3deaf1ad9ddd74e0bc41678a7849163c7a617ee3
MD5 5db8d76d2d7e4c2cc89d67f621bf6f9d
BLAKE2b-256 1da803d837d20b1df48035ad7948a39264b13b37d57c06dc324a6b6f841f3b85

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 742ff3816097fd5b1bbce6d60e0f886a1a96300e833af71f271547e6b4104a4d
MD5 e4633f572d38c431b49d096a9154c580
BLAKE2b-256 6ed54553f260aaa2ba4c4cbab55f1c778a62c82db1ab1a4ca8f65da9289c326e

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5c36690aeda72f0d50600574e172fdd5baac976a928a61ab1a17e30b0383b89a
MD5 74184c3a1caa03719388a90039ad2daa
BLAKE2b-256 c4cf3811db531c432a4d570c742b1d54087231ffd251646a7880ec6b7eb0f407

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 dd7327d7cd4420faf263f1d0be7bacc28f642cd277a8d1809ace696b266a0934
MD5 e26809865d904a72a91ba050dcc26890
BLAKE2b-256 3500b32e865be0d5fa8e478f67546e8c8c2075f88f4224dd46995aa1289f5d7e

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5d8c0bee11c7568198848c27bd9b29e7ffc94866cd77e1e4ef1f863660b344cf
MD5 10a45b6ab00ed25a16a47694bd1e3a21
BLAKE2b-256 3472db798c80ed794ad96c530f49172bad93cc1cf6b0bef6f2bcf9ed46635b2b

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 bc4bc79ac54027b9ac405585ac74f35a3d99d1f89495a613080d549d54397e53
MD5 039d36a774ee756e8cb2c6fd3f3f2cf1
BLAKE2b-256 27f80ecffcd87ebd6a728995d1281c87aeb801afd69e18085f9115258b8427dd

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9e52f20e167a6c031eecca21ef92b190e3f56194c2fadd3e013fd9c65c33eb46
MD5 88d06c2ed6b4d233cba32bc8a85cf714
BLAKE2b-256 343b076899774deb697d1d51fdb6cd0e8485b9c35b80418f1b20ae7d67798aa6

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4ab79a6570cf6ea6fbc82ec5d2a1a92fc87e86e571a7ed4f58fd8f94da94ac8b
MD5 a64f56c5ca3b60b20f7d4379e6e23a5c
BLAKE2b-256 a9284f2dfd72498a5fe33a7745e13124f53a3555f5a7432bcdcb8144363a8402

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 d220c5ee9b667ad3dba10010b18237cedf5098b09c3b11414c5675857459912d
MD5 b114b58c530aead262b09a004e6e8701
BLAKE2b-256 3ae52193fac0d9019091b785d4a7c91e20a0658b3978b764e9e4c4cc4beca012

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 bbdb2b61675778b0d8be7d4c5cfbd664d7b036968ba0c999e519d61ce339d4d2
MD5 fdb72fb8a12350c40456acf54532bfcf
BLAKE2b-256 c839d4115fda4777d797dc07ef2b5faf88f7980e19b2cf3dc7cbe372436f874c

See more details on using hashes here.

File details

Details for the file topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 3e0e18ae865694291119acbe33bd2727fc6a15c92ff600e897d689b62f8814e0
MD5 35108b25ec903d144a7c7a2e5621b72b
BLAKE2b-256 289f62f41e1d20e0ffca00d37be1633842b3bfea7aef6574cb6d8f32df622d5e

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