Giter Site home page Giter Site logo

mauroalberti / directionalslope Goto Github PK

View Code? Open in Web Editor NEW
8.0 2.0 2.0 2.74 MB

QGIS plugin for calculating directional slope

License: GNU General Public License v3.0

Python 100.00%
dem gis slope qgis python qgis-plugin geomorphology directional-slopes slope-calculation grid

directionalslope's Introduction

DirectionalSlope

DirectionalSlope is a Python plugin for QGIS, for calculating directional slopes from DEM.

Aim

The slope of a topographic surface is usually calculated as the maximum gradient of a surface at a given point. In other cases, we could be interested in the slope along a constant orientation in space, i.e., directional slope. It is typically used to highlight structures perpendicular to the direction of analysis. A generalization of this concept is the slope along directions that may vary in space, based on external parameters, such as the flows of wind or ice.

This algorithm calculates the slope of a surface, both directional and steepest. Directions may be uniform or variable in space.

Methodology

The estimation of the directional slope for surfaces sampled along grids relies on the adaptation of the analytical techniques for continuous and differentiable surfaces. Usually we derive gradient by applying a 3x3 kernel to each cell (except those at the border). The figure below illustrates the adopted convention for cell indexing.

alt text

Fig. 1. 3x3 kernel for slope calculation.

To determine the directional slope, we must first calculate the directional gradients along the two principal axes, x and y. From the values of dz / dx and dz / dy, one can determine the slope of the plane that approximates the surface at the local cell (i, j) using the formula (Neteler & Mitasova, 2008, eq. A.27; see also Geospatial Analysis - a comprehensive guide):

directional slope (alpha) = arctan [(dz/dx) * sin(alpha) + (dz/dy) * cos(alpha)]

where alpha represents the orientation along which we calculate the slope. This value is the angle that the direction makes with the top of the map and varies from 0° to 360° clockwise.

Various methods are available for the estimation of the gradients along the two axes. A detailed analysis can be found in Burrough & McDonnell (1998), in the "First and higher order derivatives of a continuous surface" section of the "Spatial analysis using continuous fields" chapter.

Two methods are available in the module: the Zevenbergen & Thorne (1987) and the Horn (1981) methods. The former considers only two cells for each gradient calculation, while the Horn (1981), suitable for rough surfaces, considers six cell values.

Zevenbergen & Thorne (1987) method

Gradients along the two axes are:

dz/dx = [ Elev(i, j + 1) - Elev(i, j - 1) ] / 2 cell_size

dz/dy = [ Elev(i - 1, j) - Elev(i + 1, j) ] / 2 cell_size

In the case of cells at the grid edge, this method can be replaced by the first difference method, where the central cell itself provides the missing data.

alt text

Fig. 2. Zevenbergen & Thorne (1987) method.

Horn (1981) method

The gradient estimation along an axis derives from the values of six cells in a 3x3 kernel. The weight applied to each cell depends on its position relative to the central cell. This method is the most suitable for rough surfaces.

Formulas of the gradients are (Burrough & McDonnell, 1998, eqs. 8.9 and 8.10):

dz/dx = [ (Elev(i-1, j + 1) + 2 Elev(i, j + 1) + Elev(i+1, j + 1)) - (Elev(i-1, j - 1) + 2 Elev(i, j - 1) + Elev(i+1, j - 1)] / 8 cell_size

dz/dy = [ (Elev(i - 1, j-1) + 2 Elev(i - 1, j) + Elev(i - 1, j+1)) - (Elev(i + 1, j-1) + 2 Elev(i + 1, j) + Elev(i + 1, j+1)) ] / 8 cell_size

alt text

Fig. 3. Horn (1981) method.

Data processing

Input

Required input data is the DEM, the source for the slope calculation. It must be projected (i.e., not in Long-Lat coordinates). The unit for vertical distances has to be the same as for the horizontal ones.

alt text

Fig. 4. DirectionaSlope plugin interface.

Spatially-uniform direction

For uniform direction analysis, the user can provide direction values in three ways:

a) a single value (in degrees), e.g. 300;

b) two values (start and stop), separated by a forward slash, e.g. 80/90: the slopes will be calculated for the range comprised between start and stop values, with a step of 1° (if start is less than stop) or -1° (if stop is less than start);

c) three values, separated by a forward slash, e.g., 0/350/10: they correspond to start, stop and step values. A set of slopes will be automatically calculated with the given range and with the provided step. Each result file will have a suffix in its name describing the specific direction value.

Spatially-changing directions

For variable orientation analysis, a grid where each cell stores a specific direction (in decimal degrees) is required. Its geographical extent and cell size of the direction grid may be different from those of the DEM.

Output

The output consists of one or more grids, in ESRI ascii format, with the same geographical parameters (i.e., cell resolution, lower-left corner) as the input DEM, and slope values expressed in decimal degrees, positive for downwards orientations, and negative for upwards orientations (the opposite with respect to the previous versions). Maximum slope is obviously always positive.

The output files are saved in the folder defined by the user, with the name of each file will be made up by the basename and a suffix related to the specific calculation parameters (both used slope method and analysis type parameters):

Slope methods

'ZT': Zevenbergen & Thorne (1987)

'H': Horn (1981)

Analysis types

'm': maximum slope

'ud': uniform directions, followed by the specific angle value

'vd': variable directions

Examples

'slope01_H_ud_180.0.asc': 'slope01' is the basename, 'H' means Horn (1981) method, 'ud' is the uniform directions option, with a value of 180.0 degrees.

'result_ZT_vd.asc': 'result' is the basename, 'ZT' means Zevenbergen & Thorne (1987) method, 'vd' is the variable directions option.

Case study

[Note: the sign convention for slope followed in this example refers to the previous versions of the module, inverted with respect to the current one.]

The case study is an example of spatially-changing directional slope analysis. The used data, referring to ice flows, derives from a PhD thesis by Debbie Biscaro and are available in the example_data/reeves_groundingzone folder in this repository.

We derive the directional slope of a glacial surface along the ice flow directions for the Reeves Glacier (Victoria Land, East Antarctica).

alt text

Fig. 5. Glacial fluxes in the grounding zone of the Reeves Glacier (Antarctica). Data D. Biscaro.

DEM data derives from the Radarsat Ramp DEM, that covers the whole of Antarctica with a nominal cell resolution of 200 m. Data were processed in Grass and then exported as ESRI Grid ASCII files. We use the Zevenbergen & Thorne (1987), since we are dealing with smooth surfaces. The results of the module were then imported in Grass and then exported into vtk format, to be visualized in Paraview. A profile of the directional slope is also presented.

alt text

Fig. 6. Directional slopes in the grounding zone of the Reeves Glacier (Antarctica).

Results are between 5.43° upward and 19.01° downward. There is a clear distinction between two main zones. The bulk of the slope variability occurs the ice grounded area (at the left). The slopes are about 0° in the floating ice zone (at the right). The separation between the two zones corresponds to a band of slopes reaching the steepest downward values, of about 19°, and that nearly corresponds to the grounding line, were the continental ice detaches from the bedrock and begins floating in the sea. We note also in the grounded area (bottom-right) some zones were the ice flows upwards: these situations are likely linked to subglacial obstacles that constrain the ice movements upwards.

alt text

Fig. 7. Directional slope profile along A-B (A: left; B: right).

directionalslope's People

Contributors

mauroalberti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

directionalslope's Issues

Icon file not found

Hello, I just installed your plugin in QGis 3.2.1 on windows 10 and I noticed there wasn't an icon in the icon toolbar. What I found out in main python file is the reference to theicon file is pointing to a wrong local folder address:
line 55 of DirectionalSlope.py should be changed from:
self.action = QAction(QIcon(":/plugins/DirectionalSlope/icon.png"),
"DirectionalSlope", self.iface.mainWindow())
to:
self.action = QAction(QIcon(":/plugins/DirectionalSlope/icons/icon.png"),
"DirectionalSlope", self.iface.mainWindow())

according to your resource.qrc file
That resolved the issue in my case.

Thank you
Giuseppe De Marco

Output in percentage.

It would be useful to be able to have the output in percentages, like the "slope" function in Qgis.

Form validation errors close the window

Thanks for the great plugin!

One issue I ran into was that if I forgot to fill in the required input in the form and clicked go, I get an error ("No method chosen," "No option chosen" etc.) and then the plugin closes. When I re-open it, the form is blank. It would be nice if instead of closing the form, it would send me back to it with my selections still there.

I would be interested in submitting a PR to make this fix, as my first contribution to the plugin. I probably have time to do it this weekend.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.