NCL Home > Documentation > Functions > Lat/Lon functions

gc_qarea

Finds the area of a quadrilateral patch on the unit sphere.

Available in version 4.3.1 and later.

Prototype

	function gc_qarea (
		lat  : numeric,  
		lon  : numeric   
	)

	return_val  :  numeric

Arguments

lat
lon

Latitudes and longitudes, in degrees, of the quadrilateral vertices. These can be multi-dimensional arrays, but the rightmost dimension size must be 4, for the vertices of the quadrilateral. The arrays must agree in number of dimensions and in dimension sizes.

Return value

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 input arrays and will agree in dimension sizes up through the penultimate dimension of the input arrays. The return value will be of type double if either of the input arguments is of type double and type float otherwise.

Description

This function finds the area of a quadrilateral 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. If you want the area on a sphere of radius R, simply multiply the return value by R squared.

The method is to divide the quadrilateral into two triangles and sum the areas of those triangles.

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.

See Also

gc_aangle, gc_clkwise, gc_dangle, gc_inout, gc_latlon, gc_onarc, gc_pnt2gc, gc_tarea, nggcog

Examples

Example 1

The following:


;--- Global surface area

    pi    = 3.141593
    R     = 6371.22   ; km
    areaG = 4*pi*R^2  ; total surface area of the globe
    areaG@units = "km^2"
    print("areaG="+sprintf("%12.3f", areaG)+" km^2")

;--- Hemisphere
    quadH = gc_qarea( (/90.0,   0.0, -90.0,  0.0/),  \   ; 4 corner points
                      (/ 0.0, -90.0,   0.0, 90.0/) )

    areaH = quadH*R^2
    print("areaH="+sprintf("%12.3f", areaH)+" km^2")

;--- Percent area of hemisphers
    pcH   = (areaH/areaG)*100    ; % of hemisphere .. should be 50%
    print("pcH="+pcH+"%")

produces:

   	areaT=510099808.000 km^2
   	areaH=255049872.000 km^2
   	pcH=50%