SPHEREGRAD Gradient of a field on the surface of a sphere. [FX,FY]=SPHEREGRAD(LAT,LON,F) computes the gradient of the scalar field F on the surface of the sphere. Latitude LAT and longitude LON are in degrees. LAT and LON are vectors specifing an evenly-spaced grid, and F is an array of any size provided its first two dimensions are LENGTH(LAT) and LENGTH(LON), respectively. FX and FY are the components of the gradient of F in the zonal and meridional directions, respectively, with units of F per meter. These both have the same size as F. The radius of the Earth as specified by RADEARTH is used by default. SPHEREDIV(...,R) uses a sphere of radius R, in kilometers, instead. Derivatives are computed using the first central difference. FZ=SPHEREGRAD(LAT,LON,F) with one output argument returns the complex-valued array FZ=FX+i*FY. ___________________________________________________________________ First and last points SPHEREGRAD can use different boundary conditions in the numerical computation of derivatives for the first and last points. SPHEREGRAD(...,'periodic') uses a periodic derivative with respect to longitude. This is the default behavior. SPHEREGRAD(...,'endpoint') uses the forwards / first backwards difference at the first and last longitude, respectively. For both of these options, the endpoint condition is used for differentiation with respect to latitude. SPHEREGRAD(...,'nans') fills in the first and last values on all four sides of the region with NANs. See VDIFF for more information. ___________________________________________________________________ See also SPHEREDIV, SPHERELAP, SPHERECURL, JSPHERE. 'spheregrad --t' runs a test. Usage: [fx,fy]=spheregrad(lat,lon,f); [fx,fy]=spheregrad(lat,lon,f,R); __________________________________________________________________ This is part of JLAB --- type 'help jlab' for more information (C) 2007--2018 J.M. Lilly --- type 'help jlab_license' for details