ENVIRONMENTAL INFORMATICS
GEOINFORMATION PRODUCTS
  BROCKMANN CONSULT
BEAM Java Tutorial
   

Exercise 4

Bring it all together - generate an NDVI product from a MERIS Level-2 product

In exercise we will try to combine all we have learned so far about the BEAM Java API in a program that computes a Normalized Dense Vegetation Index (NDVI) from two reflectance bands of a MERIS Level-2 product. Feel free to put this exercise into action as you like and to design the program in your own manner. If you don't know how to proceed at a certain point you can have a look into Ex4.java, which is a possible solution. An NDVI value can be computed from MERIS Level-2 reflectances by the formula

NDVI = (R(865nm) - R(665nm)) / (R(865nm) + R(665nm)).

Here are the minimum required steps for the program to be developed in this exercise:

  1. Open the input product, e.g. use first code lines from exercise 2, thus reuse Ex1.readProduct from Ex2 main, rename product to inputProduct
  2. Create the output product object, e.g. use first code lines from exercise 3b, rename product to outputProduct.
  3. Write output product "skeleton". Since you don't like code duplication, consider extracting a method from from exercise 3b, e.g. Ex3b.writeProductHeader and then reuse it in your program.
  4. Read input pixel lines as in exercise 2, compute NDVI, write output pixel lines as in exercise 3b
  5. Dispose input product and output product objects.

Tip: Try to make frequent use of IDE capabilities, such as Code Completion (Ctrl+Space) and the Rename (Shift+F6), Introduce Variable (Ctrl+Alt+V) and Extract Method (Ctrl+Alt+M) refactorings. Note that these capabilities are meanwhile standard in any reasonable Java IDE.

Here are some ideas what you could do with your remaining time, if any, within this exercise:

If you've managed this exercise you might be interested in the next chapter Outlook in order to step to the next level of programming using the BEAM API.

© 2005 by Brockmann Consult - Need help? Contact beam minus issues at brockmann minus consult dot de