PyNGL Home > Functions > Lat/Lon manipulators

Ngl.gc_interp

Interpolates points along a great circle between two specified points on the globe.

Prototype

lat,lon = Ngl.gc_interp(lat1, lon1, lat2, lon2, npts)

Arguments

lat1, lon1

Latitude and longitude, in degrees, of the first point on the globe.

lat2, lon2

Latitude and longitude, in degrees, of second point on the globe.

npts

The number of equally-spaced points you want to interpolate to.

Return values

lat, lon

The returned latitudes and longitudes are returned as NumPy arrays in degrees in the interval [0.,360) if npts is positive and in the interval [-180.,180.) if npts is negative.

Description

This function interpolates points along a great circle between two specified points on the globe. The arguments lat1 and lon1 specify the latitude and longitude of the first point; the arguments lat2 and lon2 specify the latitude and longitude of the second point. The argument npts specifies the number of points you want to interpolate - this number includes the original two points (the number of points actually interpolated is npts-2).

See Also

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

Examples

The following Python code snippet:

  npts = 10
  lat,lon = Ngl.gc_interp(0.,300.,0.,310.,-npts)
  for i in range(npts):
    print "%3d %10.5f %10.5f" % (i,lat[i],lon[i])
produces:
  0    0.00000  -60.00000
  1    0.00000  -58.88889
  2    0.00000  -57.77778
  3    0.00000  -56.66667
  4    0.00000  -55.55556
  5    0.00000  -54.44445
  6    0.00000  -53.33334
  7    0.00000  -52.22223
  8    0.00000  -51.11111
  9    0.00000  -50.00000