Module delta.extensions.sources.sentinel1

Functions to support Sentinel1 satellites.

Functions

def get_files_from_unpack_folder(folder)

Return the source image file paths from the given unpack folder. Returns [] if the files were not found.

def get_merged_path(unpack_folder)
def run_ffilipponi_preprocessing(source_file, target_file)

Execute the ffilipponi SNAP preprocessing script using the gpt tool

Filipponi, F. (2019). Sentinel-1 GRD Preprocessing Workflow. In Multidisciplinary Digital Publishing Institute Proceedings (Vol. 18, No. 1, p. 11).

https://github.com/ffilipponi/Sentinel-1_GRD_preprocessing

def unpack_s1_to_folder(zip_path, unpack_folder)

Returns the merged image path from the unpack folder. Unpacks the zip file and merges the source images as needed.

Classes

class Sentinel1Image (paths, nodata_value=None)

Sentinel1 image tensorflow dataset wrapper (see imagery_dataset.py)

Opens a geotiff for reading.

Parameters

paths : str or List[str]
Either a single filename or a list. For a list, the images are opened in order as a multi-band image, assumed to overlap.
nodata_value : dtype of image
Value representing no data.
Expand source code
class Sentinel1Image(tiff.TiffImage):
    """Sentinel1 image tensorflow dataset wrapper (see imagery_dataset.py)"""
    def __init__(self, paths, nodata_value=None):
        self._meta_path = None
        self._meta   = None
        self._sensor = None
        self._date   = None
        self._name   = None
        super().__init__(paths, nodata_value)

    def _unpack(self, zip_path):
        # Get the folder where this will be stored from the cache manager
        unpack_folder = config.io.cache.manager().register_item(self._name)

        return unpack_s1_to_folder(zip_path, unpack_folder)

    def _prep(self, paths):
        """Prepares a Sentinel1 file from the archive for processing.
           Returns the path to the file ready to use.
           --> This version does not do any preprocessing!!!
        """
        assert isinstance(paths, str)
        ext = os.path.splitext(paths)[1]

        self._name = os.path.splitext(os.path.basename(paths))[0]

        tif_path = None
        if ext == '.zip': # Need to unpack

            tif_path = self._unpack(paths)

        if ext == '.vrt': # Already unpacked

            unpack_folder = os.path.dirname(paths)
            tif_path = get_merged_path(unpack_folder)

        if ext == '.tif': # Manually unpacked
            tif_path = paths

        assert tif_path is not None, f'Error: Unsupported extension {ext}'

        return [tif_path]

Ancestors

Inherited members