Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Unix: The first line tells the shell what interpreter to use to run the script. Here it is bash.
    Windows: The first thing done in the script is to enable delayed expansion. This allows the evaluation of variables within a loop and is needed when iterating over the source products later on.

  2. Next the path to the gpt batch file is specified. This script is later called to process the data products. The path to the script has to be adapted by the user.

  3. The five parameters which must be given to the script are stored in variables for easier readability.

    1. The path to the XML graph file which defines the processing graph performed on the source data product.

    2. The path to a parameter file. The parameters specified in this file are used to configure graph file. The parameters can be given in the plain properties format format.

    3. The path pointing to the directory which contains the source products.

    4. The path pointing to the directory where the processed data shall be placed.

    5. A file prefix in order to alter the name of the source product and indicate the type of processing.

  4. Unix: Some helper function functions are defined. They are later used in the main processing section.

  5. An output directory is created to keep hold of the processed data.

  6. Now the iteration over all source products starts. Here only products with the extension 'SAFE' and the prefix 'S2' are considered.

    • The absolute path of the current source file is retrieved.

    • The path to the target file is compiled using the target directory, the file prefix and the name of the source product without extension. The file extension for the BEAM-DIMAP format is always appended.

    • The command line is assembled using the path to the gpt.exe file, the XML graph file, the parameter file and the source file and target file. The -e option is added in order to get longer messages in case of an error.

    • As last step the command line is executed.

Info

The loop used in the windows batch script is specific for looping recursively over folders in a directory. If the loop should only consider specific files in a source directory the sytanx can be simpler.

for %%F in (%sourceDirectory%\*.nc) do (

)

This will loop over all *.nc files within the specified source directory.

Known Limitations of the Scripts

  • Naming of the target product is limited. Use cases might be that the name should remain, or a more complex pattern should be applied.

  • Which products of the source directory are used for processing is currently hard coded (only with '.SAFE' extension and 'S2' prefix). This should be configurable.

  • The format of the target product is not configurable.

...