[Numpy-discussion] Subdividing NumPy array into Regular Grid

Artur Bercik vbubbly21 at gmail.com
Sun Oct 26 05:09:32 EDT 2014


I have a rectangle with the following coordinates:

import numpy as np

ulx,uly = (110, 60) ##uppper left lon, upper left lat
urx,ury = (120, 60) ##uppper right lon, upper right lat
lrx, lry = (120, 50) ##lower right lon, lower right lat
llx, lly = (110, 50) ##lower left lon, lower left lat

I want to divide that single rectangle into 100 regular grids inside that,
and want to calculate the (ulx, uly), (urx,ury), (lrx, lry), and (llx, lly)
for each grid separately:

lats = np.linspace(60, 50, 10)
lons = np.linspace(110, 120, 10)

lats = np.repeat(lats,10).reshape(10,10)
lons = np.tile(lons,10).reshape(10,10)

I could not imagine what to do then?

Is somebody familiar with such kind of problem?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20141026/405397b1/attachment.html>


More information about the NumPy-Discussion mailing list