NumPy
NumPy is an extremely fast, multidimensional Python array processor designed specifically for Python and scientific computing but is written in C. It is available via PyPI or as a wheel file (available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy) and can be installed with ease. In addition to its amazing speed, the magic of NumPy includes its interaction with other libraries. NumPy can exchange data with GDAL, Shapely, the Python Imaging Library (PIL), and many other scientific computing Python libraries in other fields.
As a quick example of NumPy’s ability, we’ll combine it with GDAL
to read in our example satellite image and then create a histogram of it. The interface between GDAL
and NumPy is a GDAL
module called gdal_array
, which has NumPy as a dependency. Numeric is the legacy name of the NumPy module. The gdal_array
module imports numpy
.
In the following example, we’ll use gdal_array
, which imports numpy
, to read the image in as an array...