<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 20, 2018 at 1:57 PM, Edward Gryspeerdt <span dir="ltr"><<a href="mailto:edward.grys@gmail.com" target="_blank">edward.grys@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div>Hi Ashwin,<br><br></div>If you are using the whole globe, you might want to consider using something like a VP-tree instead.  A KD-tree needs left/right to be defined, which you can't do on a sphere.  <br><br></div>Scikit-learn has a BallTree, which you can use with a 'haversine' distance metric, which should allow you to do do nearest neighbours on a sphere<br><br><a href="http://scikit-learn.org/stable/modules/generated/sklearn.neighbors.BallTree.html" target="_blank">http://scikit-learn.org/<wbr>stable/modules/generated/<wbr>sklearn.neighbors.BallTree.<wbr>html</a><br><br></div><div>Hope that helps,</div>Ed<br><div><br></div></div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On 20 May 2018 at 17:49, ashwin .D <span dir="ltr"><<a href="mailto:winash12@gmail.com" target="_blank">winash12@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi David,</div><div>                Many thanks for your prompt response and that maybe the route that I may have to take eventually. I was just wondering whether scipy has any equivalent for the stuff described in this paper - <a href="http://www.soest.hawaii.edu/wessel/sphspline/Wessel+Becker_2008_GJI.pdf" target="_blank">http://www.soest.hawaii.edu/we<wbr>ssel/sphspline/Wessel+Becker_<wbr>2008_GJI.pdf</a> ?</div><div><br></div><div>Regards,</div><div>Ashwin. <br></div></div><div class="m_-6065111458486010214HOEnZb"><div class="m_-6065111458486010214h5"><div class="gmail_extra"><br><div class="gmail_quote">On Sun, May 20, 2018 at 9:56 PM, David Hoese <span dir="ltr"><<a href="mailto:dhoese@gmail.com" target="_blank">dhoese@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ashwin,<br>
<br>
As far as I know this is the easiest way to do it. I'm not a scipy developer, but you may be interested in the pyresample package:<br>
<br>
<a href="http://pyresample.readthedocs.io/en/latest/" rel="noreferrer" target="_blank">http://pyresample.readthedocs.<wbr>io/en/latest/</a><br>
<br>
Which uses the pykdtree library:<br>
<br>
<a href="https://github.com/storpipfugl/pykdtree" rel="noreferrer" target="_blank">https://github.com/storpipfugl<wbr>/pykdtree</a><br>
<br>
And can perform resampling of irregularly spaced data. For certain calculations/utilities it will also convert to XYZ space as described in that SO answer. Hope this helps a little, sorry if it isn't the answer you're looking for.<br>
<br>
Dave<div><div class="m_-6065111458486010214m_-796386377672724003h5"><br>
<br>
On 5/20/18 11:09 AM, ashwin .D wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_-6065111458486010214m_-796386377672724003h5">
Hello,<br>
            I am using - <a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.html#scipy.spatial.KDTree" rel="noreferrer" target="_blank">https://docs.scipy.org/doc/sci<wbr>py/reference/generated/scipy.s<wbr>patial.KDTree.html#scipy.spati<wbr>al.KDTree</a> which  I believe is using Euclidean distances underneath the hood. But I want to be able to use great circle distances. Is this the only way to do this - <a href="https://stackoverflow.com/questions/20654918/python-how-to-speed-up-calculation-of-distances-between-cities" rel="noreferrer" target="_blank">https://stackoverflow.com/ques<wbr>tions/20654918/python-how-to-s<wbr>peed-up-calculation-of-distanc<wbr>es-between-cities</a> or is there some way I can extend that class to use great circle distances(maybe somebody has already done that ? ) I have a irregular shaped grid in a WGS 84 ellipsoid(can be assumed to be a sphere) and so I want to use great circle distances or if somebody can convince me not to that would be great as well.<br>
<br>
<br>
Best regards,<br>
Ashwin.<br>
<br>
<br></div></div>
______________________________<wbr>_________________<br>
SciPy-User mailing list<br>
<a href="mailto:SciPy-User@python.org" target="_blank">SciPy-User@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-user" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-user</a><br>
<br>
</blockquote>
______________________________<wbr>_________________<br>
SciPy-User mailing list<br>
<a href="mailto:SciPy-User@python.org" target="_blank">SciPy-User@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-user" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-user</a><br>
</blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
SciPy-User mailing list<br>
<a href="mailto:SciPy-User@python.org" target="_blank">SciPy-User@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scipy-user" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/scipy-user</a><br>
<br></blockquote></div><br clear="all"></div></div></div></blockquote><div> </div><div><span style="color:rgb(80,0,80)">If the points are on the surface of the globe and the deviation of the ideal surface from a sphere can be neglected, then the mapping from 3-D distance to great circle distance is 1-1 and well defined. Not sure how inefficient 3-D indexing of points on the surface would be, but suspect it isn't too bad. Much depends on the specifics of the problem, and the amount of data. If nothing else, selected points could be checked for spherical distance. I've also mapped spheres onto an octahedron and indexed the sides, but that may not be useful for what you want to do. I suppose you could also use a tetrahedron, which is self dual and would allow two similar indexes and avoid edges and vertices if you were only looking for nearby points.</span></div><div><span style="color:rgb(80,0,80)"><br></span></div><div><span style="color:rgb(80,0,80)">Chuck</span></div></div><br></div></div>