pyrolite.util.spatial
Baisc spatial utility functions.
- pyrolite.util.spatial.great_circle_distance(a, b=None, absolute=False, degrees=True, r=6371.0088, method=None, dtype='float32', max_memory_fraction=0.25)[source]
Calculate the great circle distance between two lat, long points.
- Parameters
a, b (
float
|numpy.ndarray
) – Lat-Long points or arrays to calculate distance between. If only one array is specified, a full distance matrix (i.e. calculate a point-to-point distance for every combination of points) will be returned.absolute (
bool
,False
) – Whether to return estimates of on-sphere distances [True], or simply return the central angle between the points.degrees (
bool
,True
) – Whether lat-long coordinates are in degrees [True] or radians [False].r (
float
) – Earth radii for estimating absolute distances.method (
str
,{'vicenty', 'cosines', 'haversine'}
) – Which method to use for great circle distance calculation. Defaults to the Vicenty formula.dtype (
numpy.dtype
) – Data type for distance arrays, to constrain memory management.max_memory_fraction (
float
) – Constraint to switch to calculating mean distances wherematrix=True
and the distance matrix requires greater than a specified fraction of total avaialbe physical memory.
- pyrolite.util.spatial.piecewise(segment_ranges: list, segments=2, output_fmt=<class 'numpy.float64'>)[source]
Generator to provide values of quantizable paramaters which define a grid, here used to split up queries from databases to reduce load.
- pyrolite.util.spatial.spatiotemporal_split(segments=4, nan_lims=[nan, nan], **kwargs)[source]
Creates spatiotemporal grid using piecewise function and arbitrary ranges for individial kw-parameters (e.g. age=(0., 450.)), and sequentially returns individial grid cell attributes.