As there are four different methods which you may use to perform the computation of an operator (not counting computePixel() of the PixelOperator, as this is just a replacement of computeTile()), there is sometimes confusion about which one should be used. This Wiki page shall help in determining which methods you need to implement to make your operator run as efficient as possible. This means, we need to specify which contents need to be specified in each of these methods:

Notes for developing

Examples

In the following we discuss a few cases in order to aid you in finding the best way to implement your operator. Note that as we have discussed the properties of computeTile() vs. computeTileStack() vs. computePixel() above, in the remainder we will refer to them only as computeTile() for reasons of readability, also when computeTileStack() or computePixel() is the best choice.

I just want to use some bands from a source product to create new bands in a target product. The computation of tiles can happen spatially independently.

Recommended Procedure: Implement initialize() to define your target product and computeTile() to compute the values of the bands. Do not implement doExecute() .

I want to create a target product, but before I compute the tiles, I want to read in auxiliary data like a large Look-Up-Table. I only need to read it in once.

Recommended Procedure: Implement initialize() to define your target product and computeTile() to compute the values of the bands. Implement doExecute() to read in your auxiliary data, keep it as a field. Do not forget to release it from the cache when you’re done in dispose() .

I find that I cannot use computeTile() in my case, because I am doing something quite special to create my target product. / I would like to write a sort of wrapper around an external application.

Recommended Procedure: Implement initialize() to define your target product. Try to define it as closely as possible to your expected outcome. Put what you need to do to create the target product in doExecute() . Be sure to “fill“ the target product defined in initialize() with your computed values. You do not need to implement computeTile() .

I find I can do without computeTile(). I am content if I can simply set JAI Images to my target bands.

Recommended Procedure: Just implement initialize(), set the JAI Images there directly. You do not need to implement doExecute() or computeTile().

Setting JAI images is enough, but I need to do something that takes some time to come up with these images.

Recommended Procedure: Define the target product in initialize() , use doExecute() for your task and set the JAI Images there.

I actually do not want to create a target product. I just want to write a file or otherwise take care of the output of my operator myself.

Recommended Procedure: This is a bit of abuse of the GPF, but you can do it. Set up a small “dummy“ target product in initialize() without any bands. You will not need to do anything with it, but the GPF requires it to trigger the correct processing routines. Implement your task in doExecute().

I need to compute the whole product twice! First I need to do one pass over all tiles, then I need to do another one. How can I do this?

Recommended Procedure: We recommend to revise your algorithm, as this might lead to problems with the tile cache, but it is possible. For each ot the two runs, create a dedicated Operator. In the doExceute() - method of the operator that implements the second run, use GPF.getDefaultIntance().createOperator() to create the operator that implements the first run to trigger its initialize() - method. Then call OperatorExecutor.create(firstOperator).execute(ProgressMonitor) to trigger the computation of the first product. You can then get the the target product from the first run with firstOperator.getTargetProduct().