PyNGL Home > Functions > Lat/Lon manipulators

Ngl.gc_qarea

Finds the area of a convex quadrilateral patch on a sphere whose vertices are given in degrees as lat/lon pairs.

Prototype

area = Ngl.gc_qarea(lat1, lon1, lat2, lon2, lat3, lon3, 
                     lat4, lon4, radius=1.)

Arguments

lat1, lon1

Latitude and longitude, in degrees, of the first vertex. These can be scalars, lists, or NumPy arrays.

lat2, lon2

Latitude and longitude, in degrees, of the second vertex. These can be scalars, lists, or NumPy arrays.

lat3, lon3

Latitude and longitude, in degrees, of the third vertex. These can be scalars, lists, or NumPy arrays.

lat4, lon4

Latitude and longitude, in degrees, of the fourth vertex. These can be scalars, lists, or NumPy arrays.

radius=1.

An optional argument specifying the radius of the sphere.

Return value

area

The desired spherical area which is a scalar if the arguments are scalars, or a NumPy array of the same size as the input arrays otherwise. The vertices must be entered in either clockwise or counter-clockwise order. A returned area is that bounded by arcs of great circles connecting the vertices.

Description

This function finds the area of a convex quadrilateral patch on a sphere whose vertices are given in degrees as lat/lon pairs and are listed in either clockwise or counter-clockwise order. The area found is that area bounded by great circle arcs connecting the vertices. The algorithm simply calls Ngl.gc_tarea on two triangles.

See Also

Ngl.gc_convert, Ngl.gc_dist, Ngl.gc_inout, Ngl.gc_interp, Ngl.gc_qarea, Ngl.gc_tarea

Examples

The following:

  #
  #  Find an area of a half-lune that is 1/20th the area of a unit 
  #  sphere (4*pi/20).
  #
  import Ngl, math
  pi = 4.*math.atan(1.) 
  area = Ngl.gc_qarea(-90., 0., 0., 18., 0., 0., 0., -18.)
  print "%9.7f %9.7f" % (area, 4*pi/20.)
  Ngl.end()

produces:
  0.6283185 0.6283185