Skip to main content

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!

Metadata

Release files for topocalc 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for topocalc 0.5.0
File Size Uploaded
topocalc-0.5.0.tar.gz 7.7 MB Details

Built distributions (wheels)

Table of built distributions (wheels) for topocalc 0.5.0
File
topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.12+ x86-64 Details
topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details
topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details
topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.12+ x86-64 Details
topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.5+ x86-64 Details
topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.9+ x86-64 Details
topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64 Details
topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details
topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64 Details
topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64 Details
topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details
topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64 Details

Total release size: 59.2 MB

Release files / topocalc-0.5.0.tar.gz

Download URL topocalc-0.5.0.tar.gz
Size 7.7 MB
Tags Source
SHA-256 checksum
How to use checksums
1d808c6e9fb688ac65043dfa87967c444cf75de6b9db97c38da1c22393de6dac
BLAKE2b-256 checksum
How to use checksums
53d406d34bc7f7cb67d499d790275cd6f00472a5f5d2bd07d7e37ce7b6973aea
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl

Download URL topocalc-0.5.0-cp39-cp39-manylinux2010_x86_64.whl
Size 4.3 MB
Tags CPython 3.9 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
37763ee2ddff97f9a92f3164ca93c1cdb6de0571285d36c647a8e5f98bc5fe06
BLAKE2b-256 checksum
How to use checksums
2bd7539e6a530a3be96d22b5ee4a5bd3d45df1249f47cd48022e5be98ea4a118
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl

Download URL topocalc-0.5.0-cp39-cp39-manylinux1_x86_64.whl
Size 4.3 MB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
20688abf0c224779a00f33ae3deaf1ad9ddd74e0bc41678a7849163c7a617ee3
BLAKE2b-256 checksum
How to use checksums
1da803d837d20b1df48035ad7948a39264b13b37d57c06dc324a6b6f841f3b85
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl

Download URL topocalc-0.5.0-cp39-cp39-macosx_10_9_x86_64.whl
Size 4.2 MB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
742ff3816097fd5b1bbce6d60e0f886a1a96300e833af71f271547e6b4104a4d
BLAKE2b-256 checksum
How to use checksums
6ed54553f260aaa2ba4c4cbab55f1c778a62c82db1ab1a4ca8f65da9289c326e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl

Download URL topocalc-0.5.0-cp38-cp38-manylinux2010_x86_64.whl
Size 4.3 MB
Tags CPython 3.8 Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
5c36690aeda72f0d50600574e172fdd5baac976a928a61ab1a17e30b0383b89a
BLAKE2b-256 checksum
How to use checksums
c4cf3811db531c432a4d570c742b1d54087231ffd251646a7880ec6b7eb0f407
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl

Download URL topocalc-0.5.0-cp38-cp38-manylinux1_x86_64.whl
Size 4.3 MB
Tags CPython 3.8 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
dd7327d7cd4420faf263f1d0be7bacc28f642cd277a8d1809ace696b266a0934
BLAKE2b-256 checksum
How to use checksums
3500b32e865be0d5fa8e478f67546e8c8c2075f88f4224dd46995aa1289f5d7e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl

Download URL topocalc-0.5.0-cp38-cp38-macosx_10_9_x86_64.whl
Size 4.2 MB
Tags CPython 3.8 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
5d8c0bee11c7568198848c27bd9b29e7ffc94866cd77e1e4ef1f863660b344cf
BLAKE2b-256 checksum
How to use checksums
3472db798c80ed794ad96c530f49172bad93cc1cf6b0bef6f2bcf9ed46635b2b
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl

Download URL topocalc-0.5.0-cp37-cp37m-manylinux2010_x86_64.whl
Size 4.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
bc4bc79ac54027b9ac405585ac74f35a3d99d1f89495a613080d549d54397e53
BLAKE2b-256 checksum
How to use checksums
27f80ecffcd87ebd6a728995d1281c87aeb801afd69e18085f9115258b8427dd
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl

Download URL topocalc-0.5.0-cp37-cp37m-manylinux1_x86_64.whl
Size 4.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
9e52f20e167a6c031eecca21ef92b190e3f56194c2fadd3e013fd9c65c33eb46
BLAKE2b-256 checksum
How to use checksums
343b076899774deb697d1d51fdb6cd0e8485b9c35b80418f1b20ae7d67798aa6
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl

Download URL topocalc-0.5.0-cp37-cp37m-macosx_10_9_x86_64.whl
Size 4.2 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
4ab79a6570cf6ea6fbc82ec5d2a1a92fc87e86e571a7ed4f58fd8f94da94ac8b
BLAKE2b-256 checksum
How to use checksums
a9284f2dfd72498a5fe33a7745e13124f53a3555f5a7432bcdcb8144363a8402
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl

Download URL topocalc-0.5.0-cp36-cp36m-manylinux2010_x86_64.whl
Size 4.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.12+ x86-64
SHA-256 checksum
How to use checksums
d220c5ee9b667ad3dba10010b18237cedf5098b09c3b11414c5675857459912d
BLAKE2b-256 checksum
How to use checksums
3ae52193fac0d9019091b785d4a7c91e20a0658b3978b764e9e4c4cc4beca012
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl

Download URL topocalc-0.5.0-cp36-cp36m-manylinux1_x86_64.whl
Size 4.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
bbdb2b61675778b0d8be7d4c5cfbd664d7b036968ba0c999e519d61ce339d4d2
BLAKE2b-256 checksum
How to use checksums
c839d4115fda4777d797dc07ef2b5faf88f7980e19b2cf3dc7cbe372436f874c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl

Download URL topocalc-0.5.0-cp36-cp36m-macosx_10_9_x86_64.whl
Size 4.2 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
3e0e18ae865694291119acbe33bd2727fc6a15c92ff600e897d689b62f8814e0
BLAKE2b-256 checksum
How to use checksums
289f62f41e1d20e0ffca00d37be1633842b3bfea7aef6574cb6d8f32df622d5e
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.5.0 This release

13 release files

0.3.2

13 release files

0.3.1

13 release files

0.2.0

13 release files

0.1.14

8 release files

0.1.9

8 release files

0.1.8

8 release files

0.1.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page