Vector Field Processings

Aim

This plugin for Quantum GIS allows to calculate physical parameters (e.g., divergence, curl module, pathlines), given a 2D, steady vector field. Possible applications are for instance in glaciology.

The calculated parameters are summarized in the table below.

Vector parameters Magnitude gradients Pathlines
magnitude along x axis pathlines from given start points
orientations along y axis
divergence along flowlines
curl module

Quantum GIS plugin

Current version: 1.1 - September, 16 2012

You can directly install the 'VectorFieldCalc' plugin from the Quantum GIS plugin manager.
Otherwise, you can download it from Quantum GIS Plugin Repository, unzip and put the folder in the Quantum GIS Python plugin folder.
Tested in Quantum GIS 1.8.0 - Ubuntu 12.04 and Windows Vista.



Do you want to contribute to the development of this application?





Example data

vfp_data.zip
Reeves Glacier velocity field data.

Plugin screenshot



Input

The vector field is defined in two input rasters, storing the x-axis and y-axis components of the field. These two rasters must have the same geographical extent and resolution. In addition, the two raster should have no axis rotations, as well as the same cell resolution in x- and y-directions: these are requisites respected by the great majority of raster files. Using as input format the ESRI ascii grid format could be considered a safe choice, since the gdal module can read correctly the no data value.


Calculated parameters

Magnitude

The vector magnitudes for each cell of the input rasters.

Orientations

The orientations of the vectors are calculated as decimal degrees (0-360°) from the map top, in a clockwise sense.

Divergence

Divergence and curl are two vector operators widely used in physics and engineering, for example, for the study of water flows. The nabla differential operator allows to calculate these two operators from a vector field:

The divergence is a scalar value derived from the scalar product of nabla and the vector field in the neighborhood of a point (x, y, z):

The divergence indicates the tendency of a flow to diverge (positive values) or converge (negative) at each individual cell.

Curl magnitude

The curl is the vector product of nabla and the vector field:

The curl is in general represented by a vector field. Sice the input vector field is 2D, the resulting field has the resulting vectors constantly vertical, such that it can be represented by a scalar field with values equal to the curl module, positive for anticlockwise rotations, negative for clockwise ones.

With GIS data, we usually consider 2D dimensionality. Therefore, we only consider partial derivatives with respect to x and y axes. For the curl, we will have a vertical vector (parallel to k), whose magnitude is equal to the last component of the curl formula.

Positive values indicate anti-clockwise rotations, negative values clockwise rotations.

Magnitude gradients

The variations of the vector magnitudes can be calculated along two fixed orientations, i.e. the x- and y- axis directions, as well as along the local orientations of the vector field. Positive gradients indicate increase of the vector field magnitude in the analyzed direction, negative gradients the opposite.

To determine the magnitude gradients along flow directions, we use a modified version of the equation for a DEM directional slope (Neteler & Mitasova, 2008, eq. A.27):
  velocity change per unit length = (dz/dx) * sin(alpha) + (dz/dy) * cos(alpha)
where alpha is the local orientation of the flow line.

Pathlines

The pathlines are calculated for a steady vector field, i.e., a field whose components do not vary with time.

The pathlines are calculated using the Runge-Kutta-Fehlenberg 45 method (RKF 45), that allows to estimate the error associated with each step interpolation. The step size is adaptive, i.e. it is changed automatically from the program to accommodate interpolation errors not larger than the provided maximum step error. Values of the vector field are interpolated using a bilinear interpolation, for both lothe x and the y components.

Input parameters are:
  • name of shapefile storing start points for pathline calculation
  • time step: initial value of the individual time steps used for interpolating the path. It can be changed by the program to accommodate the maximum error for step.
  • total time: the maximum value of the cumulated time for which a single pathline will be calculated.
  • max error: the maximum error allowed for each single step. Its estimation is given by the RKF 45 method.
  • name of the shapefile storing the interpolated pathlines.

The output consists in a point shapefile with the following attribute fields:
  • path_id: pathline counter, with increasing integer values for each input point
  • point_id: progressive counter for each interpolated point within a pathline
  • x: x value for interpolated point
  • y: y value for interpolated point
  • ds: segment length associated with interpolated point
  • s: cumulated length for pathline
  • vx: x component of the velocity vector for interpolated point
  • vy: y component of the velocity vector for interpolated point
  • vmagn: magnitude of the velocity vector for interpolated point
  • dt: time step for interpolated point
  • t: cumulated time for pathline
  • error: error (in spatial unit) for interpolated point

Additional information

The following posts (in Italian) present the plugin and discuss an example of application:

About

My name is Mauro Alberti. I'm a Gis and scientific programmer. My primary specializations are in scientific and GIS programming (OS tools, mainly Python, R, Fortran and C++), Earth Sciences (structural geology, Polar Sciences), geostatistical analysis. About me

Contact

Mauro Alberti

alberti.m65@gmail.com

mobile: +39 338 8022247
skype: mauro.alberti.siena
Address: Via Canonica 32,
Milano (MI) 20100, Italy

P.I. 01292740527