We’re happy to announce the beta release of Gippy v1.0.0b1. Gippy is a python library to process geospatial raster data (like satellite sensor data) fast and efficiently, regardless of image size, or the size of your machine. We’ve had a lot of success building tools for easily processing Landsat imagery. Gippy gives us the processing engine that will allow us to quickly expand these capabilities to process other open datasets, such as Sentinel-2 and MODIS.
Building upon the previous 0.3 version, we’ve added documentation, automated testing, and additional functionality to create a 1.0.0 release. Gippy is open source and released under an Apache license.
Open-source, powered by open-source
Gippy automatically handles several issues common to geospatial raster data, such as handling of nodata values and managing very large datasets by breaking up processing into pieces. Gippy doesn’t reinvent the wheel, instead encapsulating functionality from GDAL for reading and writing to files, and CImg for doing image processing. It is also reasonably lightweight, requiring only GDAL system libraries and a reasonably modern C++ compiler.
Gippy is built for processing remote sensing data. It intelligently manages band numbers and handles
nodata values in a smart way. It also supports process chaining and piecewise processing. It comes with a range of operations and algorithms out of the box, including:
- arithmetic, logical, exponential and other operations
- dynamic creation and applying of masks
- algorithms for mosaicing multiple images in any combination of projections
- statistics, spectral correlation and covariance
- cloud detection algorithms ACCA and F-mask for Landsat7
- multiple indices (NDVI, EVI, LSWI, NDSI, NDWI, SATVI, MSAVI-2)
- arbitrary linear transforms
- RX Detector, a multispectral anomaly detection algorithm
With Gippy there’s no more having to worry about trying to identify band numbers in your data. Gippy allows algorithms to be written to target specific types of bands (e.g., red, nir, lair). When a GeoImage, the main class that is used, is opened or created bandnames can be assigned by setting the bandnames keyword to open. Bands can be referenced via band index or the band name and can be iterated over as a collection.
from gippy import GeoImage geoimg = GeoImage.open(filename, bandnames=(['red', 'green', 'blue'])) red_arr = geoimg['red'].read()
There’s nodata around these parts
To make identification and customization even easier in Gippy, nodata results can even be set for each raster band, or entire image. Gippy also processes nodata values so that they stay as nodata pixels, even if the actual nodata value is changed when written to an output file. Given that “no data” values are extremely common in geospatial data and are often used to mask out invalid pixels or highlight missing data due to sensor issues, like broken scan line corrector mirrors, it is helpful that they are taken care of automatically.
Process chains and image chunking
In order to efficiently do piecewise processing, Gippy chains together operations (e.g., +, -, log, abs) and applied the chain at one time, when the data is requested (upon a read or save operation).
For example, to convert a landsat-7E TM+ image from radiance to top of the atmosphere reflectance, where theta is the solar zenith angle and sundist is the earth-sun distance:
green_toa = img['green'] * (1.0 / ((1812.0 * numpy.cos(theta)) / (numpy.pi * sundist * sundist)))
The 1812.0 is the exoatmospheric solar irradiance for the green band, as given in the Landsat handbook. This green_toa band can then be further processed, but none of the calculations anywhere in the chain will be performed until a read is requested through the read() or save() functions.
# get a numpy array of the byte scaled green TOA reflectance green = green_toa.autoscale(1, 255).read().astype('byte')
Improving Gippy is just the start. We are working on developing a suite of building blocks, we’re calling sat-utils, to provide easier ways to query, download, and process imagery into a variety of both visual and scientific products. Look out for more on this in the following weeks.