Finds the area of a triangular patch on the unit sphere.
Available in version 4.3.1 and later.
function gc_tarea ( lat : numeric, lon : numeric ) return_val : numeric
Latitudes and longitudes, in degrees, of the triangle vertices. These can be multi-dimensional arrays, but the rightmost dimension size must be 3, for the vertices of the triangles. The arrays must agree in number of dimensions and dimension sizes.
The desired spherical area(s). If the input arrays are singly dimensioned, then the return value will be a scalar. If the input arrays are multi-dimensional, then the returned array will have one less dimension than the number of dimensions of the input arrays and the dimension sizes of the returned array will agree with those of the input arrays up through their penultimate dimension. The return value will be of type double if either of the input arguments is of type double and type float otherwise.
This function finds the area of a triangular patch on the unit sphere whose vertices are given in degrees as lat/lon pairs. The area given is that bounded by arcs of great circles connecting the vertices. The algorithm finds the spherical angles (say A, B, C) of the triangle and computes the area as A + B + C - PI. If you want the area of a triangle on a sphere of radius R, simply multiply the return value by R squared.
Missing values are not honored as such, since it does not make sense to have a vertex specified as a missing value.
As of v6.1.0, if invalid point(s) are entered, then a scalar missing value of 1e30 is returned. Previously, 1e30 was returned, but the "_FillValue" attribute wasn't set.
begin pi = 3.1415626536 area = gc_tarea((/0.0, 0.0, 90.0/), (/0.0, 90.0, 0.0/)) print ("One eighth surface area of a unit sphere = " + area) endproduces:
(0) One eighth surface area of a unit sphere = 1.5708