Marine Data Literacy 2.0

Providing instruction for managing, converting, analyzing and displaying oceanographic station data, marine meteorological data, GIS-compatible marine and coastal data or model simulations, and mapped remote sensing imagery





Home > 5. Gridded Data > 5.7 Classified Grids

5.7 Handling Classified Grids with Saga: GLCF AVHRR Classifications

  • Exercise Title:  Handling Classified Grids with Saga: Global Land Cover Facility's (GLCF) Advanced Very High Resolution Radiometer (AVHRR) Classifications

  • Abstract:  In this exercise you'll learn how to handle a grid of "classified" data, whereby the cell values don't refer to a continuous field of measured parameters, but to a finite set of distinct codes (usually integers).  The selection of display colors for this sort of grid, the creation of a usable legend, and special methods to pick the colors are demonstrated.

  • Preliminary Reading (in OceanTeacher, unless otherwise indicated):

  • Required Software:

  • Other Resources: 

    • Global Land Cover Facility - Center for land cover science with a focus on research using remotely sensed satellite data and products to assess land cover change for local to global systems.

    • AVHRR - Wikipedia article

    • Dataset CitationHansen, M., R. DeFries, J.R.G. Townshend, and R. Sohlberg (1998), UMD Global Land Cover Classification, 1 Kilometer, 1.0, Department of Geography, University of Maryland, College Park, Maryland, 1981-1994.

  • Author:  Murray Brown

  • Version:  12-13-2013

1.  Open the Land Cover website, and read over the introductory material.  Then click on DOWNLOAD DATA (on the right, above ESDI).
2.  Look over this menu of main items, then select LAND COVER CLASSIFICATION.
3.  Review this material to see a description of the classified grid.  Notice there are 14 different landcover types in this system (0-13).


4.  Select the  PRODUCT SEARCH control.
6.  Make these selections:


7.  Click on the DOWNLOAD link near the middle of the page.
8.  Now you can see the available files.  We want the ESRI ASCII grid format, indicated by ASC in the filename.

Right-click on the file af0500ag.asc.gz and select SAVE AS or SAVE TARGET AS

9.  Download the file to your folder DATA > BASEMAP > GEOLOGY with the filename  landcover_classes_africa_avhhr_glcf_1km_asc.gz.  [We use GEOLOGY because traditionally landcover-type data have been placed there.]
10.  Unzip the file, and rename the content file landcover_classes_africa_avhhr_glcf_1km.asc
11.  Run Saga.  Select MODULES > IMPORT/EXPORT GRIDS > IMPORT ESRI ASCII GRID to load the file landcover_classes_africa_avhhr_glcf_1km.asc

You must load the data as 4-byte integers; the 2-byte integer option won't work for these data.

12.  SHOW the grid in a new map, as you see here.
13.  We need to reduce this huge grid down to a manageable size (for Liberia).  Select MODULES > GRID TOOLS > CUTTING INTERACTIVE
14.  Select the system and the grid for the landcover file.


15.  Click OK to start the module.  The CUTTING window will close, but you are actually in a "module run mode" now.
16.  Select the ACTION TOOL in the top line of the Saga window (an arrow icon, beside ZOOM).
17.  Use the cursor to drag a rectangle approximately around the Liberia project area.
18.  When you release the cursor, this window will open.  It contains the coordinates of the rectangle you just drew.

Notice that Saga has calculated the exact coordinates of the grid cells here.

19.  Change the coordinates to the Liberia project area.  Each time you enter a coordinate, Saga will slightly change it to line up exactly with the original landcover grid cells.

This means that the resulting grid will be an exact copy of a portion of the entire African grid, with each cell in the exact same original location.  It is not the same coordinates as your AOI, but it is very close to it.

When you are finished click OK.

20.  You have to select MODULES and close the CUTTING INTERACTIVE module manually, or it will continue to wait for more commands.  Just click on CUTTING INTERACTIVE to stop it.
21.  Now you have a new grid system and a new grid object.
22.  Change the name to reflect the real coverage and the use of Saga to make it.

HINT:  Name changes are made in the properties window on the right; then select SETTINGS > APPLY.

23.  Now, here is the new grid on a new map.  Notice that the legend is built from a rainbow, giving the impression the code values are continuous, which is not true.  They are separate integer values, and we should not display them with a palette that indicates any sort of gradation between classified areas.
24.  In the settings on the right side of Saga, find the COLORS control (the ellipsis) and click it.
25.  You can avoid the appearance of value gradations by selecting the RANDOM setting and clicking OK.
26.  If you show the histogram for the new grid, you can see that water (value 0) makes up most of the grid, so you can't see much detail for the other landcover types.
27.  Right-click on the new grid object, and select CLASSIFICATION > CREATE LOOKUP TABLE
28.  If you select CLASSIFICATION TYPE = UNIQUE VALUES, then Saga does all the work and counts the classifications types you have in this map.


29.  Here you can see that categories 3 and 5 are missing, because they are not identified  in Africa by these researchers.
30.  Now, let's improve the analysis, but giving correct labels to the classification codes.

On the right side of Saga, find COLORS > LOOKUP TABLE > TABLE and click on the ellipsis to its right.

31.  This table opens, showing you the colors scheme and numeric values behind the above images.

32.  Insert the land classification labels from Panel 3, above, in the NAME column.  The DESCRIPTION column is for your own notes and is never displayed.  Then click OK.

33.  Now your map is properly labeled beside the color legend.
34.  There is an entirely different approach to selecting display colors, from the RANDOM control we used above.  You can specify each color separately or you can select existing palettes in the Saga color control.  Data publishers sometimes provide recommended colors (i.e. palette formulas) for various data layers.  There are also palette collection on the Web, where you can find formulas for the colors of familiar surfaces or habitats.
35.  In the properties window, click again on the ellipsis by LOOKUP TABLE > TABLE
36.  Here is the class properties table again.  Click on the light green cell beside URBAN & BUILT.
37.  This control allows you to select any color for that cell and that class.  You select from a set of BASIC COLORS, a set of your favorite CUSTOM COLORS (not yet made), or by clicking on a color chart, or by entering values in the panels at the lower left.

Recall that the original Landcover Facility actually recommends some Red-Green-Blue values for the classes (see Panel 3 again).

38.  For example, you could enter these values for URBAN & BUILT:
  • RED = 0
  • GREEN = 255
  • BLUE = 255

And you could do this for each class, to match exactly the Landcover Facility color scheme.


39.  The only change we think you should make would be for WATER.  Click on that color cell and select WHITE, as you see here.

Then click OK.

40.  This map is easier to see, because the blue water doesn't interfere visually with any blue classes on the land.
41.  Here the histogram again, to see if it is easier to read.  Unfortunately, the water is still there (although it is white and not seen), so it overwhelms the other values in the histogram and you don't see much detail.
42.  In the properties window on the right, set the NO DATA VALUES to 0 and 0 (the value for water).  This "eliminates" the water values from consideration in the statistics, so the histogram is now quite useful.
43.  Now it's time to save your work in the usual way.
44.  Navigate to PRODUCTS > SAGA > GRIDS and save the file as landcover_classes_liberia_avhhr_glcf_1km_saga.sgrd
45.  In the same way, save the entire African grid in the same folder with the filename landcover_classes_africa_avhhr_glcf_1km.sgrd
46.  A critical step to save all your work is to select FILE > PROJECT > SAVE PROJECT AS
47.  Then navigate to PRODUCTS > SAGA > AUXILIARY and save the project as landcover_liberia.sprj.  If you don't do this, then the grids will lose the lookup table with its class names and the associated palette.