INREGION is the jSphere module of jLab.

  INREGION  Tests whether lat/lon points lie within a specified box.
 
    BOOL = INREGION(REGION,LAT,LON), where LAT and LON are arrays having
    the same size, returns an array BOOL which is true (=1) for all
    LAT/LON pairs which lie inside REGION, and false (=0) otherwise.
 
    REGION is an array with the format [WEST EAST SOUTH NORTH]. Longitudes 
    may either be specified on the interval [-180, 180] or on [0, 360].
 
    The region may overlap the prime meridian (LON=0) or the dateline
    (LON=180).  Region boundaries are interpreted to exclude the poles. 
    ______________________________________________________________________
 
    Cell array lat/lon input 
 
    INREGION also works if LAT and LON are cell arrays. 
 
    In this case, BOOL is also a cell array, with the Kth element of BOOL, 
    BOOL{K}, being a boolean array of the same size as LAT{K} and LON{K}.
    ______________________________________________________________________
 
    Multiple boxes 
 
    INREGION can detect if points are within any of several boxes.  To do
    so, just make REGION a cell array, REGION={R1,R2,...,RN} where the RN
    are numeric arrays, each with the format [WEST EAST SOUTH NORTH].
   
    In this way one can build up a more general region from the union of
    several rectangular regions.  
    ______________________________________________________________________
 
    See also REGIONPLOT, INELLIPSE, TRAJEXTRACT.
 
    'inregion --t' runs a test.
 
    Usage:  bool=inregion(region,lat,lon);
    _________________________________________________________________
    This is part of JLAB --- type 'help jlab' for more information
    (C) 2006--2016 J.M. Lilly --- type 'help jlab_license' for details

contents | allhelp | index