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 > 2. Marine GIS > 2.24 Coastal Survey

2.24 Visualizing High-Density/Small-Area Coastal Survey Data in Saga

New Version of Saga:  Usually a new version of Saga is quickly assimilated into these exercises.  The latest release, Version 2.1.2, is so radically different that it will take some time to catch up with revised exercises.  Please email me immediately whenever you find an old exercise that simply cannot be accomplished in the new Saga, due to big changes in the properties, etc.  I will try to provide fixes within about 2 days.

  • Exercise Title:  Visualizing High-Density/Small-Area Coastal Survey Data in Saga

  • Abstract:  In this exercise you'll face and solve two very typical data management problems in marine science:  very dense data sampling in a small area, and the insertion of a coastline into an otherwise marine data grid. 

    • The first issue raises the problems of defining the grid template to use for the gridding, involving cell sizes that are usually much smaller than than the easy-to-visualize 1- or 2-degree grids we often work with in "blue water data". 

    • The second issue deals with the way to mask the spurious data cells that almost invariably appear on land.  Usual methods to mask land cells in oceanic datasets require relief (bathymetry/topography) grids that are too coarse to work well with small-scale coastal surveys.  If a very high-resolution coastline is available, as is the case here, then you can use this method for the masking; if not, then make one or use the depth-masking, as in Masking Methods for Depth- or Height-Limited Grids in Saga.

    These two issues, high density and coastline proximity are very common problems with biological datasets, and are very often faced by students and researchers working with survey data for specific local areas.

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

    • N/A

  • Required Software:

  • Other Resources: 

  • Author:  Murray Brown with huge help from Volker Wichmann

  • Version:  8-19-13

1.  Save the above 2 data files (TXT and KML) to DATA > OCEAN
2.  This is a look at the beginning of the TXT data file.  It's very simple, but as usual, you should go over it to see if there are any surprises.
  • Eliminate any extra "header" rows; you can only have one
  • Watch out for special values, such as NaN and other problem entries that you might want to remove
  • Usually, tab-separated variables (TSV) tables work best, so you might convert to TSV
  • Sort the table to look for strange entries, which usually go to the beginning or end
3.  The EMBC scientists also provided a short section of the local coastline, in KML (the Google Earth format).  [When GE is installed, just open the KML file and it will appear on a global map, with added photoimagery, as you see here.]

The total area of this image is about one square kilometer, judging from the size of the buildings here.  The marina or harbor structure is easily visible in mid-field.

The coastline file is very important for this exercise, and is generally required for any near-shore work.  You may have to make your own coastline, using Digitizing a New Shape in Saga or (less commonly) by finding one already published.

4.  Run Saga
5.  Because the data file is a tab-separated ASCII table, you can use FILE > TABLE > LOAD TABLE to add it.
6.  If you haven't already seen it, scroll through the file to find an obviously incorrect latitude value.  Just right-click on that row and select DELETE SELECTED RECORD to remove it.

NOTE:  I left this bad record in here just to keep you on your toes.

7.  In the properties panel, you can find the PROPERTIES tab, where these important statistics are listed.  You will need them below.
8.  Select MODULES > SHAPES-POINTS > CONVERT TABLE TO POINTS.  This is needed because you cannot work directly with tables, they must be converted first.
9.  Make these choices:
  • TABLE - Find and select the table
  • X - Find and select longitude
  • Y - Find and select latitude
  • Z - Make no choice

Then click OK.

10.  Now you have a new object, the point shape.  Right click on it, and select ADD TO MAP.
11.  Here are the sample locations on a basic map.  You can see from the spatial scale (in degrees) how small the area is.  For reference, a length of about 0.01 degree is approximately one kilometer (far from the poles!), so the survey itself is about 1/3 kilometer squared.
12.  Select MODULES > IMPORT/EXPORT -  GDAL/OGR > IMPORT VECTOR DATA and select the KML coastline file.

Then click OK.

13.  You can use ADD TO MAP to see how the sample locations fit in with the coastline.  Many of them are inside the harbor, so we know that we must find a way to mask any analysis grid where it extends over land.
14.  In the method below, we're going to simply grid the data and mask the land areas enclosed by the coastline.  This is the best that Saga can do.  There are gridding programs (Diva, Surfer) that can explicitly avoid grid calculations that extend over land bridges, peninsulas, and physical barriers.  We want to inform you of this, so you can make informed choices about your choice of software.  In most cases, it is likely that Saga can make the analyses you need, accurately.
15.  To begin the gridding, we first need to analyze the dataset with a view toward its physical dimensions.  The following steps will inform us of how to create the dummy grids needed for gridding:
  • Area width = latitude maximum - latitude minimum = 35.336962 - 35.334016 = 0.002946, so the obvious possible cellsizes (in degrees) are:
    • 0.001
    • 0.0001
    • 0.00001
    • 0.000001
  • We could get about the same cellsize choices from the longitudes, which you can try on your own

When the study area is larger than a few degrees square, then you probably want to specify the dummy grid and the polygon frame around it with specificity.  But if you have a smaller area, then you can use the methods shown below; they don't allow strict user control of the dimensions, but they are very fast and direct.

16.  In the steps that follow, for simplicity, we'll use the first cellsize option, 0.0001 degrees.  On your own, you can explore the use of the others.  In general, you must always make many experiments to find out which settings give the best analysis results...don't simply take the defaults.
17.  Select MODULES > GRID TOOLS > CREATE GRID SYSTEM to make the dummy grids.
18.  From the data in Panel 16, enter these values:
  • SET EXTENT BY:  SHAPE
  • CELLSIZE - For example 0.0001
  • USE OFFSET - Check
  • X OFFSET - Half of cellsize
  • Y OFFSET - Half of cellsize

Then click OK.  This makes the dummy grid for the 0.0001 resolution grid.

19.  Also make the dummy grids for the 0.00001- and 0.000001-degree grids.
20.  Examine the data objects to make sure you have the 3 new dummy grids.
21.  You can view any of the grids (they all look the same on a map) and plot the point shape on it to see if the match-up is correct.

NOTE: Sometimes a point can lie just outside the edge, due to calculation precision.

22.  To visualize the data values, in the properties panel, make these COLORS choices.  Then click SETTINGS > APPLY.
23.  This gives you a view of the general pattern of values.
24.  Now we must grid the data.  This is not a basic gridding exercise, so you must make experiments on your own to see which algorithm and settings works best with your data.  In the next panels, the author simply selected a method and settings that worked quickly with the selected conditions.  Please don't simply copy these settings and expect a good result with real-world data.  Do some experiments on your own and let me know if you find something better.
25.  The author selected MODULES > GRID-GRIDDING > INVERSE DISTANCE WEIGHTED and made these choices.  Notice that TARGET GRID is set to GRID, which means you will be asked to specify the dummy grid for the gridding.

Click OK to continue.

26.  When asked for the GRID, select the dummy grid of your choosing.  In my case I chose the 0.0001-degree dummy grid (the bottom one in the above set of 3 dummy grids).

Click OK and a new grid object will appear

27.  Here we've plotted the high-resolution coastline file on the grid, to show what we have now, and how the grid matches up with the shore.

NOTE:  KML files sometimes appear with titles buried in their internal metadata; change the name of this file after it is plotted to coast_north_crete_high_resolution

28.  Now we need to find a way to mask or remove the grid cells over the land.  To do this, we need a polygon shape that is exactly the same as the outer edges of the grid. 
29.  Select MODULES > SHAPES-GRID > GRID SYSTEM EXTENT. 
  • For GRID SYSTEM, select the system of the 0.0001-degree grid you just made
  • For BORDER, select GRID NODES to line up the polygon with the edges of the cells (vertexes) or GRID CELLS for the centers of the cells.  In this case choose the nodes.
30.  Here is the polygon shape, named the Grid System Extent by Saga.  Polygons are usually identified by the fact they are colored internally; line shapes can't be colored this way.
31.  Here we've plotted the new polygon and the coastline, to make certain the coastline extends beyond the polygon.  If it doesn't, then you need more coastline.
32.  Now, select MODULES > SHAPES-POLYGONS > POLYGON-LINE INTERSECTION. 
  • POLYGON - Select the new polygon
  • LINE - Select the coastline shape
  • INTERSECTION - Leave as CREATE.

Then click OK.

33.  Now use ADD TO MAP to display the new polygon.  It looks like the map in Panel 30, but it is very different.
  • This is not the coastline file...this is the boundary between two new polygons!
  • Also, notice that the pieces of the coastline outside the polygon have been cut off.
34.  Along the top of the Saga screen, select the ACTION tool.
35.  Then click on map to see that it now has separate polygons.  To perform the next step, select the land polygon.
36.  Right-click on the land polygon, and select DELETE SELECTED SHAPE.
37.  That's all it takes to remove the land polygon.  What is left is the "ocean polygon."
38.  To use this new ocean polygon, select MODULES > SHAPES-GRID > CLIP GRID WITH POLYGON.
  • For GRID SYSTEM and INPUT, select the system and the name of the data variable grid you made above
  • For POLYGON, select the ocean polygon you just made in the Panel above.

Then click OK.

39.  A completely new grid appears (highlighted in this image), with a different number of rows and columns from the source grid, but the same resolution.
40.  Here you can see the clipped grid, on its own map.

You should add the coastline, and other features if you want, so the presentation isn't so stark.

41.  This has been a long exercise, covering two closely related problems, dense sampling in a small area and the presence of a coastline adjacent to the study area.  Typically one or both of these complications arise in marine biology, environmental impact, and coastal engineering work (for example) so it's important to keep the above methods in mind.  Also do explore the use of other software which can make the job even easier.