Subdividing NumPy array into Regular Grid

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?

I think you want np.meshgrid -paul On Sun, Oct 26, 2014 at 2:09 AM, Artur Bercik <vbubbly21@gmail.com> wrote:
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?
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
participants (2)
-
Artur Bercik
-
Paul Hobson