Topo calculations like gradient and sky view
Project description
topocalc
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:
- Gradient for slope and aspect
- Horizon angles for an azimuth
- 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.
For two points i
and j
, we compare the slope from i
and j
with the slope of j
's horizon. If the slope is greater, then all points past j
are not visible. If the slope is less, then all points between i
and j
don't need to be checked and the search can continue past point j
. 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.5 to 3.8 on Linux and MacOSX environments.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for topocalc-0.3.0-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b42bbe4aef0689679f34be17fe6b103a6d2e2767824087a3c527d1d88948db3 |
|
MD5 | 6056a50404c8396e160a921126017565 |
|
BLAKE2b-256 | 8f2b5df0f1b890873a777cdf9cc4141f75c50f5728fd57d7914c6050a2cff292 |
Hashes for topocalc-0.3.0-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d03c2f5450660e5da4764895bd7f647b63d66ef49b18c580c2c28f1d8658f8e4 |
|
MD5 | 3ad0ad5042b121ecb03d86300af9fd87 |
|
BLAKE2b-256 | 61f4412547f40660861a3aaa36794bb7b64fe7c08f2fa16979b8d949d845e894 |
Hashes for topocalc-0.3.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8496196b79d85d06fc1b322ac8212c89d595a12e104b986e512f9781971a3ea8 |
|
MD5 | 3b3d0f3258be28541b3d7b1b081db9a0 |
|
BLAKE2b-256 | 3f7a9ccc81b3f04498d1998a0022251aefaafc7ccc994435f5fb0569c65b0b92 |
Hashes for topocalc-0.3.0-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c15c516cf7113cdf0754a13a409f6cde1f375bf2c752b7b5f4e74d21eb363635 |
|
MD5 | 53e2269f29d043f1a25aa77c5f2d6797 |
|
BLAKE2b-256 | 95f52608bdb3efa72a9afb7a5408558f20956a3cdeb252bc1f06e8b72fa08278 |
Hashes for topocalc-0.3.0-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95e334cf97d50013d8fbd586249cdc3f5f0ef1409890ef4f63fa406a228d33c4 |
|
MD5 | a16128dad0f9ada45dfa5f0858b37f48 |
|
BLAKE2b-256 | 693317a4709fcfcb10732f0e6be0dc1d8a6197b7ab0c6bd7aae130e880a08fd2 |
Hashes for topocalc-0.3.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e60253bc7bf8d9c45f4dff81263b4a3345773a04d307bbd2d04b034c27948f9 |
|
MD5 | 6d40fd88bcf0cd8b9fb3d54c7750150a |
|
BLAKE2b-256 | 66da7232fb8007958c40954f3d2b6ced75a9fc2ed1ff7459f5446a84c3aff615 |
Hashes for topocalc-0.3.0-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14f094f9b03a04e6ed7ac06440f186bfd9d3dec41cdb08648b975c78273e0fb5 |
|
MD5 | 1b34ff7b0e7a8f9a076c4421c3b8006f |
|
BLAKE2b-256 | 120b4d906a0e2dcf5ff4e6ed13f769eed7462319f21a2a234658a0b36d1dc95e |
Hashes for topocalc-0.3.0-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0550674d2e46361a1039864c8404ebda6758ac5983b7a4e1ea9c295272a5f670 |
|
MD5 | 77a2111400639f552422f6531084978c |
|
BLAKE2b-256 | 04e67bc543d0db92dce0a1026ed7a0ab3cf39c17953d7da1cb866840c91c4f82 |
Hashes for topocalc-0.3.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d9d72acd96f7ed3722f31d33f5e536a6540906d8c305bc8cb107962c46711c7 |
|
MD5 | 35e73a41fd813538708350f8b47d2a01 |
|
BLAKE2b-256 | 6a58f0f335df85e049993330c163e2e6fd72d77ebc8ca993c8de423b29d24ebc |
Hashes for topocalc-0.3.0-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 32ea6841da5ca0fccc918ac1d8273c85b4ea2889992ac749fef9e2fbf587fac4 |
|
MD5 | 8dc66e25918785545dd0707106d67682 |
|
BLAKE2b-256 | ed86e2d4ae30c540bb053021668017b01a196f444cebc53c22a0a88d3c649fa1 |
Hashes for topocalc-0.3.0-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b921759905dcebb9bb4ee7fd2a8d029dd17bb7452b4f7dbf09bf792a25e04cd8 |
|
MD5 | 7ad711506506775e09f7ad9d37fd589c |
|
BLAKE2b-256 | 43342d59637f28e17e247aaa3f9fd7547e58f604f9813792dbd6d3a38ab87c62 |
Hashes for topocalc-0.3.0-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f862d0b23704ab50192cd1aace7d38d2876d759083886227905f2ac6db124760 |
|
MD5 | fc2fbb355e52a91009573cebbe80a93f |
|
BLAKE2b-256 | 706b313a3cf5099831f7d792b606b1c0547c77aa6f8793dd6e5fbb9dfee4e328 |