GithubHelp home page GithubHelp logo

Comments (3)

pbrod avatar pbrod commented on August 24, 2024 1

Ok. I fixed the issue in commit f9bfc79

Now GeoPath, GeoPoint, Nvector and ECEFvector and Pvector return scalars for the case where the input is not actually arrays of points but just single objects.

from nvector.

pbrod avatar pbrod commented on August 24, 2024

Thanks for the notification on this inconsistency.

Actually, both GeoPath(pointA, pointB).track_distance(method='great_circle') and
GeoPath(pointA, pointB).track_distance(method='euclidian') returns an array of m = max(len(pointA), len(pointB)) values.

Note this works either if len(pointA)==len(pointB) or len(pointA)==1 or len(pointB)==1.
In other words it returns all paths between point A and B even if one or both are given as an vector of points..
However, GeoPath(pointA, pointB).track_distance(method='exact') raises a ValueError for m>1.

Also
GeoPath(pointA, pointB).cross_track_distance(pointC, method='great_circle') and
GeoPath(pointA, pointB).cross_track_distance(pointC, method='great_circle') both returns arrays of length m
where m = max(len(pointA), len(pointB), len(pointC)) and either len(pointA)==len(pointB)==len(pointC) or len(pointA)==1 or len(pointB)==1 or len(pointC)==1.

Thus, I am inclined to document this vectorized behavior and make sure GeoPath.track_distance(method='exact') respond in the same way.

from nvector.

freol35241 avatar freol35241 commented on August 24, 2024

@pbrod

Thanks for the explanation! I actually had no idea GeoPath supported vectorized operations.

Still, in order to not confuse the user (me 😉) to much it would be nice to return scalars for the case where the input is not actually arrays of points but just single objects. Compare for example with numpy where functions such as numpy.add returns a scalar if it is provided with scalar inputs but an array if it is provided with arrays as input.

While on the topic of type inconsistencies, I also noticed that GeoPoint sometimes returns latitude and longitude as scalars and sometimes as length 1 arrays. I assume this has a similar reason/explanation?

from nvector.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.