SPHEREDIV is the jSphere module of jLab.

 SPHEREDIV  Divergence of a vector field on the surface of a sphere.
 
    DIV=SPHEREDIV(LAT,LON,U,V) computes the divergence of the vector field
    (U,V) on the surface of the sphere.
 
    U and V are zonal and meridional velocities in meters per second, and
    DIV is in inverse seconds.
 
    LAT and LON are vectors specifing an evenly-spaced grid, and U and V 
    are arrays of size LENGTH(LAT) x LENGTH(LON) x M, where M is greater
    than or equal to one. LAT and LON are in degrees.
 
    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.
 
    [DIV,UX,VY]=SPHEREDIV(LAT,LON,U,V) optionally returns the zonal and
    meridional contributions UX and VY, such that DIV=UX+VY.
    ___________________________________________________________________
 
    First and last points
 
    SPHEREDIV can use different boundary conditions in the numerical
    computation of derivatives for the first and last points.
  
    SPHEREDIV(...,'periodic') uses a periodic derivative with respect
    to longitude.  This is the default behavior.  
 
    SPHEREDIV(...,'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.
 
    SPHEREDIV(...,'nans')  fills in the first and last values on all four
    sides of the region with NANs. 
 
    See VDIFF for more information.  
    ___________________________________________________________________
 
    See also SPHEREGRAD, SPHERELAP, SPHERECURL, JSPHERE.
 
    'spherediv --t' runs a test.
 
    Usage: div=spherediv(lat,lon,u,v);
           [div,ux,vy]=spherediv(lat,lon,u,v);
           div=spherediv(lat,lon,u,v,R);
    __________________________________________________________________
    This is part of JLAB --- type 'help jlab' for more information
    (C) 2007--2017 J.M. Lilly --- type 'help jlab_license' for details

contents | allhelp | index