Link to the UNESCO-IOC website
Link to the Bilko website
Earth from space
Annual sea surface temperature

9.6.1 Preparing the individual scenes I

Meris Level 2 flags     Using a class flag to select valid data    

TUTORIAL

9. Gridded data

back to bottom of page next
 

Useful information:
(Resizable pop-ups)

MERIS level 2 water products

The MERIS product grid

Image data: A grid of pixels

Geocorrection of remote sensing data

Geographical coordinate systems

Equidistant cylindrical (Lat/Lon) grids

The Universal Transverse Mercator (UTM) grid

 

Image descriptions:
(Resizable pop-ups)

S1998033~.HDF

MER_RR_2C~ 200402~.N1

usgs_10s8e 40s30e.dat

Before creating a gridded composite made up of several images, each contributing scene must be prepared properly. This consists of

  • applying the necessary masks to ensure the data used is valid,
  • and geocorrecting the images to a suitable grid.

In this section you will go through this process step by step, repeating it for each of the three scenes you will use later to create a 3-day composite from the southern Benguela region.

Meris Level 2 flags

  1. Open the file MER_RR__2COLRA20040201_082314_~.N1.
  2. In the left frame, select Bands and open the text-file algal_1 data set by double-clicking on it in the right frame.
  3. When the Redisplay dialogue appears, accept the default settings; do not set the null values.

As you can see, the image contains not just water pixels showing chlorophyll concentrations; there are also cloud pixels showing cloud top pressure, and land pixels with the top of atmosphere vegetation index (TOAVI). Along both edges are strips where no radiance samples were available to fill the MERIS product grid.

To produce a gridded image with valid chlorophyll concentrations the contributing scenes must contain only valid data. All other pixels must be masked. The flags provided with the image data contain the information you need for this task.

  1. In the left frame, select Flag Codings and open the text-file l2_flags that appears in the right frame.
    Note: You have to open the text file before the flags data set, because they have the same name, and if the flags 'image' is already open, Bilko will not open the text file.

  2. Open the l2_flags data set (the last data set in the 'Bands' folder). Accept the Redisplay default settings, they are not important at this stage.

The l2_flags text file is a list of named flags, each followed by a number. The numbers will allow you to use the l2_flags data set to mask all pixels containing unwanted data. 'MERIS level 2 flags' gives you a more detailed description of these flags and what they mean, along with the binary code of each flag.

The flags data set contains all the flags related to the different geophysical data sets in the 'Bands' folder. Several pixels have been given more than one flag. This is the case for instance with pixels given the flag value 3655697. The key to the flags are in the binary version of this number.

Question 1.
The binary version of of 3655697 is given in the table below. Which are the flags given to this pixel? (To help you the bits have been numbered from 0 to 23.)

Bit

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

3655697

0

0

1

1

0

1

1

1

1

1

0

0

1

0

0

0

0

0

0

1

0

0

0

1

Using a class flag to select valid data

The flag codes may be used to make a bitmask to remove invalid data from the algal_1 image. For instance, only pixels classified as water are of interest in a gridded image of chlorophyll concentrations, and the WATER flag allows you to select these pixels.

Bilko applies masks using formula documents. Once you know how these work, you can write a formula to suit any flag and data set you want. The following steps take you through the process of applying a bitmask formula to mask invalid pixels in the algal_1 data from the Benguela.

  1. Connect the algal_1 and l2_flags images into a stack, adding one blank image (figure (5K)).
  2. Right click on the stack and select zoom, and in the zoom dialogue click preserve shape , which allows you to see the whole image at once.
  3. Minimise the single images that were used to make up the stack (algal_1 and l2_flags), but don't close them.
  4. Open the formula mer2water.frm .

The formula follows the standard Bilko pattern (see figure (5K)). for details).

Question 2.
The formula uses bitwise and ( & ) to compare the flag code and the values given to the pixels in the l2_flags data set. Below is a data-values taken from the l2_flags image. Compare this with the flag code for WATER, and if the condition is satisfied:

if ((l2_flags&WATER)==WATER)        

Bit

23

22

21

20

19

18

17

16

15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

2097152

0

0

1

1

0

1

1

1

1

1

0

0

1

0

0

0

0

0

0

1

0

0

0

1

4196353

0

1

0

0

0

0

0

0

0

0

0

0

1

0

0

0

0

0

0

0

0

0

0

1

Note: In the table above WATER = 2097152, a number where only one position (bit 21) has the value 1. The pixel's FLAG VALUE = 4196353, which has 1 in three different bit positions, each corresponding to a particular flag. If you are still unsure how to tackle this, 'Bitwise operators and Meris flags' explains.

Having seen how the formula works, you wil now apply it to create a new image containing only water pixels.

  1. Use the selector, or tab through the stack until the blank image is on top.
  2. Activate the formula by clicking on it.
  3. Select Options! from the menu bar, and make sure the output image is set to the same numerical format as algal_1, and that the special null handling box is unchecked (figure (9K)).
  4. Copy the formula ( press [CTRL+C] or click ) and paste it onto the onto the set of images (activate the stack and press [CTRL+V] or click ).

Notice how the blank image is filled with data where the WATER flag holds true, while remaining pixels are white (255).

Answers:
(Resizable
pop-ups)

Answer 1

Answer 2

Answer 3

Back up to:
Q1   Q2   Q3  

Question 3.
Can you see any problems with this image which may cause difficulties when creating the gridded composite?

There is clearly a need to improve the selection of pixels before using the image in a gridded composite. The next subsection will tackle this problem. Before you continue, save a copy of the image you just created:

  1. Activate the image that was opened by Bilko when you created the stack (you will see it is no longer blank).
  2. Select the whole image ( [CTRL+A] ).
  3. Open the 'New' dialogue ( [CTRL+N] ).
  4. Select 'IMAGE document' and make sure the Apply stretches box at the bottom of the dialogue is unchecked.
  5. Click OK to create a copy of the image
  6. Save the copy as mer20040201_w.dat.
back to top of page next

Next: Preparing the individual scenes II