This tutorial shows how multiple Graph Processing Framework (GPF) operators can be combined to a graph.
This allows to perform multiple operations in a chain.
Not all options and features are covered in this tutorial, but it gives a brief overview of the capabilities of GPF.
The example is made with a Windows command-line for Linux and Mac Os X you have to adopt the calls appropriately.
If questions arise please consult the BEAM Forum
Introduction to gpt
To get familiar with GPF, let's have a look at the GPF related command line tool named gpt.
Open a console window at
$BEAM_INSTALL_DIR$/bin and type:
This will print out a short description of what the tool is good for and describes the arguments and options of the tool. Also a list of public available operators is displayed.
The usage text for a concrete operator can be displayed by executing
gpt $OperatorName$ -h.
In the following image the usage text for the KMeansClusterAnalysis operator is printed.
The usage text of an operator also displays a template clipping of the operators configuration when used in a graph.
Creating a First Graph
As a first example we will create a graph with only a single operator.
We use the BandMaths operator to extract the flag CLDICE from a MODIS Ocean Color L2 data product. Before using Ocean Color products with GPF, please make sure that you have at least version 1.1.2 of NASA Ocean Color Product Reader.
Put the xml in a file named
cloudMask.xml. And now type at the command line:
gpt c:\tutorial\cloudMask.xml -t c:\tutorial\out\mask.dim C:\tutorial\in\A2008112121000.L2_LAC.hdf
The first argument specifies the graph file to be used for processing, the
-t option specifies the target file where the result is written to, and the last argument specifies the source product for processing.
You might have noticed that in the list of available operators a Read and a Write operator exist. Now you might wonder why these are not used in the graph. The answer is they are not needed. GPF is smart enough to add those operators to the graph on its own. You have to declare them in the graph only in some special cases. But we will not cover these cases in this simple tutorial.
Multiple Operator Graph
Now, we will create a more sophisticated graph.
The task is to create a cloud mask derived from flags, reproject the source product to UTM and write only some bands to the target product.
Therefore we use the BandMaths operator to create the cloud mask band and also to copy bands we like to have in the target product. Afterwards the Reproject operator is used to reproject the product to UTM CRS. Finally we use the subset op in order to limit the band set to the ones we like to have.
Here the operators are concatenated by specifying the preceding node id as source of the current node.
The first node (
cloudNode) of the graph uses the BandMaths operator we already know. it is configured to create the
cloudMask band and also to copy the bands
chlor_a. The second node (
reprojNode) reprojects the output of the
cloudNode to the UTM coordinate reference system. The last one (
subsetNode) creates a band subset from the output of the
reprojNode. It ensures that only the three specified bands (
cloudMask,chlor_a,nLw_443) are written to the target product.