On 06/27/2014 02:14 AM, billyi wrote:
> And I think the longitudes and latitudes are not monotonic, but I don't know
> the way to check this, other than checking the array like lon[:] in
> terminal. Is there a better way?

numpy slicing (subtract prior from next element check that 'all' the 
results are >=0):

In [1]: import numpy

In [2]: x=numpy.array([1,2,3,4,5])

In [3]: (x[1:]-x[:-1])>=0
Out[3]: array([ True,  True,  True,  True], dtype=bool)

In [4]: numpy.all((x[1:]-x[:-1])>=0)
Out[4]: True

In [5]: x=numpy.array([1,3,2,5,4])

In [6]: numpy.all((x[1:]-x[:-1])>=0)
Out[6]: False


------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to