Import And Pre-Process

You may need to pre-process your images before being able to work with them. This snippets shows a convenient method to automatically pre-process all imported images.

Prerequisites

To run this code you need:
  • A running Python 3.x Environment

  • A valid WASDI Account

  • A valid Config file

  • A valid params.json file

If this is not clear, you probably need to take a look to the Python Tutorial before.

Recipe

Note

We will use Sentinel-1 GRD and the public LISTSinglePreproc2 workflow for this snippet, but this method can be used with any mission and any compatible workflow.

Note

The LISTSinglePreproc2 is designed to georeference a Sentinel-1 GRD Image (apply orbit, radiometric calibration, terrain correction…)

This is our sample params.json file:

{
    "START_DATE": "2023-01-01",
    "END_DATE": "2023-01-01",
    "BBOX": {
    "northEast": {
        "lat": 20.1,
        "lng": 44.4
        },
    "southWest": {
        "lat": 19.3,
        "lng": 43.2
        }
    },
    "MISSION": "S1",
    "PRODUCT_TYPE": "GRD",
    "WORKFLOW": "LISTSinglePreproc2"
}
# Read Bounding Box, Start and End Date
oBBox = wasdi.getParameter("BBOX", None)
sStartDate = wasdi.getParameter("START_DATE", "2023-01-01")
sEndDate = wasdi.getParameter("END_DATE", "2023-01-31")

# Read Mission and Product Type
sMission = wasdi.getParameter("MISSION", "S1")
sProductType = wasdi.getParameter("PRODUCT_TYPE", "GRD")
sWorkflow = wasdi.getParameter("WORKFLOW", "LISTSinglePreproc2")

# Search Images
aoProductsFound = wasdi.searchEOImages(sMission, sStartDate, sEndDate, sProductType=sProductType, oBoundingBox=oBBox)

 if len(aoImagesToProcess)>0:
     # Import and pre-process all the images: '_preproc.tif' is the suffix added to the original file name that will be used as output name of the workflow
     wasdi.importAndPreprocess(aoProductsFound, sWorkflow, '_preproc.tif')

What it does:

  • Reads Input Parameters

  • Starts searching for S1 GRD Images

  • Imports and runs the workflow on all the images