diff --git a/.gitignore b/.gitignore index 07c1f23485792c0fc97e281c7868d29c2f253628..3077e087194aa3c3e197178455eb69055b0c61fb 100644 --- a/.gitignore +++ b/.gitignore @@ -71,6 +71,8 @@ instance/ # Sphinx documentation docs/_build/ +docs/_static/ +docs/_templates/ # PyBuilder .pybuilder/ diff --git a/GeoSpatialTools/distance_metrics.py b/GeoSpatialTools/distance_metrics.py index 339b0fcd9d32dc7e20fe3c5b9eae0e3f41ce5c91..024360d359d43e14c29b70977cc44940bf2c7e67 100644 --- a/GeoSpatialTools/distance_metrics.py +++ b/GeoSpatialTools/distance_metrics.py @@ -1,4 +1,6 @@ """ +Distance Metrics +---------------- Functions for computing navigational information. Can be used to add navigational information to DataFrames. """ diff --git a/GeoSpatialTools/great_circle.py b/GeoSpatialTools/great_circle.py index b2cb6d9b8fa1430845e6f52bed196d7fd7d0aa7b..b6a2882f10285b2618449b73c0d8412a674144c3 100644 --- a/GeoSpatialTools/great_circle.py +++ b/GeoSpatialTools/great_circle.py @@ -1,4 +1,9 @@ -"""Class for a Great Circle object.""" +""" +GreatCircle +----------- +Constructors and methods for interacting with GreatCircle objects, including +comparisons between GreatCircle objects. +""" import numpy as np diff --git a/GeoSpatialTools/kdtree.py b/GeoSpatialTools/kdtree.py index 7da9df63688f8d7c4f7e4c954e302ac89a6a3acb..7151bc680a818601d53cf09018f3a1a7dc37db0e 100644 --- a/GeoSpatialTools/kdtree.py +++ b/GeoSpatialTools/kdtree.py @@ -1,6 +1,12 @@ """ +KDTree +------ An implementation of KDTree using Haversine Distance for GeoSpatial analysis. -Useful tool for quickly searching for nearest neighbours. +Useful tool for quickly searching for nearest neighbours. The implementation is +a K=2 or 2DTree as only 2 dimensions (longitude and latitude) are used. + +Haversine distances are used for comparisons, so that the spherical geometry +of the earth is accounted for. """ from . import Record diff --git a/GeoSpatialTools/neighbours.py b/GeoSpatialTools/neighbours.py index 02143fca57dddaeb8402c0f44984f1825e29f672..0d86e8ac72df2cb92720a11b6b3529deff531d71 100644 --- a/GeoSpatialTools/neighbours.py +++ b/GeoSpatialTools/neighbours.py @@ -1,4 +1,8 @@ -"""Functions for finding nearest neighbours using bisection.""" +""" +Neighbours +---------- +Functions for finding nearest neighbours using bisection. +""" from numpy import argmin from bisect import bisect diff --git a/GeoSpatialTools/octtree.py b/GeoSpatialTools/octtree.py index 029ff9ec82ab446b84869854ea3e4234dd9d6bb2..79542ff0721e331df7398b42d7b67fbff6228016 100644 --- a/GeoSpatialTools/octtree.py +++ b/GeoSpatialTools/octtree.py @@ -1,3 +1,12 @@ +""" +OctTree +------- +Constuctors for OctTree classes that can decrease the number of comparisons +for detecting nearby records for example. This is an implementation that uses +Haversine distances for comparisons between records for identification of +neighbours. +""" + from dataclasses import dataclass from typing import List, Optional import datetime diff --git a/GeoSpatialTools/quadtree.py b/GeoSpatialTools/quadtree.py index 214bc38bf9976b0f06d02c59d0cc8880c400a12c..90a22c78d08e711e0edad577a9b2a02fe66a1503 100644 --- a/GeoSpatialTools/quadtree.py +++ b/GeoSpatialTools/quadtree.py @@ -1,6 +1,10 @@ """ +QuadTree +-------- Constuctors for QuadTree classes that can decrease the number of comparisons -for detecting nearby records for example +for detecting nearby records for example. This is an implementation that uses +Haversine distances for comparisons between records for identification of +neighbours. """ from dataclasses import dataclass diff --git a/docs/Documentation.pdf b/docs/Documentation.pdf new file mode 100644 index 0000000000000000000000000000000000000000..6a58790d1687803da242444d40e9db003d084604 Binary files /dev/null and b/docs/Documentation.pdf differ diff --git a/docs/Documentation.tex b/docs/Documentation.tex new file mode 100644 index 0000000000000000000000000000000000000000..d34c8f1d8df8347ae27b2cdd6110322a441ca983 --- /dev/null +++ b/docs/Documentation.tex @@ -0,0 +1,1893 @@ +%% Generated by Sphinx. +\def\sphinxdocclass{report} +\documentclass[letterpaper,10pt,english]{sphinxmanual} +\ifdefined\pdfpxdimen + \let\sphinxpxdimen\pdfpxdimen\else\newdimen\sphinxpxdimen +\fi \sphinxpxdimen=.75bp\relax +\ifdefined\pdfimageresolution + \pdfimageresolution= \numexpr \dimexpr1in\relax/\sphinxpxdimen\relax +\fi +%% let collapsible pdf bookmarks panel have high depth per default +\PassOptionsToPackage{bookmarksdepth=5}{hyperref} + +\PassOptionsToPackage{booktabs}{sphinx} +\PassOptionsToPackage{colorrows}{sphinx} + +\PassOptionsToPackage{warn}{textcomp} +\usepackage[utf8]{inputenc} +\ifdefined\DeclareUnicodeCharacter +% support both utf8 and utf8x syntaxes + \ifdefined\DeclareUnicodeCharacterAsOptional + \def\sphinxDUC#1{\DeclareUnicodeCharacter{"#1}} + \else + \let\sphinxDUC\DeclareUnicodeCharacter + \fi + \sphinxDUC{00A0}{\nobreakspace} + \sphinxDUC{2500}{\sphinxunichar{2500}} + \sphinxDUC{2502}{\sphinxunichar{2502}} + \sphinxDUC{2514}{\sphinxunichar{2514}} + \sphinxDUC{251C}{\sphinxunichar{251C}} + \sphinxDUC{2572}{\textbackslash} +\fi +\usepackage{cmap} +\usepackage[T1]{fontenc} +\usepackage{amsmath,amssymb,amstext} +\usepackage{babel} + + + +\usepackage{tgtermes} +\usepackage{tgheros} +\renewcommand{\ttdefault}{txtt} + + + +\usepackage[Bjarne]{fncychap} +\usepackage[,numfigreset=2,mathnumfig]{sphinx} + +\fvset{fontsize=auto} +\usepackage{geometry} + + +% Include hyperref last. +\usepackage{hyperref} +% Fix anchor placement for figures with captions. +\usepackage{hypcap}% it must be loaded after hyperref. +% Set up styles of URL: it should be placed after hyperref. +\urlstyle{same} + +\addto\captionsenglish{\renewcommand{\contentsname}{Contents:}} + +\usepackage{sphinxmessages} +\setcounter{tocdepth}{3} +\setcounter{secnumdepth}{3} + + +\title{GeoSpatialTools} +\date{Dec 12, 2024} +\release{0.10.0} +\author{NOC Surface Processes} +\newcommand{\sphinxlogo}{\vbox{}} +\renewcommand{\releasename}{Release} +\makeindex +\begin{document} + +\ifdefined\shorthandoff + \ifnum\catcode`\=\string=\active\shorthandoff{=}\fi + \ifnum\catcode`\"=\active\shorthandoff{"}\fi +\fi + +\pagestyle{empty} +\sphinxmaketitle +\pagestyle{plain} +\sphinxtableofcontents +\pagestyle{normal} +\phantomsection\label{\detokenize{index::doc}} + + +\sphinxstepscope + + +\chapter{Introduction} +\label{\detokenize{introduction:introduction}}\label{\detokenize{introduction::doc}} +\sphinxAtStartPar +Python library containing useful functions and classes for Spatial Analysis. + +\sphinxAtStartPar +Tested on Python versions 3.9 to 3.13. + +\sphinxstepscope + + +\chapter{Getting Started} +\label{\detokenize{getting_started:getting-started}}\label{\detokenize{getting_started::doc}} + +\section{Installation} +\label{\detokenize{getting_started:installation}} + +\subsection{Via Pip} +\label{\detokenize{getting_started:via-pip}} +\sphinxAtStartPar +GeoSpatialTools is not available on PyPI, however it can be installed via pip with the following command: + +\begin{sphinxVerbatim}[commandchars=\\\{\}] +\PYG{g+go}{pip install git+ssh://git@git.noc.ac.uk/nocsurfaceprocesses/geospatialtools.git} +\end{sphinxVerbatim} + + +\subsection{From Source} +\label{\detokenize{getting_started:from-source}} +\sphinxAtStartPar +Alternatively, you can clone the repository and install using pip (or conda if preferred). + +\begin{sphinxVerbatim}[commandchars=\\\{\}] +\PYG{g+go}{git clone git@git.noc.ac.uk/nocsurfaceprocesses/geospatialtools.git} +\PYG{g+go}{cd geospatialtools} +\PYG{g+go}{python \PYGZhy{}m venv venv} +\PYG{g+go}{source venv/bin/activate} +\PYG{g+go}{pip install \PYGZhy{}e .} +\end{sphinxVerbatim} + +\sphinxstepscope + + +\chapter{Credits} +\label{\detokenize{authors:credits}}\label{\detokenize{authors::doc}} + +\section{Development Lead} +\label{\detokenize{authors:development-lead}}\begin{itemize} +\item {} +\sphinxAtStartPar +Joseph T. Siddons \textless{}\sphinxhref{mailto:josidd@noc.ac.uk}{josidd@noc.ac.uk}\textgreater{} \sphinxhref{git.noc.ac.uk/josidd}{@josidd} + +\end{itemize} + + +\section{Contributoring Developers} +\label{\detokenize{authors:contributoring-developers}}\begin{itemize} +\item {} +\sphinxAtStartPar +Richard C. Cornes \textless{}\sphinxhref{mailto:rcornes@noc.ac.uk}{rcornes@noc.ac.uk}\textgreater{} \sphinxhref{git.noc.ac.uk/ricorne}{@ricorne} + +\end{itemize} + +\sphinxstepscope + + +\chapter{Users Guide} +\label{\detokenize{users_guide:module-GeoSpatialTools.neighbours}}\label{\detokenize{users_guide:users-guide}}\label{\detokenize{users_guide::doc}}\index{module@\spxentry{module}!GeoSpatialTools.neighbours@\spxentry{GeoSpatialTools.neighbours}}\index{GeoSpatialTools.neighbours@\spxentry{GeoSpatialTools.neighbours}!module@\spxentry{module}} + +\section{Neighbours} +\label{\detokenize{users_guide:neighbours}} +\sphinxAtStartPar +Functions for finding nearest neighbours using bisection. +\index{SortedError@\spxentry{SortedError}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.neighbours.SortedError}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{exception\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.neighbours.}}\sphinxbfcode{\sphinxupquote{SortedError}}} +\pysigstopsignatures +\sphinxAtStartPar +Error class for Sortedness + +\end{fulllineitems} + +\index{SortedWarning@\spxentry{SortedWarning}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.neighbours.SortedWarning}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{exception\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.neighbours.}}\sphinxbfcode{\sphinxupquote{SortedWarning}}} +\pysigstopsignatures +\sphinxAtStartPar +Warning class for Sortedness + +\end{fulllineitems} + +\index{find\_nearest() (in module GeoSpatialTools.neighbours)@\spxentry{find\_nearest()}\spxextra{in module GeoSpatialTools.neighbours}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.neighbours.find_nearest}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.neighbours.}}\sphinxbfcode{\sphinxupquote{find\_nearest}}}{\sphinxparam{\DUrole{n}{vals}}\sphinxparamcomma \sphinxparam{\DUrole{n}{test}}\sphinxparamcomma \sphinxparam{\DUrole{n}{check\_sorted}\DUrole{o}{=}\DUrole{default_value}{True}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Find the nearest value in a list of values for each test value. + +\sphinxAtStartPar +Uses bisection for speediness! +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{vals}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}\sphinxstyleliteralemphasis{\sphinxupquote{{[}}}\sphinxstyleliteralemphasis{\sphinxupquote{Numeric}}\sphinxstyleliteralemphasis{\sphinxupquote{{]}}}) \textendash{} List of values \sphinxhyphen{} this is the pool of values for which we are looking +for a nearest match. This list MUST be sorted. Sortedness is not +checked, nor is the list sorted. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{test}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}\sphinxstyleliteralemphasis{\sphinxupquote{{[}}}\sphinxstyleliteralemphasis{\sphinxupquote{Numeric}}\sphinxstyleliteralemphasis{\sphinxupquote{{]} }}\sphinxstyleliteralemphasis{\sphinxupquote{| }}\sphinxstyleliteralemphasis{\sphinxupquote{Numeric}}) \textendash{} List of query values + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{check\_sorted}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Optionally check that the input vals is sorted. Raises an error if set +to True (default), displays a warning if set to False. + +\end{itemize} + +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{Union}}{[}\sphinxcode{\sphinxupquote{List}}{[}\sphinxcode{\sphinxupquote{int}}{]}, \sphinxcode{\sphinxupquote{int}}{]}} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{A list containing the index of the nearest neighbour in vals for each value} + +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{in test. Or the index of the nearest neighbour if test is a single value.} + +\end{itemize} + + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{module@\spxentry{module}!GeoSpatialTools.quadtree@\spxentry{GeoSpatialTools.quadtree}}\index{GeoSpatialTools.quadtree@\spxentry{GeoSpatialTools.quadtree}!module@\spxentry{module}} + +\section{QuadTree} +\label{\detokenize{users_guide:quadtree}}\label{\detokenize{users_guide:module-GeoSpatialTools.quadtree}} +\sphinxAtStartPar +Constuctors for QuadTree classes that can decrease the number of comparisons +for detecting nearby records for example. This is an implementation that uses +Haversine distances for comparisons between records for identification of +neighbours. +\index{Ellipse (class in GeoSpatialTools.quadtree)@\spxentry{Ellipse}\spxextra{class in GeoSpatialTools.quadtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Ellipse}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.quadtree.}}\sphinxbfcode{\sphinxupquote{Ellipse}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{a}}\sphinxparamcomma \sphinxparam{\DUrole{n}{b}}\sphinxparamcomma \sphinxparam{\DUrole{n}{theta}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A simple Ellipse Class for an ellipse on the surface of a sphere. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Horizontal centre of the ellipse + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Vertical centre of the ellipse + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{a}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Length of the semi\sphinxhyphen{}major axis + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{b}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Length of the semi\sphinxhyphen{}minor axis + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{theta}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Angle of the semi\sphinxhyphen{}major axis from horizontal anti\sphinxhyphen{}clockwise in radians + +\end{itemize} + +\end{description}\end{quote} +\index{contains() (GeoSpatialTools.quadtree.Ellipse method)@\spxentry{contains()}\spxextra{GeoSpatialTools.quadtree.Ellipse method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Ellipse.contains}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{contains}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a point is contained within the Ellipse +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{nearby\_rect() (GeoSpatialTools.quadtree.Ellipse method)@\spxentry{nearby\_rect()}\spxextra{GeoSpatialTools.quadtree.Ellipse method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Ellipse.nearby_rect}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby\_rect}}}{\sphinxparam{\DUrole{n}{rect}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a rectangle is near to the Ellipse +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{QuadTree (class in GeoSpatialTools.quadtree)@\spxentry{QuadTree}\spxextra{class in GeoSpatialTools.quadtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.quadtree.}}\sphinxbfcode{\sphinxupquote{QuadTree}}}{\sphinxparam{\DUrole{n}{boundary}}\sphinxparamcomma \sphinxparam{\DUrole{n}{capacity}\DUrole{o}{=}\DUrole{default_value}{5}}\sphinxparamcomma \sphinxparam{\DUrole{n}{depth}\DUrole{o}{=}\DUrole{default_value}{0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{max\_depth}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A Simple QuadTree class for PyCOADS +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{boundary}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{Rectangle}}}}}) \textendash{} The bounding Rectangle of the QuadTree + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{capacity}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The capacity of each cell, if max\_depth is set then a cell at the +maximum depth may contain more points than the capacity. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The current depth of the cell. Initialises to zero if unset. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{max\_depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} The maximum depth of the QuadTree. If set, this can override the +capacity for cells at the maximum depth. + +\end{itemize} + +\end{description}\end{quote} +\index{divide() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{divide()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.divide}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{divide}}}{}{} +\pysigstopsignatures +\sphinxAtStartPar +Divide the QuadTree + +\end{fulllineitems} + +\index{insert() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{insert()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.insert}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{insert}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Insert a point into the QuadTree +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{nearby\_points() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{nearby\_points()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.nearby_points}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby\_points}}}{\sphinxparam{\DUrole{n}{point}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dist}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get all points that are nearby another point +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{List}}{[}{\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Record}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{Record}}}}}{]}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{query() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{query()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.query}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{query}}}{\sphinxparam{\DUrole{n}{rect}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get points that fall in a rectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{List}}{[}{\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Record}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{Record}}}}}{]}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{query\_ellipse() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{query\_ellipse()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.query_ellipse}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{query\_ellipse}}}{\sphinxparam{\DUrole{n}{ellipse}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get points that fall in an ellipse. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{List}}{[}{\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Record}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{Record}}}}}{]}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{remove() (GeoSpatialTools.quadtree.QuadTree method)@\spxentry{remove()}\spxextra{GeoSpatialTools.quadtree.QuadTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.QuadTree.remove}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{remove}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Remove a Record from the QuadTree if it is in the QuadTree. + +\sphinxAtStartPar +Returns True if the Record is removed. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{Record (class in GeoSpatialTools.quadtree)@\spxentry{Record}\spxextra{class in GeoSpatialTools.quadtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Record}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.quadtree.}}\sphinxbfcode{\sphinxupquote{Record}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{datetime}\DUrole{o}{=}\DUrole{default_value}{None}}\sphinxparamcomma \sphinxparam{\DUrole{n}{uid}\DUrole{o}{=}\DUrole{default_value}{None}}\sphinxparamcomma \sphinxparam{\DUrole{n}{fix\_lon}\DUrole{o}{=}\DUrole{default_value}{True}}\sphinxparamcomma \sphinxparam{\DUrole{o}{**}\DUrole{n}{data}}}{} +\pysigstopsignatures +\sphinxAtStartPar +ICOADS Record class + +\sphinxAtStartPar +This is a simple instance of an ICOARDS record, it requires position data. +It can optionally include datetime, a UID, and extra data passed as +keyword arguments. + +\sphinxAtStartPar +Equality is checked only on the required fields + UID if it is specified. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Horizontal coordinate + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Vertical coordinate + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{datetime}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} Datetime of the record + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{uid}} (\sphinxstyleliteralemphasis{\sphinxupquote{str}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} Unique Identifier + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{fix\_lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Force longitude to \sphinxhyphen{}180, 180 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{**data}} \textendash{} Additional data passed to the Record for use by other functions or +classes. + +\end{itemize} + +\end{description}\end{quote} +\index{distance() (GeoSpatialTools.quadtree.Record method)@\spxentry{distance()}\spxextra{GeoSpatialTools.quadtree.Record method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Record.distance}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{distance}}}{\sphinxparam{\DUrole{n}{other}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute the Haversine distance to another Record +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{float}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{Rectangle (class in GeoSpatialTools.quadtree)@\spxentry{Rectangle}\spxextra{class in GeoSpatialTools.quadtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.quadtree.}}\sphinxbfcode{\sphinxupquote{Rectangle}}}{\sphinxparam{\DUrole{n}{west}}\sphinxparamcomma \sphinxparam{\DUrole{n}{east}}\sphinxparamcomma \sphinxparam{\DUrole{n}{south}}\sphinxparamcomma \sphinxparam{\DUrole{n}{north}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A simple Rectangle class +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{west}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Western boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{east}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Eastern boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{south}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Southern boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{north}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Northern boundary of the Rectangle + +\end{itemize} + +\end{description}\end{quote} +\index{contains() (GeoSpatialTools.quadtree.Rectangle method)@\spxentry{contains()}\spxextra{GeoSpatialTools.quadtree.Rectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.contains}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{contains}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a point is contained within the Rectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{edge\_dist (GeoSpatialTools.quadtree.Rectangle property)@\spxentry{edge\_dist}\spxextra{GeoSpatialTools.quadtree.Rectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.edge_dist}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{edge\_dist}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Approximate maximum distance from the centre to an edge + +\end{fulllineitems} + +\index{intersects() (GeoSpatialTools.quadtree.Rectangle method)@\spxentry{intersects()}\spxextra{GeoSpatialTools.quadtree.Rectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.intersects}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{intersects}}}{\sphinxparam{\DUrole{n}{other}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if another Rectangle object intersects this Rectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{lat (GeoSpatialTools.quadtree.Rectangle property)@\spxentry{lat}\spxextra{GeoSpatialTools.quadtree.Rectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.lat}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lat}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Centre latitude of the Rectangle + +\end{fulllineitems} + +\index{lat\_range (GeoSpatialTools.quadtree.Rectangle property)@\spxentry{lat\_range}\spxextra{GeoSpatialTools.quadtree.Rectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.lat_range}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lat\_range}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Latitude range of the Rectangle + +\end{fulllineitems} + +\index{lon (GeoSpatialTools.quadtree.Rectangle property)@\spxentry{lon}\spxextra{GeoSpatialTools.quadtree.Rectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.lon}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lon}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Centre longitude of the Rectangle + +\end{fulllineitems} + +\index{lon\_range (GeoSpatialTools.quadtree.Rectangle property)@\spxentry{lon\_range}\spxextra{GeoSpatialTools.quadtree.Rectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.lon_range}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lon\_range}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Longitude range of the Rectangle + +\end{fulllineitems} + +\index{nearby() (GeoSpatialTools.quadtree.Rectangle method)@\spxentry{nearby()}\spxextra{GeoSpatialTools.quadtree.Rectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.quadtree.Rectangle.nearby}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby}}}{\sphinxparam{\DUrole{n}{point}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dist}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Check if point is nearby the Rectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{module@\spxentry{module}!GeoSpatialTools.octtree@\spxentry{GeoSpatialTools.octtree}}\index{GeoSpatialTools.octtree@\spxentry{GeoSpatialTools.octtree}!module@\spxentry{module}} + +\section{OctTree} +\label{\detokenize{users_guide:octtree}}\label{\detokenize{users_guide:module-GeoSpatialTools.octtree}} +\sphinxAtStartPar +Constuctors for OctTree classes that can decrease the number of comparisons +for detecting nearby records for example. This is an implementation that uses +Haversine distances for comparisons between records for identification of +neighbours. +\index{OctTree (class in GeoSpatialTools.octtree)@\spxentry{OctTree}\spxextra{class in GeoSpatialTools.octtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.octtree.}}\sphinxbfcode{\sphinxupquote{OctTree}}}{\sphinxparam{\DUrole{n}{boundary}}\sphinxparamcomma \sphinxparam{\DUrole{n}{capacity}\DUrole{o}{=}\DUrole{default_value}{5}}\sphinxparamcomma \sphinxparam{\DUrole{n}{depth}\DUrole{o}{=}\DUrole{default_value}{0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{max\_depth}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A Simple OctTree class for PyCOADS. + +\sphinxAtStartPar +Acts as a space\sphinxhyphen{}time OctTree on the surface of Earth, allowing for querying +nearby points faster than searching a full DataFrame. As SpaceTimeRecords +are added to the OctTree, the OctTree divides into 8 children as the +capacity is reached. Additional SpaceTimeRecords are then added to the +children where they fall within the child OctTree’s boundary. + +\sphinxAtStartPar +SpaceTimeRecords already part of the OctTree before divided are not +distributed to the children OctTrees. + +\sphinxAtStartPar +Whilst the OctTree has a temporal component, and was designed to utilise +datetime / timedelta objects, numeric values and ranges can be used. This +usage must be consistent for the boundary and all SpaceTimeRecords that +are part of the OctTree. This allows for usage of pentad, timestamp, +Julian day, etc. as datetime values. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{boundary}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{SpaceTimeRectangle}}}}}) \textendash{} The bounding SpaceTimeRectangle of the QuadTree + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{capacity}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The capacity of each cell, if max\_depth is set then a cell at the +maximum depth may contain more points than the capacity. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The current depth of the cell. Initialises to zero if unset. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{max\_depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} The maximum depth of the QuadTree. If set, this can override the +capacity for cells at the maximum depth. + +\end{itemize} + +\end{description}\end{quote} +\index{divide() (GeoSpatialTools.octtree.OctTree method)@\spxentry{divide()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.divide}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{divide}}}{}{} +\pysigstopsignatures +\sphinxAtStartPar +Divide the QuadTree + +\end{fulllineitems} + +\index{insert() (GeoSpatialTools.octtree.OctTree method)@\spxentry{insert()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.insert}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{insert}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Insert a SpaceTimeRecord into the QuadTree. + +\sphinxAtStartPar +Note that the SpaceTimeRecord can have numeric datetime values if that +is consistent with the OctTree. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{nearby\_points() (GeoSpatialTools.octtree.OctTree method)@\spxentry{nearby\_points()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.nearby_points}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby\_points}}}{\sphinxparam{\DUrole{n}{point}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dist}}\sphinxparamcomma \sphinxparam{\DUrole{n}{t\_dist}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get all points that are nearby another point. + +\sphinxAtStartPar +Query the OctTree to find all SpaceTimeRecords within the OctTree that +are nearby to the query SpaceTimeRecord. This search should be faster +than searching through all records, since only OctTree children whose +boundaries are close to the query SpaceTimeRecord are evaluated. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{point}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecord}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{SpaceTimeRecord}}}}}) \textendash{} The query point. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{dist}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} The distance for comparison. Note that Haversine distance is used +as the distance metric as the query SpaceTimeRecord and OctTree are +assumed to lie on the surface of Earth. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{t\_dist}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.timedelta}}) \textendash{} Max time gap between SpaceTimeRecords within the OctTree and the +query SpaceTimeRecord. Can be numeric if the OctTree boundaries, +SpaceTimeRecords, and query SpaceTimeRecord have numeric datetime +values and ranges. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{points}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecords}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{SpaceTimeRecords}}}}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} List of SpaceTimeRecords already found. Most use cases will be to +not set this value, since it’s main use is for passing onto the +children OctTrees. + +\end{itemize} + +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{{\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecords}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{SpaceTimeRecords}}}}}} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstylestrong{SpaceTimeRecords} (\sphinxstyleemphasis{A list of SpaceTimeRecords whose distance to the}) + +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{query SpaceTimeRecord is \textless{}= dist, and the datetimes of the} + +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{SpaceTimeRecords fall within the datetime range of the query} + +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{SpaceTimeRecord.} + +\end{itemize} + + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{query() (GeoSpatialTools.octtree.OctTree method)@\spxentry{query()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.query}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{query}}}{\sphinxparam{\DUrole{n}{rect}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get points that fall in a SpaceTimeRectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{{\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecords}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{SpaceTimeRecords}}}}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{query\_ellipse() (GeoSpatialTools.octtree.OctTree method)@\spxentry{query\_ellipse()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.query_ellipse}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{query\_ellipse}}}{\sphinxparam{\DUrole{n}{ellipse}}\sphinxparamcomma \sphinxparam{\DUrole{n}{points}\DUrole{o}{=}\DUrole{default_value}{None}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get points that fall in an ellipse. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{{\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecords}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{SpaceTimeRecords}}}}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{remove() (GeoSpatialTools.octtree.OctTree method)@\spxentry{remove()}\spxextra{GeoSpatialTools.octtree.OctTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.OctTree.remove}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{remove}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Remove a SpaceTimeRecord from the OctTree if it is in the OctTree. + +\sphinxAtStartPar +Returns True if the SpaceTimeRecord is removed. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{SpaceTimeEllipse (class in GeoSpatialTools.octtree)@\spxentry{SpaceTimeEllipse}\spxextra{class in GeoSpatialTools.octtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeEllipse}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.octtree.}}\sphinxbfcode{\sphinxupquote{SpaceTimeEllipse}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{a}}\sphinxparamcomma \sphinxparam{\DUrole{n}{b}}\sphinxparamcomma \sphinxparam{\DUrole{n}{theta}}\sphinxparamcomma \sphinxparam{\DUrole{n}{start}}\sphinxparamcomma \sphinxparam{\DUrole{n}{end}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A simple Ellipse Class for an ellipse on the surface of a sphere. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Horizontal centre of the ellipse + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Vertical centre of the ellipse + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{a}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Length of the semi\sphinxhyphen{}major axis + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{b}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Length of the semi\sphinxhyphen{}minor axis + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{theta}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Angle of the semi\sphinxhyphen{}major axis from horizontal anti\sphinxhyphen{}clockwise in radians + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{start}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.datetime}}) \textendash{} Start date of the Ellipse + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{end}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.datetime}}) \textendash{} Send date of the Ellipse + +\end{itemize} + +\end{description}\end{quote} +\index{contains() (GeoSpatialTools.octtree.SpaceTimeEllipse method)@\spxentry{contains()}\spxextra{GeoSpatialTools.octtree.SpaceTimeEllipse method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeEllipse.contains}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{contains}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a point is contained within the Ellipse +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{nearby\_rect() (GeoSpatialTools.octtree.SpaceTimeEllipse method)@\spxentry{nearby\_rect()}\spxextra{GeoSpatialTools.octtree.SpaceTimeEllipse method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeEllipse.nearby_rect}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby\_rect}}}{\sphinxparam{\DUrole{n}{rect}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a rectangle is near to the Ellipse +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{SpaceTimeRecord (class in GeoSpatialTools.octtree)@\spxentry{SpaceTimeRecord}\spxextra{class in GeoSpatialTools.octtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecord}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.octtree.}}\sphinxbfcode{\sphinxupquote{SpaceTimeRecord}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{datetime}}\sphinxparamcomma \sphinxparam{\DUrole{n}{uid}\DUrole{o}{=}\DUrole{default_value}{None}}\sphinxparamcomma \sphinxparam{\DUrole{n}{fix\_lon}\DUrole{o}{=}\DUrole{default_value}{True}}\sphinxparamcomma \sphinxparam{\DUrole{o}{**}\DUrole{n}{data}}}{} +\pysigstopsignatures +\sphinxAtStartPar +ICOADS Record class. + +\sphinxAtStartPar +This is a simple instance of an ICOARDS record, it requires position and +temporal data. It can optionally include a UID and extra data. + +\sphinxAtStartPar +The temporal component was designed to use \sphinxtitleref{datetime} values, however all +methods will work with numeric datetime information \sphinxhyphen{} for example a pentad, +timestamp, julian day, etc. Note that any uses within an OctTree and +SpaceTimeRectangle must also have timedelta values replaced with numeric +ranges in this case. + +\sphinxAtStartPar +Equality is checked only on the required fields + UID if it is specified. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Horizontal coordinate (longitude). + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Vertical coordinate (latitude). + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{datetime}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.datetime}}) \textendash{} Datetime of the record. Can also be a numeric value such as pentad. +Comparisons between Records with datetime and Records with numeric +datetime will fail. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{uid}} (\sphinxstyleliteralemphasis{\sphinxupquote{str}}\sphinxstyleliteralemphasis{\sphinxupquote{ | }}\sphinxstyleliteralemphasis{\sphinxupquote{None}}) \textendash{} Unique Identifier. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{fix\_lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Force longitude to \sphinxhyphen{}180, 180 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{**data}} \textendash{} Additional data passed to the SpaceTimeRecord for use by other functions +or classes. + +\end{itemize} + +\end{description}\end{quote} +\index{distance() (GeoSpatialTools.octtree.SpaceTimeRecord method)@\spxentry{distance()}\spxextra{GeoSpatialTools.octtree.SpaceTimeRecord method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecord.distance}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{distance}}}{\sphinxparam{\DUrole{n}{other}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute the Haversine distance to another SpaceTimeRecord. +Only computes spatial distance. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{float}}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{SpaceTimeRecords (class in GeoSpatialTools.octtree)@\spxentry{SpaceTimeRecords}\spxextra{class in GeoSpatialTools.octtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecords}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.octtree.}}\sphinxbfcode{\sphinxupquote{SpaceTimeRecords}}}{\sphinxparam{\DUrole{n}{iterable}\DUrole{o}{=}\DUrole{default_value}{()}}\sphinxparamcomma \sphinxparam{\DUrole{o}{/}}}{} +\pysigstopsignatures +\sphinxAtStartPar +List of SpaceTimeRecords + +\end{fulllineitems} + +\index{SpaceTimeRectangle (class in GeoSpatialTools.octtree)@\spxentry{SpaceTimeRectangle}\spxextra{class in GeoSpatialTools.octtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.octtree.}}\sphinxbfcode{\sphinxupquote{SpaceTimeRectangle}}}{\sphinxparam{\DUrole{n}{west}}\sphinxparamcomma \sphinxparam{\DUrole{n}{east}}\sphinxparamcomma \sphinxparam{\DUrole{n}{south}}\sphinxparamcomma \sphinxparam{\DUrole{n}{north}}\sphinxparamcomma \sphinxparam{\DUrole{n}{start}}\sphinxparamcomma \sphinxparam{\DUrole{n}{end}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A simple Space Time SpaceTimeRectangle class. + +\sphinxAtStartPar +This constructs a simple Rectangle object. +The defining coordinates are the centres of the box, and the extents +are the full width, height, and time extent. + +\sphinxAtStartPar +Whilst the rectangle is assumed to lie on the surface of Earth, this is +a projection as the rectangle is defined by a longitude/latitude range. + +\sphinxAtStartPar +The temporal components are defined in the same way as the spatial +components, that is that the \sphinxtitleref{datetime} component (t) is the “centreâ€, and +the time extent (dt) is the full time range of the box. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{west}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Western boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{east}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Eastern boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{south}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Southern boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{north}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Northern boundary of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{start}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.datetime}}) \textendash{} Start datetime of the Rectangle + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{end}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.datetime}}) \textendash{} End datetime of the Rectangle + +\end{itemize} + +\end{description}\end{quote} +\index{contains() (GeoSpatialTools.octtree.SpaceTimeRectangle method)@\spxentry{contains()}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.contains}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{contains}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if a point is contained within the SpaceTimeRectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{edge\_dist (GeoSpatialTools.octtree.SpaceTimeRectangle property)@\spxentry{edge\_dist}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.edge_dist}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{edge\_dist}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Approximate maximum distance from the centre to an edge + +\end{fulllineitems} + +\index{intersects() (GeoSpatialTools.octtree.SpaceTimeRectangle method)@\spxentry{intersects()}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.intersects}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{intersects}}}{\sphinxparam{\DUrole{n}{other}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Test if another Rectangle object intersects this Rectangle +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{lat (GeoSpatialTools.octtree.SpaceTimeRectangle property)@\spxentry{lat}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.lat}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lat}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Centre latitude of the Rectangle + +\end{fulllineitems} + +\index{lat\_range (GeoSpatialTools.octtree.SpaceTimeRectangle property)@\spxentry{lat\_range}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.lat_range}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lat\_range}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Latitude range of the Rectangle + +\end{fulllineitems} + +\index{lon (GeoSpatialTools.octtree.SpaceTimeRectangle property)@\spxentry{lon}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.lon}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lon}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Centre longitude of the Rectangle + +\end{fulllineitems} + +\index{lon\_range (GeoSpatialTools.octtree.SpaceTimeRectangle property)@\spxentry{lon\_range}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle property}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.lon_range}} +\pysigstartsignatures +\pysigline{\sphinxbfcode{\sphinxupquote{property\DUrole{w}{ }}}\sphinxbfcode{\sphinxupquote{lon\_range}}\sphinxbfcode{\sphinxupquote{\DUrole{p}{:}\DUrole{w}{ }float}}} +\pysigstopsignatures +\sphinxAtStartPar +Longitude range of the Rectangle + +\end{fulllineitems} + +\index{nearby() (GeoSpatialTools.octtree.SpaceTimeRectangle method)@\spxentry{nearby()}\spxextra{GeoSpatialTools.octtree.SpaceTimeRectangle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRectangle.nearby}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{nearby}}}{\sphinxparam{\DUrole{n}{point}}\sphinxparamcomma \sphinxparam{\DUrole{n}{dist}}\sphinxparamcomma \sphinxparam{\DUrole{n}{t\_dist}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Check if point is nearby the Rectangle + +\sphinxAtStartPar +Determines if a SpaceTimeRecord that falls on the surface of Earth is +nearby to the rectangle in space and time. This calculation uses the +Haversine distance metric. + +\sphinxAtStartPar +Distance from rectangle to point is challenging on the surface of a +sphere, this calculation will return false positives as a check based +on the distance from the centre of the rectangle to the corners, or +to its Eastern edge (if the rectangle crosses the equator) is used in +combination with the input distance. + +\sphinxAtStartPar +The primary use\sphinxhyphen{}case of this method is for querying an OctTree for +nearby Records. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{point}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.octtree.SpaceTimeRecord}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{SpaceTimeRecord}}}}}) + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{dist}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{,}}) + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{t\_dist}} (\sphinxstyleliteralemphasis{\sphinxupquote{datetime.timedelta}}) + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\sphinxstylestrong{bool} + +\sphinxlineitem{Return type} +\sphinxAtStartPar +True if the point is \textless{}= dist + max(dist(centre, corners)) + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{module@\spxentry{module}!GeoSpatialTools.kdtree@\spxentry{GeoSpatialTools.kdtree}}\index{GeoSpatialTools.kdtree@\spxentry{GeoSpatialTools.kdtree}!module@\spxentry{module}} + +\section{KDTree} +\label{\detokenize{users_guide:kdtree}}\label{\detokenize{users_guide:module-GeoSpatialTools.kdtree}} +\sphinxAtStartPar +An implementation of KDTree using Haversine Distance for GeoSpatial analysis. +Useful tool for quickly searching for nearest neighbours. The implementation is +a K=2 or 2DTree as only 2 dimensions (longitude and latitude) are used. + +\sphinxAtStartPar +Haversine distances are used for comparisons, so that the spherical geometry +of the earth is accounted for. +\index{KDTree (class in GeoSpatialTools.kdtree)@\spxentry{KDTree}\spxextra{class in GeoSpatialTools.kdtree}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.kdtree.KDTree}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.kdtree.}}\sphinxbfcode{\sphinxupquote{KDTree}}}{\sphinxparam{\DUrole{n}{points}}\sphinxparamcomma \sphinxparam{\DUrole{n}{depth}\DUrole{o}{=}\DUrole{default_value}{0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{max\_depth}\DUrole{o}{=}\DUrole{default_value}{20}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A Haverine distance implementation of a balanced KDTree. + +\sphinxAtStartPar +This implementation is a \_balanced\_ KDTree, each leaf node should have the +same number of points (or differ by 1 depending on the number of points +the KDTree is intialised with). + +\sphinxAtStartPar +The KDTree partitions in each of the lon and lat dimensions alternatively +in sequence by splitting at the median of the dimension of the points +assigned to the branch. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{points}} (\sphinxstyleliteralemphasis{\sphinxupquote{list}}\sphinxstyleliteralemphasis{\sphinxupquote{{[}}}{\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Record}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{Record}}}}}\sphinxstyleliteralemphasis{\sphinxupquote{{]}}}) \textendash{} A list of GeoSpatialTools.Record instances. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The current depth of the KDTree, you should set this to 0, it is used +internally. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{max\_depth}} (\sphinxstyleliteralemphasis{\sphinxupquote{int}}) \textendash{} The maximium depth of the KDTree. The leaf nodes will have depth no +larger than this value. Leaf nodes will not be created if there is +only 1 point in the branch. + +\end{itemize} + +\end{description}\end{quote} +\index{delete() (GeoSpatialTools.kdtree.KDTree method)@\spxentry{delete()}\spxextra{GeoSpatialTools.kdtree.KDTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.kdtree.KDTree.delete}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{delete}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Delete a Record from the KDTree. May unbalance the KDTree +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{insert() (GeoSpatialTools.kdtree.KDTree method)@\spxentry{insert()}\spxextra{GeoSpatialTools.kdtree.KDTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.kdtree.KDTree.insert}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{insert}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Insert a Record into the KDTree. May unbalance the KDTree. + +\sphinxAtStartPar +The point will not be inserted if it is already in the KDTree. +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{bool}}} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{query() (GeoSpatialTools.kdtree.KDTree method)@\spxentry{query()}\spxextra{GeoSpatialTools.kdtree.KDTree method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.kdtree.KDTree.query}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{query}}}{\sphinxparam{\DUrole{n}{point}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Find the nearest Record within the KDTree to a query Record +\begin{quote}\begin{description} +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{Tuple}}{[}\sphinxcode{\sphinxupquote{List}}{[}{\hyperref[\detokenize{users_guide:GeoSpatialTools.quadtree.Record}]{\sphinxcrossref{\sphinxcode{\sphinxupquote{Record}}}}}{]}, \sphinxcode{\sphinxupquote{float}}{]}} + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{module@\spxentry{module}!GeoSpatialTools.great\_circle@\spxentry{GeoSpatialTools.great\_circle}}\index{GeoSpatialTools.great\_circle@\spxentry{GeoSpatialTools.great\_circle}!module@\spxentry{module}} + +\section{GreatCircle} +\label{\detokenize{users_guide:greatcircle}}\label{\detokenize{users_guide:module-GeoSpatialTools.great_circle}} +\sphinxAtStartPar +Constructors and methods for interacting with GreatCircle objects, including +comparisons between GreatCircle objects. +\index{GreatCircle (class in GeoSpatialTools.great\_circle)@\spxentry{GreatCircle}\spxextra{class in GeoSpatialTools.great\_circle}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{class\DUrole{w}{ }}}\sphinxcode{\sphinxupquote{GeoSpatialTools.great\_circle.}}\sphinxbfcode{\sphinxupquote{GreatCircle}}}{\sphinxparam{\DUrole{n}{lon0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lon1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{R}\DUrole{o}{=}\DUrole{default_value}{6371}}}{} +\pysigstopsignatures +\sphinxAtStartPar +A GreatCircle object for a pair of positions. + +\sphinxAtStartPar +Construct a great circle path between a pair of positions. + +\sphinxAtStartPar +\sphinxurl{https://www.boeing-727.com/Data/fly\%20odds/distance.html} +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of start position. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of start position. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of end position. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of end position. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{R}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Radius of the sphere. Default is Earth radius in km (6371.0). + +\end{itemize} + +\end{description}\end{quote} +\index{dist\_from\_point() (GeoSpatialTools.great\_circle.GreatCircle method)@\spxentry{dist\_from\_point()}\spxextra{GeoSpatialTools.great\_circle.GreatCircle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle.dist_from_point}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{dist\_from\_point}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute distance from the GreatCircle to a point on the sphere. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of the position to test. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of the position to test. + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +Minimum distance between point and the GreatCircle arc. + +\sphinxlineitem{Return type} +\sphinxAtStartPar +float + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{intersection() (GeoSpatialTools.great\_circle.GreatCircle method)@\spxentry{intersection()}\spxextra{GeoSpatialTools.great\_circle.GreatCircle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle.intersection}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{intersection}}}{\sphinxparam{\DUrole{n}{other}}\sphinxparamcomma \sphinxparam{\DUrole{n}{epsilon}\DUrole{o}{=}\DUrole{default_value}{0.01}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Determine intersection position with another GreatCircle. + +\sphinxAtStartPar +Determine the location at which the GreatCircle intersects another +GreatCircle arc. (To within some epsilon threshold). + +\sphinxAtStartPar +Returns \sphinxtitleref{None} if there is no solution \sphinxhyphen{} either because there is no +intersection point, or the planes generated from the arc and centre of +the sphere are identical. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{other}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{GreatCircle}}}}}) \textendash{} Intersecting GreatCircle object + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{epsilon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Threshold for intersection + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +Position of intersection + +\sphinxlineitem{Return type} +\sphinxAtStartPar +(float, float) | None + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{intersection\_angle() (GeoSpatialTools.great\_circle.GreatCircle method)@\spxentry{intersection\_angle()}\spxextra{GeoSpatialTools.great\_circle.GreatCircle method}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle.intersection_angle}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxbfcode{\sphinxupquote{intersection\_angle}}}{\sphinxparam{\DUrole{n}{other}}\sphinxparamcomma \sphinxparam{\DUrole{n}{epsilon}\DUrole{o}{=}\DUrole{default_value}{0.01}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get angle of intersection with another GreatCircle. + +\sphinxAtStartPar +Get the angle of intersection with another GreatCircle arc. Returns +None if there is no intersection. + +\sphinxAtStartPar +The intersection angle is computed using the normals of the planes +formed by the two intersecting great circle objects. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{other}} ({\hyperref[\detokenize{users_guide:GeoSpatialTools.great_circle.GreatCircle}]{\sphinxcrossref{\sphinxstyleliteralemphasis{\sphinxupquote{GreatCircle}}}}}) \textendash{} Intersecting GreatCircle object + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{epsilon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Threshold for intersection + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +Intersection angle in degrees + +\sphinxlineitem{Return type} +\sphinxAtStartPar +float | None + +\end{description}\end{quote} + +\end{fulllineitems} + + +\end{fulllineitems} + +\index{cartesian\_to\_lonlat() (in module GeoSpatialTools.great\_circle)@\spxentry{cartesian\_to\_lonlat()}\spxextra{in module GeoSpatialTools.great\_circle}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.cartesian_to_lonlat}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.great\_circle.}}\sphinxbfcode{\sphinxupquote{cartesian\_to\_lonlat}}}{\sphinxparam{\DUrole{n}{x}}\sphinxparamcomma \sphinxparam{\DUrole{n}{y}}\sphinxparamcomma \sphinxparam{\DUrole{n}{z}}\sphinxparamcomma \sphinxparam{\DUrole{n}{to\_radians}\DUrole{o}{=}\DUrole{default_value}{False}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Get lon, and lat from cartesian coordinates. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{x}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} x coordinate + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{y}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} y coordinate + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{z}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} z coordinate + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{to\_radians}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Return angles in radians. Otherwise return values in degrees. + +\end{itemize} + +\sphinxlineitem{Return type} +\sphinxAtStartPar +\DUrole{sphinx_autodoc_typehints-type}{\sphinxcode{\sphinxupquote{tuple}}{[}\sphinxcode{\sphinxupquote{float}}, \sphinxcode{\sphinxupquote{float}}{]}} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{(float, float)} + +\item {} +\sphinxAtStartPar +\sphinxstyleemphasis{lon, lat} + +\end{itemize} + + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{polar\_to\_cartesian() (in module GeoSpatialTools.great\_circle)@\spxentry{polar\_to\_cartesian()}\spxextra{in module GeoSpatialTools.great\_circle}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.great_circle.polar_to_cartesian}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.great\_circle.}}\sphinxbfcode{\sphinxupquote{polar\_to\_cartesian}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{R}\DUrole{o}{=}\DUrole{default_value}{6371}}\sphinxparamcomma \sphinxparam{\DUrole{n}{to\_radians}\DUrole{o}{=}\DUrole{default_value}{True}}\sphinxparamcomma \sphinxparam{\DUrole{n}{normalised}\DUrole{o}{=}\DUrole{default_value}{True}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Convert from polars coordinates to cartesian. + +\sphinxAtStartPar +Get cartesian coordinates from spherical polar coordinates. Default +behaviour assumes lon and lat, so converts to radians. Set +\sphinxtitleref{to\_radians=False} if the coordinates are already in radians. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{R}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Radius of sphere. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{to\_radians}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Convert lon and lat to radians. + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{normalised}} (\sphinxstyleliteralemphasis{\sphinxupquote{bool}}) \textendash{} Return normalised vector (ignore R value). + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +x, y, z cartesian coordinates. + +\sphinxlineitem{Return type} +\sphinxAtStartPar +(float, float, float) + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{module@\spxentry{module}!GeoSpatialTools.distance\_metrics@\spxentry{GeoSpatialTools.distance\_metrics}}\index{GeoSpatialTools.distance\_metrics@\spxentry{GeoSpatialTools.distance\_metrics}!module@\spxentry{module}} + +\section{Distance Metrics} +\label{\detokenize{users_guide:distance-metrics}}\label{\detokenize{users_guide:module-GeoSpatialTools.distance_metrics}} +\sphinxAtStartPar +Functions for computing navigational information. Can be used to add +navigational information to DataFrames. +\index{bearing() (in module GeoSpatialTools.distance\_metrics)@\spxentry{bearing()}\spxextra{in module GeoSpatialTools.distance\_metrics}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.distance_metrics.bearing}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.distance\_metrics.}}\sphinxbfcode{\sphinxupquote{bearing}}}{\sphinxparam{\DUrole{n}{lon0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lon1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat1}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute the bearing of a track from (lon0, lat0) to (lon1, lat1). + +\sphinxAtStartPar +Duplicated from geo\sphinxhyphen{}py +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{,}}) \textendash{} Longitude of start point + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{,}}) \textendash{} Latitude of start point + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{,}}) \textendash{} Longitude of target point + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}\sphinxstyleliteralemphasis{\sphinxupquote{,}}) \textendash{} Latitude of target point + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\sphinxstylestrong{bearing} \textendash{} The bearing from point (lon0, lat0) to point (lon1, lat1) in degrees. + +\sphinxlineitem{Return type} +\sphinxAtStartPar +float + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{destination() (in module GeoSpatialTools.distance\_metrics)@\spxentry{destination()}\spxextra{in module GeoSpatialTools.distance\_metrics}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.distance_metrics.destination}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.distance\_metrics.}}\sphinxbfcode{\sphinxupquote{destination}}}{\sphinxparam{\DUrole{n}{lon}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat}}\sphinxparamcomma \sphinxparam{\DUrole{n}{bearing}}\sphinxparamcomma \sphinxparam{\DUrole{n}{distance}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute destination of a great circle path. + +\sphinxAtStartPar +Compute the destination of a track started from ‘lon’, ‘lat’, with +‘bearing’. Distance is in units of km. + +\sphinxAtStartPar +Duplicated from geo\sphinxhyphen{}py +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of initial position + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of initial position + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{bearing}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Direction of track + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{distance}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Distance to travel + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\sphinxstylestrong{destination} \textendash{} Longitude and Latitude of final position + +\sphinxlineitem{Return type} +\sphinxAtStartPar +tuple{[}float, float{]} + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{gcd\_slc() (in module GeoSpatialTools.distance\_metrics)@\spxentry{gcd\_slc()}\spxextra{in module GeoSpatialTools.distance\_metrics}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.distance_metrics.gcd_slc}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.distance\_metrics.}}\sphinxbfcode{\sphinxupquote{gcd\_slc}}}{\sphinxparam{\DUrole{n}{lon0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lon1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat1}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute great circle distance on earth surface between two locations. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 1 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 1 + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\sphinxstylestrong{dist} \textendash{} Great circle distance between position 0 and position 1. + +\sphinxlineitem{Return type} +\sphinxAtStartPar +float + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{haversine() (in module GeoSpatialTools.distance\_metrics)@\spxentry{haversine()}\spxextra{in module GeoSpatialTools.distance\_metrics}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.distance_metrics.haversine}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.distance\_metrics.}}\sphinxbfcode{\sphinxupquote{haversine}}}{\sphinxparam{\DUrole{n}{lon0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lon1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat1}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute Haversine distance between two points. +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 1 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 1 + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +\sphinxstylestrong{dist} \textendash{} Haversine distance between position 0 and position 1. + +\sphinxlineitem{Return type} +\sphinxAtStartPar +float + +\end{description}\end{quote} + +\end{fulllineitems} + +\index{midpoint() (in module GeoSpatialTools.distance\_metrics)@\spxentry{midpoint()}\spxextra{in module GeoSpatialTools.distance\_metrics}} + +\begin{fulllineitems} +\phantomsection\label{\detokenize{users_guide:GeoSpatialTools.distance_metrics.midpoint}} +\pysigstartsignatures +\pysiglinewithargsret{\sphinxcode{\sphinxupquote{GeoSpatialTools.distance\_metrics.}}\sphinxbfcode{\sphinxupquote{midpoint}}}{\sphinxparam{\DUrole{n}{lon0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat0}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lon1}}\sphinxparamcomma \sphinxparam{\DUrole{n}{lat1}}}{} +\pysigstopsignatures +\sphinxAtStartPar +Compute the midpoint of a great circle track +\begin{quote}\begin{description} +\sphinxlineitem{Parameters}\begin{itemize} +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat0}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 0 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lon1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Longitude of position 1 + +\item {} +\sphinxAtStartPar +\sphinxstyleliteralstrong{\sphinxupquote{lat1}} (\sphinxstyleliteralemphasis{\sphinxupquote{float}}) \textendash{} Latitude of position 1 + +\end{itemize} + +\sphinxlineitem{Returns} +\sphinxAtStartPar +Positions of midpoint between position 0 and position 1 + +\sphinxlineitem{Return type} +\sphinxAtStartPar +lon, lat + +\end{description}\end{quote} + +\end{fulllineitems} + + + +\renewcommand{\indexname}{Python Module Index} +\begin{sphinxtheindex} +\let\bigletter\sphinxstyleindexlettergroup +\bigletter{g} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.distance\_metrics}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.distance_metrics}} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.great\_circle}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.great_circle}} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.kdtree}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.kdtree}} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.neighbours}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.neighbours}} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.octtree}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.octtree}} +\item\relax\sphinxstyleindexentry{GeoSpatialTools.quadtree}\sphinxstyleindexpageref{users_guide:\detokenize{module-GeoSpatialTools.quadtree}} +\end{sphinxtheindex} + +\renewcommand{\indexname}{Index} +\printindex +\end{document} \ No newline at end of file diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..d4bb2cbb9eddb1bb1b4f366623044af8e4830919 --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/authors.rst b/docs/authors.rst new file mode 100644 index 0000000000000000000000000000000000000000..8f6ac58bfa99bdfe5ad271401b9cd4cfc54968d4 --- /dev/null +++ b/docs/authors.rst @@ -0,0 +1,13 @@ +======= +Credits +======= + +Development Lead +---------------- + +* Joseph T. Siddons <josidd@noc.ac.uk> `@josidd <git.noc.ac.uk/josidd>`_ + +Contributoring Developers +------------------------- + +* Richard C. Cornes <rcornes@noc.ac.uk> `@ricorne <git.noc.ac.uk/ricorne>`_ diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000000000000000000000000000000000000..1e95dc17cc0a706225a0d42b3159cb0b1782ee88 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,100 @@ +"""Conf file for documentation builder""" +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information +import os +import sys + +sys.path.insert(0, os.path.abspath("../")) + +project = "GeoSpatialTools" +copyright = "2024, National Oceanography Centre" +author = "NOC Surface Processes" +release = "0.10.0" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "sphinx.ext.autodoc", + "sphinx.ext.doctest", + "sphinx.ext.todo", + "sphinx.ext.mathjax", + "sphinx.ext.ifconfig", + "sphinx.ext.viewcode", + "sphinx.ext.githubpages", + "sphinx.ext.napoleon", + "sphinx.ext.autosummary", + "sphinx_autodoc_typehints", +] # 'autoapi.extension', + +# autoapi_type = 'python' +# autoapi_dirs = ['../../'] +# add_module_names = False +# autoapi_keep_files = False +# autodoc_typehints = "description" + +# autoapi_options = ['members', 'undoc-members', 'private-members'] +# autoapi_options = ['members', 'undoc-members', 'private-members', +# 'show-inheritance', 'show-module-summary', +# 'special-members', 'imported-members'] +# autoapi_ignore = ['*mymodel*', '*conf*', '*gather_stats_c99.py*'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ["_templates"] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + +pygments_style = "gruvbox-light" +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +# "sphinxawesome_theme" # 'sphinx_rtd_theme' # 'alabaster' +html_theme = "sphinx_rtd_theme" +# html_theme_options = { +# "rightsidebar": "true", +# "relbarbgcolor": "black" +# } +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +html_theme_options = { + "style_nav_header_background": "white", + "display_version": True, + "logo_only": False, + "collapse_navigation": False, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +# html_static_path = ['_static'] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +html_sidebars = { + "**": ["logo-text.html", "globaltoc.html", "searchbox.html"] + # '**': ['logo-text.html', 'globaltoc.html', 'localtoc.html', + # 'searchbox.html'] +} + +numfig = True +math_numfig = True +numfig_secnum_depth = 2 +math_eqref_format = "Eq. {number}" diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 0000000000000000000000000000000000000000..26ae0d55e5be829a48750f3fc164fb2d19aed73e --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,28 @@ +=============== +Getting Started +=============== + +Installation +============ + +Via Pip +------- + +GeoSpatialTools is not available on PyPI, however it can be installed via pip with the following command: + +.. code-block:: console + + pip install git+ssh://git@git.noc.ac.uk/nocsurfaceprocesses/geospatialtools.git + +From Source +----------- + +Alternatively, you can clone the repository and install using pip (or conda if preferred). + +.. code-block:: console + + git clone git@git.noc.ac.uk/nocsurfaceprocesses/geospatialtools.git + cd geospatialtools + python -m venv venv + source venv/bin/activate + pip install -e . diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..b373b14a64ef5d2c7a393a8aba54cfa41a301d25 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,24 @@ +.. PyCOADS documentation master file, created by + sphinx-quickstart on Fri Jul 5 11:49:36 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to GeoSpatialTool's documentation! +========================================== + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + introduction + getting_started + authors + users_guide + +.. +.. Indices and tables +.. ================== +.. +.. * :ref:`genindex` +.. * :ref:`modindex` +.. * :ref:`search` diff --git a/docs/introduction.rst b/docs/introduction.rst new file mode 100644 index 0000000000000000000000000000000000000000..4af892ed36ac977e4f97c837cc343eac092c0bd1 --- /dev/null +++ b/docs/introduction.rst @@ -0,0 +1,7 @@ +============ +Introduction +============ + +Python library containing useful functions and classes for Spatial Analysis. + +Tested on Python versions 3.9 to 3.13. diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000000000000000000000000000000000000..32bb24529f92346af26219baed295b7488b77534 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/users_guide.rst b/docs/users_guide.rst new file mode 100644 index 0000000000000000000000000000000000000000..1df6eeeaa0cb894ca5a05f507f6a6309462cd923 --- /dev/null +++ b/docs/users_guide.rst @@ -0,0 +1,21 @@ +=========== +Users Guide +=========== + +.. automodule:: GeoSpatialTools.neighbours + :members: + +.. automodule:: GeoSpatialTools.quadtree + :members: + +.. automodule:: GeoSpatialTools.octtree + :members: + +.. automodule:: GeoSpatialTools.kdtree + :members: + +.. automodule:: GeoSpatialTools.great_circle + :members: + +.. automodule:: GeoSpatialTools.distance_metrics + :members: diff --git a/pyproject.toml b/pyproject.toml index 049183b816af7008e6ddce81fa6f42bbcb81eb71..2477ea621411ebe3ffed00e12a537ab68e37db41 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ packages = ["GeoSpatialTools"] [project] name = "GeoSpatialTools" -version = "0.9.0" +version = "0.10.0" dependencies = [ "numpy", ] @@ -45,10 +45,18 @@ notebooks = [ test = [ "pytest", ] +docs = [ + "sphinx>=7.4.7", + "sphinx-autodoc-typehints>=2.3.0", + "sphinx-rtd-theme>=3.0.2", +] all = [ "ipykernel", "polars", "pytest", + "sphinx>=7.4.7", + "sphinx-autodoc-typehints>=2.3.0", + "sphinx-rtd-theme>=3.0.2", ] [tool.ruff]