Predicting spectral information / multi-sensor homogenization

To execute the spectral homogenization, i.e., to transform the spectral information from one sensor into the spectral domain of another one, SpecHomo provides the SpectralHomogenizer class. Please see the linked content for a full documentation of this class.

For the sake of simplicity, the usage of this class is described below, at the example of Landsat-8 data, spectrally adapted to Sentinel-2A. Transformations between various other sensors are possible, see Which sensor transformations are available?.

First, load the Landsat-8 surface-reflectance image that you want to transform to the spectral domain of Sentinel-2A (we use the geoarray library for this - it is installed with SpecHomo):

from geoarray import GeoArray

image_l8 = GeoArray('/path/to/your/Landsat/image/LC81940242014072LGN00_surface_reflectance__stacked.bsq')

Attention

Please make sure, that the Landsat-8 input image contains the right bands in the correct order before you run the homogenization! By running the list_available_transformations function as described here, you can find out, that the needed band list is [‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’]. These band numbers refer to the official provider band-names as described for Landsat at the USGS website.

Now run the homogenization by using the SpectralHomogenizer class as follows:

from spechomo import SpectralHomogenizer

# get an instance of SpectralHomogenizer class:
SH = SpectralHomogenizer()

# run the spectral homogenization
image_s2, errors = SH.predict_by_machine_learner(
    arrcube=image_l8[:,:,:7],
    method='LR',
    n_clusters=50,
    src_satellite='Landsat-8',
    src_sensor='OLI_TIRS',
    src_LBA=['1', '2', '3', '4', '5', '6', '7'],  # must be passed as list of strings and match the band numbers of the input image
    tgt_satellite='Sentinel-2A',
    tgt_sensor='MSI',
    tgt_LBA=['1', '2', '3', '4', '5', '6', '7', '8', '8A', '11', '12'],
    classif_alg='kNN_SAM',
    global_clf_threshold=4
)

# save the Sentinel-2A adapted Landsat-8 image to disk
image_s2.save('/your/output/path/l8_s2_homogenization_result.bsq')

# save the estimated homogenization errors/uncertainties to disk
errors.save('/your/output/path/l8_s2_homogenization_errors.bsq')

Note