[Numpy-discussion] How do I use numpy to do this?

Charlie Moad cwmoad at gmail.com
Thu Jun 1 13:09:00 EDT 2006


Here's my crack at it.

pts = mgrid[minx:maxx,miny:maxy].transpose()
pts.reshape(pts.size/2, 2)
#pts is good to go

On 6/1/06, Christopher Barker <Chris.Barker at noaa.gov> wrote:
>
> I'm trying to get the (x,y) coords for all the points in a grid, bound
> by xmin, xmax, ymin, ymax.
>
> This list comprehension does it fine:
>
> Points = [(x,y) for x in xrange(minx, maxx) for y in xrange(miny, maxy)]
>
> But I can't think at the moment how to do it with numpy. Any ideas?
>
> Thanks,
>
> -Chris
>
>
> --
> Christopher Barker, Ph.D.
> Oceanographer
>
> NOAA/OR&R/HAZMAT         (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
>
>
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>




More information about the NumPy-Discussion mailing list