Export an ImageProcess object to numpy arrays¶

Create a Map and zoom on a specific place using inter.search method

In [ ]:
map = Map()
map.zoomToExtent(inter.search("Ispra"))
map

Export first band of Core003 ImageCollection to array a and elevation data from EUDEM to array elev

In [ ]:
p03  = inter.ImageCollection("C03").process()
pDEM = inter.ImageCollection("DEM").process()

print "Number of columns: " + str(inter.exportNumColumns(map))
print "Number of rows:    " + str(inter.exportNumRows(map))

a    = inter.exportArray(map, p03, 1)
elev = inter.exportArray(map, pDEM, 1)
In [ ]:
print a
In [ ]:
print elev

The same can be done on a specific extent and zoom level (pay attention to the number of rows and columns!!!)

In [ ]:
ext = [(45.805230217706445, 8.610577583312987), (45.81719544115283, 8.653578758239746)]
(latmin,lonmin),(latmax,lonmax) = ext
zoom = 16

print inter.exportNumColumnsEx(lonmin,latmin,lonmax,latmax,zoom)  # Number of columns of the exported array
print inter.exportNumRowsEx(lonmin,latmin,lonmax,latmax,zoom)     # Number of rows of the exported array
In [ ]:
a    = inter.exportArrayEx(lonmin,latmin,lonmax,latmax,zoom, p03, 1)
elev = inter.exportArrayEx(lonmin,latmin,lonmax,latmax,zoom, pDEM, 1)
In [ ]:
print a
In [ ]:
print elev
In [ ]:
a.shape
In [ ]:
a.dtype.name
In [ ]:
a.itemsize
In [ ]:
a.size
In [ ]: