Skip to content

Volume Calculations for Digital Elevation Models in Python (volpy)

The purpose of this Python project is to provide the means of calculating volumes out of a Digital Elevation Model (DEM) represented by Triangulated Irregular Network (TIN).

Its main goal is to provide sufficiently accurate volume estimates out of terrain surveys for an area of construction work where ground leveling is required prior to the actual construction activity.

Source code

Available at: https://github.com/agu3rra/volpy

Preview

Installation

$ pip install volpy

Quick demo

import volpy as vp
vp.demo()

Simple use case

import volpy as vp
survey = vp.load_survey('survey_data.csv')
mesh = vp.terrain_mesh(survey.data)
survey.get_bounds()
> 'x=250.13, y=402.14, z=11.54'
# Survey plots
plots = vp.terrain_plots(survey)
plots.scatter3d()
plots.contour()
plots.profile()
plots.mesh_plot()
vol_curves = mesh.get_volume_curves(step=1.0)
mesh.plot_curves(vol_curves)

# Just a volume from the mesh
mesh.get_volume()

By default, volpy applies its calculations on a Cartesian Coordinate System. If you are working with survey data obtained from a GPS, its points are likely represented in a Geographic Coordinate System. In order to convert it, use the following modifier when loading the data.

survey = vp.load_survey(
    'survey_data.csv',
    coordinates=vp.CoordinateSystem.GEOGRAPHIC
)