Sorting coordinates array
Maarten van Reeuwijk
maarten at remove_this_ws.tn.tudelft.nl
Fri Dec 19 05:32:09 EST 2003
I'm a newbie to Python, so sorry for this maybe trivial question. I have a
numpy array with coordinates, which I want to sort, for example first on
z-coordinate, then x and lastly y-coordinate. So an array like:
[[0, 0, 0], [0, 2, 1], [1, 1, 0], [0, 1, 1]]
should look after sorting like
[[0, 0, 0], [1, 1, 0], [0, 1, 1], [0, 2, 1]]
I tried the sort command, but that command mangles my coordinate pairs. Also
converting the array to a list doesn't seem to improve the results. How
should I tackle this problem?
TIA, Maarten
--
===================================================================
Maarten van Reeuwijk Heat and Fluid Sciences
Phd student dept. of Multiscale Physics
www.ws.tn.tudelft.nl Delft University of Technology
More information about the Python-list
mailing list