PyNGL Home > Functions > Lat/Lon manipulators

Ngl.gc_convert

Converts degrees along a great circle to radians, meters, feet, or kilometers.

Prototype

conv_vals = Ngl.gc_convert(angle, type)

Arguments

angle

A one-dimensional NumPy array (or scalar value) of angles (in degrees).

type

A string (or integer) indicating the units you want to convert to. Legal values are:

  "radians"    (or 0)
  "meters"     (or 1)
  "kilometers" (or 2)
  "feet"       (or 3)
  "miles"      (or 4)

Return value

conv_vals

A NumPy array of the same shape as angle containing the converted values.

Description

This function converts distances along a great circle specified in degrees to radians, meters, feet, or kilometers. The argument angle is any angle in degrees (or a 1D NumPy array of such) and type indicates what units you want to convert to. The argument type can be specified with a string, or an integer, as indicated above.

See Also

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

Examples

The following code:

  print Ngl.gc_convert(10.,"radians")
  print Ngl.gc_convert(10.,"meters")
  print Ngl.gc_convert(10.,"kilometers")
  print Ngl.gc_convert(10.,"feet")
  print Ngl.gc_convert(10.,"miles")
  print Ngl.gc_convert(10.,"kp")

produces:

  0.174532952
  1111987.83444
  1111.98783444
  3648209.68724
  690.948804401
  gc_convert: unrecognized conversion type kp