Hosted by "1PLs Agency"

Marine Data Literacy

Proudly published in the United States of America for environmental scientists around the world.  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

 

 

Up
5.1 Table to Points
5.2 Grid Points
5.3 Resampling Grids
5.4 Grid Masks
5.5 Grid Products
5.6 Color Palettes
5.7 Classified Grids
5.8 Google Legends
5.9 Faulty FillValues
5.10 IDV Grids
5.11 IDV 180/360
5.13 Grid Stats
5.14 NetCDF/HDF/GRIB
5.16 Saga 180/360
5.17 IDV Histogram
5.18 ToolsUI Convert

Home > 5. Gridded Data > 5.5 Grid Products

5.5 Creating "Standard" Grid Products with Saga

  • Exercise Title:  Creating "Standard" Grid Products with Saga

  • Abstract:  In this exercise you'll learn how to make grid products might be needed for common scientific purposes, including further study at your desk, submission of reports, online products and typical hardcopy publication requirements.  No attempt is made here to optimize the color palettes, so only a simple rainbow palette is used here.  The companion GIS exercise following this one addresses more complex palette issues. 

    • Products for Additional Work in Saga

    • Products for Journals & Dissertations

    • Products for Geographic Information Systems (GIS) - Images or Data

    • Products for Google Earth

    • Products for Web Mapping Systems (WMS)

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

  • Required Software:

  • Other Resources (Saga grids): 

  • Author:  Murray Brown

  • Version:  6-24-2014

Product Options Discussed in this Exercise:

Purpose of Products Recommended Format Auxiliary Files Comments
Work in Saga SPRJ All grids and vectors Expect to return to major datasets forever, and take measures to do this efficiently with project compilations
Journals & Dissertations PNG   Get width from editor/advisor; never more than 600 pixels for emails
Geographic Information Systems - Image Option PNG PGW Image raster; not data
Geographic Information Systems - Data Option ASC (ESRI ASCII grid) or FLT (ESRI binary grid) HDR (for FLT version) Data raster; displays as image
Google Earth PNG KML Zip both to *.ZIP, then change extension to KMZ
Web Mapping Systems  (WMS) - and other Open Geospatial Consortium Web Services (OWS) GeoTIFF raster (*.TIF) containing any desired numeric grid TFW Appears to be "noise" when viewed by humans
2.  This exercise builds directly on the Masking Methods products.  Just reopen the SPRJ project file you made there.  We will clean out any unnecessary files, so you have only what you need for analyses and publications.  Preliminary working files are not needed now, providing they have been saved with good filenames.
3.  WORK IN SAGA.  Here are the "core" files from that exercise.  You can take a few minutes to check over your project, and delete any objects not included here.

You probably have short versions of these names, for example jfm_0_masked.  That's OK.  Take a few minutes to rename the grids as you see here.  Your own files probably won't be in exactly this same order.  All the information you need is in this panel and the next 2, if you have trouble.

4.  Here are the maps from the project, arranged with the 0-5 m data on top, and the JFM data on the left.

If you wonder why they look so different, then you really do need to check the previous exercise Masking Methods for Depth- or Height-Limited Grids in Saga

5.  Just to help you get oriented, here again are the names of the grids, arranged in the same pattern as above.

temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked temp_grid_from_osd_jas_0m_5m_liberia_wod_odv_saga_masked
temp_grid_from_osd_jfm_3500m_4500m_liberia_wod_odv_saga_masked temp_grid_from_osd_jas_3500m_4500m_liberia_wod_odv_saga_masked

Why take all this trouble with these files?  You are a professional marine scientist, and your life work involves building and maintaining quality databases and data products.  A primary tool will always be GIS, so you must embrace organizing, cleaning, identifying and properly saving data in logical ways.  Master these steps and you'll go far.

6.  At the top of the left panel, select MAPS > TREE to see this list of the maps you've made already in this project.  If you have extra maps, carefully delete them so they match up with this short list.
7.  Now that your project has been cut down to the objects you really need, then you can select FILE > PROJECT and save it again as temp_grids_liberia_jfm_jas_0m_5m_350m_450m_wod_odv_masked.sprj.  This cleanup process should become a habit...it will really help you in the future.
8.  Now select MAPS > THUMBNAILS at the top of the left panel.  You'll see small versions of all current maps.  It should be the same group as the TREE list.*-

Right-click on a map, for instance the first one, and select SAVE AS IMAGE.

NOTE:  You must do this from MAP > THUMBNAILS!!

9.  Navigate to PRODUCTS > SAGA > GEOIMAGES and:
  • For FILE NAME, enter temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked
  • For SAVE AS TYPE, select PNG

Then click SAVE.

10.  Now you'll see these options. 
  • Set the WIDTH and HEIGHT of the saved image.  Suit yourself or comply with a journal editor's rules.  Currently we recommend 400 X 300.
  • Set FRAME WIDTH to zero (but make some experiments later to see if you like that setting)
  • Check SAVE GEOREFERENCE (WORLD FILE) - This gives you the auxiliary file for image location in many GIS programs
  • Check SAVE KML FILE- Gives you the auxiliary file for imag location in Google Earth
  • Check LEGEND > SAVE - Saves an image of the colored value legend
  • Set ZOOM (the legend size) to 1 (but make some experiments later to see if you like that setting)

Now click OK to make the files.

11.  If you check the GEOIMAGES folder, you'll find these new files.
  • temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.png - Shown below in next panel

  • temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.pgw

  • temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.kml

  • temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked_legend.png

12.  JOURNALS AND DISSERTATIONS.  Here is the PNG file for the JFM dataset, displayed in the graphics editor IrfanView, to verify that it duplicates the Saga original.

Don't forget that most journal editors or university professors have favorite image sizes/limits.  Apply these above in Panel 10

13.  GEOGRAPHIC INFORMATION SYSTEMS - IMAGE OPTION.  Here is the content of the PGW file.  It is just a simple ASCII world file that sets the X- and Y-cell dimensions (1st and 4th lines, respectively) and bottom-left location (5th and 6th lines) of the image.

The 2nd and 3rd lines have to do with images that are rotated, one way or the other, which we are not doing here.  Usually ignored.

All world files have exactly the same format, so they can be used with any image made from the original PNG, as long as the physical dimensions have not been changed.

NOTE:  The Y-cell dimension is negative, because the first corner in the array is the northwest corner, even though the grid location is specified by the southwest corner.  This is a cute eccentricity of the ESRI ASCII grid format.

0.0585909773
0.0000000000
0.0000000000
-0.0585909773
-24.6259615093
10.0257957619

14.  Now to check the validity of the GIS-ready image (PNG), let's load it into Saga.  The software will automatically look for a PGW file, and use it if found.
15.  In Saga select MODULES > IMPORT IMAGE.
16.  Make these choices:
  • For the IMAGE FILE, find and select the new PNG file you just made.
  • For OPTIONS, select ENFORCE TRUE COLOR.

Then click OK.

17.  You should be able to find and open this new object with ADD TO MAP > NEW.

Notice that a georeferenced image has the correct longitudes and latitudes (along the bottom margin of the window), but the "Z" values are Red, Green and Blue values, not temperatures.  This is the nature of georeferenced images imported into GIS:  No usable parameter values, just pre-set colors.

18.  GEOGRAPHIC INFORMATION SYSTEMS - DATA OPTION.  When you have a GIS, then this is probably the most common method, because it maintains the data values.  The ESRI ASCII format is extremely widely used in many systems, and it is easy to create or edit.

Select TOOLS > IMPORT/EXPORT GRIDS > EXPORT ESRI ARC/INFO GRID.

19.  Make these choices:
  • GRID SYSTEM - The grid system for all your 1-degree products
  • GRID - Select one of the grids to export, for example the JFM 0-m grid.

As soon as you select this grid to export, then you will be asked (in the panel below) where to export and what name to use.

20.  Navigate to the folder PRODUCTS > SAGA > GRIDS and make these choices:
  • For FILE NAME, enter the name of the grid.  Saga will add an extension automatically
  • For SAVE AS TYPE, you should select ESRI ARC/INFO ASCII GRIDS (*.ASC)

NOTE:  The alternative ESRI format is FLT binary grids, which require HDR files that explain their internal structure.  An HDR file is exactly the same as the first 6 lines in an ESRI ASC file.  Only consider FLT files for extremely large rasters.

Click SAVE to continue.

 

21.  Now make these choices:
  • FORMAT - Select ASCII
  • GEO-REFERENCE - Select CENTER.  This means that the grid cells in our products will be specified by their center coordinates.  If our grids have whole-number outer boundaries, this means the cells are centered 1/2 cell inwards from the edges.  This is most common with satellite data, but not with terrestrial data such as the datasets commonly used by Saga experts, who seem to prefer CORNER.
  • ASCII PRECISION - 4 seems to be ok here for the number of decimal values; analyze your own data for the best choice
  • ASCII DECIMAL SEPARATOR - POINT, although COMMA probably also works.

Then click OK.

22.  The ASCII file is created, and it can be viewed in any good editor. 
  • Notice the standard ESRI 6-line header.  It must be structured this way with no differences in spelling or the order of the lines.  There cannot be trailing spaces after any line.
  • The NODATA_VALUE is Saga's default value.
  • This exact same file could have these lines in the header:
    • XLLCORNER -23.0000

    • YLLCORNER -6.0000

  • And it would work just the same, because they are equivalent. 
     

Whenever you make or request ASC files, always examine them to make sure you are getting what you expected.

23.  Now, let's check the validity of the exported grid by importing it.  Select TOOLS > IMPORT/EXPORT GRIDS > IMPORT ESRI ARC/INFO GRID, as you see here.  Make these choices, and click OK.
24.  And here is the grid.  We don't have time to work with the colors, but you can see the bad data stripe down the middle.
25.  So that covers the majority of the common data product uses.  Now we'll look at more exotic uses, Google Earth maps and dynamic Web Map Servers (and their relatives).
26.  GOOGLE EARTH.  Here is the ASCI text in the KML file you made above in Panel 10.  It's very similar in function to a world file, but it contains the name of the image it "points to" in the HREF line marked in yellow.

Note the similarities to and differences from the world file.  There are no cell dimensions, which the software calculates from the outer dimensions, marked in green.

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Folder>
<name>Maps exported from SAGA</name>
<description>System for Automated Geoscientific Analyses - www.saga-gis.org</description>
<GroundOverlay>
<name>15. jfm_0_masked</name>
<description><b>Map</b><table border="0"><tr><td>Name</td><td>15. jfm_0_masked</td></tr><tr><td>Layers</td><td>2</td></tr><tr><td>Coordinate System</td><td>Geographic Coordinate System:
GCS_WGS_1984
[+proj=longlat +a=6378137.000000 +b=6356752.314245 +no_defs]</td></tr></table></description>
<Icon>
<href>temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.png</href>
</Icon>
<LatLonBox>
<north>10.025796</north>
<south>-7.551497</south>
<east>-1.189571</east>
<west>-24.625962</west>

<rotation>0.0</rotation>
</LatLonBox>
</GroundOverlay>
</Folder>
</kml>

27.  Here is the KML file, opened in Google Earth.  Many people fall in love with KML displays, especially the sexy spinning globe.  But, you should not use Google Earth unless:
  • Your image covers much of a whole ocean, or
  • It displays something that clearly makes more sense when viewed in 3-D. 

Obviously this image does not meet those criteria, and your teacher doesn't recommend this particular display.

28.  The KML file and the PNG file can be zipped together with WinZip to create a *.ZIP file.  [You can use WinRAR, but the format must be ".ZIP".]  Then manually change the filename extension from ZIP to KMZ and you can open the combined files in Google Earth also.  Many workers prefer this practice, because it insures that the two (or more!) files don't become separated. 
29.  And finally, here is the grid legend, in PNG format .  It can be used with the PNG image (which lacks actual parameter values) or with the KML image (see Creating Legends for Grids in Google Earth)
30.  Now we're going to create a GeoTIFF product that is strictly numerical, and not for visualizing.  Numerical grids are often also called rasters.  These grids are needed by web mapping systems (WMS) that can subset the data grids, and a host of related systems that are promoted by the Open Geospatial Consortium.
  • Google Earth itself uses only the PNG + KML method. 
  • ESRI software and the Mapserver 4 Windows can use either PNG + PGW (see above) or GeoTIFF (raster) + TFW (see next).
31.  Select MODULES > Import/Export - GDAL/OGR > GDAL: Export Raster to GeoTIFF
32.  For GRID SYSTEM, select the system for the SST grids.
33.  Click the ellipsis (...) to the right of >>GRIDS
34.  This grid selection window opens.
35.  Select the JFM grid and move it to the "selected" side with the > control.

Then click OK.

36.  Back on this window, click the ellipsis to the right of FILE.
37.  Navigate to PRODUCTS > SAGA > GEOIMAGES and enter the name temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked, then click SAVE
38.  We don't need to get into CREATE OPTIONS at this time, so leave it blank, and click OK.
39.  Check to see that the new TIF file, temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.tif,  has been created.
40.  You can try to open the TIF file with any graphic editor, and you'll see something like this.  It proves the file is not intended for visualizing in the normal way.

NOTE:  This image of the file comes from IrfanView.  Other graphics editors can show markedly different scenes, including black-and-white versions.

41.  We need a world file for the new TIF file, so open the ASCII world file for the PNG image, with the extension PGW.

NOTE:  We are simply "borrowing" the PGW file, because this is the easiest way to make the TFW file.

0.0557620818
0.0000000000
0.0000000000
-0.0557620818
-23.8178438662
9.0000000000

42.  Save the world file in the GEOIMAGES folder with this new filename: temp_grid_from_osd_jfm_0m_5m_liberia_wod_odv_saga_masked.tfw.  That's all you need to do.  The TIF and TFW files can only be used in special software, and not ordinary GIS.
43.  Now go back to the beginning and make all these products for at least ONE of the other grid products.

 

The exercises, notes and graphics in this website are copyrighted, and may not be copied or abstracted in any way, without my explicit permission (in writing).  Making one copy for your personal use is allowed.   Please report any copyright infringement to me. Murray Brown m.brown.nsb <at> gmail.com.

web counter