Hosted by "1PLs Agency"

Home > 5. Gridded Data > 5.2 Grid Points

5.2 Gridding Point Shapes in Saga

  • Exercise Title:  Gridding Point Shapes in Saga

  • Abstract:  Using a very straightforward gridding method, the previously created point shapes (of World Ocean Database (WOD) ocean temperatures) are gridded using Liberia area dummy grids as target geometries.  Some time is spent working on the problem of color palettes for the grids, resulting in some general recommendations.  Finally, a method to extract samples of data grids as ASCII for close inspection is described.

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

  • Required Software:

  • Other Resources: 

  • Author:  Murray Brown; Lilian Krug; final panels based on a recent short discussion on the Saga wiki pages between user Ellen Gonzalez and Volker Wichman about visualizing grid cell values

  • Version:  30-Jan-2019 (using SAGA 7.1.0)

1.  Now, we're going to grid the point shapes we created in the previous exercise.  This is not a course in gridding --  a very complex subject in its own right -- but just an introduction to the concept.  For this reason, we're going to use a relatively simple algorithm, INVERSE DISTANCE WEIGHTED.  You can come back to the algorithm selection steps and try other methods on your own time.
2.  Load these data:
  • Use FILE > SHAPES > LOAD to load all of the above shapes and the World Borders
  • Use FILE > GRID > LOAD to load the dummy grids.  You should have at least the 1-degree version and the 0.1-degree version.
3.  Here is the full complement of data files, for students who have created all the above files, including the dummy grids.

Each grid has a "system" line that identifies it by these items (left to right).  These examples refer to the uppermost grid:

  • Resolution in Degrees:  0.01º
  • Number of Columns:  2000
  • Number of Rows:  1500
  • Center Longitude (lower left cell):  -22.995º
  • Center Latitude (lower left cell):  -5.995º

Below that is listed the name of the actual grid.  All of these are dummy grids, with structure but no meaningful contents.

4.  Take a minute to browse the many "gridding" tools available in Saga at TOOLS > GRID > GRID-GRIDDING.  This should give you some idea of the complexity of the subject.

This is not an intensive course in gridding, so we won't take much time here.  You can explore other methods on your own.  In the panels to follow we'll use a favorite method that seems to work well with marine station data.

5.  Select TOOLS > GRID > GRID-GRIDDING > INVERSE DISTANCE WEIGHTED.  This window opens with a typical set of options for you to select/provide.  An article above gives more background information about this gridding method.

As you work on this window, and all Saga tools, small helpful hints about the different items will appear at the bottom left, as you see here.

 

6.  Make these selections:
  • POINTS - Use drop-down menu and select the jfm_0m point shape
  • ATTRIBUTE - Select TEMPERATURE.
  • TARGET GRID SYSTEM - Select GRID OR GRID SYSTEM
  • GRID SYSTEM -  Select the 1º dummy grid for Liberia. Make sure that TARGET GRID is set to CREATE. 
  • SEARCH RANGE - Select LOCAL
  • MAXIMUM SEARCH DISTANCE - Select 4 degrees (you can experiment with this later)
  • NUMBER OF POINTS - Select ALL POINTS WITHIN SEARCH DISTANCE
  • DISTANCE WEIGHTING - Select INVERSE DISTANCE TO A POWER
  • POWER - Select 2

Of course, you are encouraged to experiment with all of these selections, when you have your own data to work on.  The best approach is to vary each one separately to see the effects on the resulting grid.

Now click OK.

7.  WORDS OF WISDOM.  What are these values for?  Imagine a formula that will take the scattered data points and calculate a regular grid (i.e. the target grid) of values.  Each new value to go in the grid is calculated from the nearby attribute measurements.  The values to be used are limited both by the search distance (i.e. the maximum distance away from the grid point to look for measurements) and by the number of points (which could also be a limiting factor).  But when the points are being considered in the calculations, then distant points are given much less importance in the calculation than nearby points.  The importance is calculated from the inverse of distance, i.e. the further away, the less important.  But the algorithm goes even further and adjusts the inverse of the distance to be exponential (the power).  If the power is 2, for example, then the importance is proportional to 1/distance squared; if 3, for another example, then the importance is proportional to 1/distance cubed.  So the importance of the values drops off very fast with higher powers, less so with smaller ones.  Larger values would not lead to very smooth grids, because the calculations would reflect very small areas quite close to the grid point; smaller values would lead to smoother grids, for the opposite reason.  This very short explanation just refers to this algorithm, INVERSE DISTANCE WEIGHTED.  There are dozens in the literature, and each has its own characteristics and concepts.
9.  You will see a new object appearing under the 1º system.

Notice that it is identified by the name of the variable, plus [INVERSE DISTANCE WEIGHTED] a very generic name.

PRACTICAL TIP:  To avoid problems later on with grid identification, you should change the name of this grid, to something easily recognized, like temp_jfm_0m_5m.  This tool uses the same name for all the products here, so do not leave the automatic name unchanged.

10.  To see the new grid, double-click on the name, and select NEW for the map.
11.  Here's the new grid.  Notice that the grid is complete, and has cells in the northeast corner which are on land.  We'll learn in a later lesson how to deal with this common result of gridding marine data.

NOTE:  Yes, there is an area of obviously poor quality data, the narrow vertical "stripe" in the center.  This happens all the time with archive data.  Just live with it for now, and later we might address it during quality control work.

 

12.  Let's fix up the colors.  First, in the properties panel, select COLORS > TYPE > GRADUATED COLORS.
13.  Then just below it, find the tiny ellipsis (...) to the right side of 10 COLORS.

Click the ellipsis.

14.  This opens the COLORS window.  Click on COUNT and change 10 to 50 or 100.

Then click OK.

15.  Then select PRESETS to find a long list of "pre-packaged" color palettes (some with appropriate names).  Select RAINBOW and click OK.  Click OK again to leave the COLORS window.

At the bottom of the properties panel, you can click SETTINGS > APPLY to see your choices in action.

16.  This is our 0-m temperature grid, with a good color palette.  Including the "stripe".
17.  But what about the value range that goes with the palette?  Right-click on the grid name, and select HISTOGRAM.
18.  This histogram is very similar to the ones we created in 5.1 Converting a Data Table to a Point Shape in Saga, in so we'll use the same value range of 21-30º.
19.  Back in the properties panel for this grid, you can see here where to enter these values.  Then click SETTINGS > APPLY (at the bottom of the panel).
13.  Now repeat the gridding process, as you did above, but this time select the next smaller-resolution "dummy grid."  In this case there is a 0.5º grid available, so it is specified.

Make sure GRID is set to CREATE.

Then click OK.

14.  Repeat this process with the same point shape, but with each of the dummy grids you have.  This shows you what the different RESOLUTIONS provide.

Here the resolutions range from 1º (top left) to 0.01º  (lower right).  [The last one will take much longer than the others, so just be patient.]

The images look "smoother" as you get a higher resolution, but you can see that false features begin to appear, such as the many small "bull's eyes" (as they are called).

 

15.  All of these have been set to the same 100-color rainbow palette and 21-30º value range, so they are visually comparable.  There is nothing "sacred" about this range, but you recall we obtained it by visual inspection during the exercise 5.1 Converting a Data Table to a Point Shape in Saga.
16.  Also, recall that during the process of making the surface analyses in ODV we remarked that the data probably should be interpreted/visualized at resolutions not much smaller than 1-2º.  So, all things considered, our target resolution for these specific data from ODV will be the 1º dummy grid.  You should spend time with your own data to see what resolution, palette and value range gives results that satisfy your research or data management needs.
17.  You can delete the grids with resolution smaller than 1º (just right-click on the "grid system" and select CLOSE on each one).  Leave only the 1º system in place.
18.  Now, you can perform the gridding on the remaining 3 point shapes, using the 1º dummy grid as the target geometry.  Be very careful to set the selection window to TEMPERATURE for the variable to grid, and CREATE for the target (so you don't over-write an existing grid).
19.  Here, all four 1º grids are displayed:
0-5 m, JFM 0-5 m, JAS
3500-4500 m, JFM 3500-4500 m, JAS

The top row looks fine, but the application of the same palette to the deeper analyses completely obscures any details.  We need to abandon previous MDL recommendations to use only one palette, and be realistic about cases like this.

 

20.  Here we used a different palette for the deeper grids, based on a value range of 0-3º, and it really makes the data more understandable.  There may even be a seasonal signal, but that would require much more study to confirm.
21.  So, based on this new insight, here are the MDL Rules for Gridded Data Color Palettes:
  1. Climatological Rasters
    1. When multiple grids/rasters are similar, in average and range, then use the same color palette for all, based on good representative minimum "low" and maximum "high" values. 
      1. The selected values should be clearly stated, (often) whole-number values.
    2. But, when natural value fields are very dissimilar, such as the sea surface versus the deep sea below the permanent thermocline, for good scientific reasons, then select separate palettes, and carefully distinguish between the separate palettes in your reports
    3. In certain cases, moreover, temporal (often "seasonal") patterns  are highly significant but might be obscured by a single "annual" palette.  Be sensitive to such situations, and consider adopting appropriate seasonal palettes if this clarifies such cases.
  2. Operational Rasters.  The emphasis is on pattern or feature recognition in synoptic rasters, and much less so on comparisons.  So don't worry about common palettes, and use the actual data range that the display program automatically applies.
22.  In the setup for the gridding algorithm you used here you could probably get much smoother fields with a larger search radius and other changes.  You can explore these effects on your own.  For open ocean data, collected over many decades, it is not surprising to find this level of "noise" in the data.  Much more smoothing is needed to prepare the figures you'3w12ll see in various Atlases.
23.  Now, right-click on each of the new grids, and save them in the folder PRODUCTS > SAGA > GRIDS with these respective filenames:
  • temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_sagak.sgrd
  • temp_grid_from_osd_jas_0m_5m_liberia_wod_odv_saga.sgrd
  • temp_grid_from_osd_jfm_3500m_4500m_liberia_wod_odv_saga.sgrd
  • temp_grid_from_osd_jas_3500m_4500m_liberia_wod_odv_saga.sgrd

And don't forget that each Saga grid file (*.sgrd) is accompanied by *.mgrd and *.sdat auxiliary files.

24.  Now we'll explore a little-known data inspection tool in Saga, to see that actual contents of a new grid.  Here we've deleted everything except the 0-5m grid for the JAS temperatures.

25.  To choose an area for inspection, click the ACTION TOOL in the row of Saga commands.

26.  Now use your cursor to drag a rectangle around an area of special interest.  It can be up to 100 cells by 100 cells, but not larger.

27.  Now select the ATTRIBUTES tab in the SETTINGS panel.  You'll immediately see a table of the data values in the selected grid area.  The empty cells in the graphic are also empty in the grid.

28.  You can think of lots of ways to use this capability when you're inspecting new grids for problems or questions of accuracy.  Also you can block areas of this matrix and paste them into other applications, if you don't need anything larger than 100 X 100 cells.