[Numpy-discussion] "upsample" or scale an array
Robin Kraft
rkraft4 at gmail.com
Sat Dec 3 01:35:03 EST 2011
I need to take an array - derived from raster GIS data - and upsample or scale it. That is, I need to repeat each value in each dimension so that, for example, a 2x2 array becomes a 4x4 array as follows:
[[1, 2],
[3, 4]]
becomes
[[1,1,2,2],
[1,1,2,2],
[3,3,4,4]
[3,3,4,4]]
It seems like some combination of np.resize or np.repeat and reshape + rollaxis would do the trick, but I'm at a loss.
Many thanks!
-Robin
More information about the NumPy-Discussion
mailing list