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 > Gridded Data > 5.16 Saga 180/360

5.16 Converting Between 0-to-360º and -180-to-180º Grid Views 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:  Converting Between 0-to-360º and -180-to-180º Grid Views in Saga

  • Abstract:  In this exercise you'll learn how to deal with found grid datasets, in Saga, created in 0-to-360 degree systems.  [0-to-360 degree products are often used for Pacific-centered products, but they are universally desirable.]  Using the method here you can convert the grid to the more familiar -180-to+180 degree format.  This exercise formerly took over 40 steps; a relatively new module in Saga permits a much faster conversion. 

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

  • Required Software:

    • Saga

  • Other Resources: 

  • Author:  Murray Brown

  • Version:  December 2012

1.  This exercise formerly took over 40 steps; a relatively new module is Saga permits a much faster conversion. 
2.  This is a figure in the above Tide Model article.  The accompanying text states:

"The M2 tidal constituent. Amplitude is indicated by color, and the white lines are cotidal differing by 1 hr. The curved arcs around the amphidromic points show the direction of the tides, each indicating a synchronized 6 hour period.

Richard. Ray, TOPEX/Poseidon: Revealing Hidden Tidal Energy, GSFC, NASA.

With credit also to:

  • NASA - Goddard Space Flight Center
  • NASA - Jet Propulsion Laboratory
  • Scientific Visualization Studio
  • Television Production NASA-TV/GSFC"
http://upload.wikimedia.org/wikipedia/commons/5/5e/M2_tidal_constituent.jpg
3.  Download the M2 data file, above, to the folder DATA > OCEAN > GSFC and unzip it.  You find a file named m2.d
4.  If you don't know what the "d" format is, then simply open it in an ASCII editor to see if you can figure it out.
  • Line 1 is just title information
  • Line 2 is probably information about the computer production run that produced the file
  • Line 3 looks like ROW and COLUMN specifications for the grid.  A cell size of 0.5 degrees is indicated.  The odd value 361 mean there is a "cap" of 720 identical cells at either the south pole (row 0) or north pole (row 361), a NASA oddity sometimes encountered
  • Line 4 contains the minimum and maximum latitudes
  • Line 5 contains the minimum and maximum longitudes.  The value 359.5 is exactly one cell width less than 360, indicating these cells are "Vertex Centered" (see resource article above)
  • Line 6 contains the "no data values" as can plainly be seen in the data fragment that follows.
  • Line 7 states that each data row contains 11 floating point numbers consisting of 7 characters (including the leading space and decimal point) and each includes a 2-decimal fraction.

So the "d" format is just a very easy-to-read ASCII data format.

5.  Now, we've done this in other exercises, so you probably won't be surprised by it.  We'll delete the existing header and substitute the standard ESRI grid header.
6.  Use any good ASCII editor to change the header as you see here.  All of these values come from the above discussion of the "d" format.

NOTE:  The syntax XLLCORNER and YLLCORNER both refer to vertex-centered cells.  The alternative syntax for ESRI grids is XLLCENTER and YLLCENTER.

7.  Navigate to the folder DATA > OCEAN > GSFC and save the file with the name  tide_m2_richard.ray_gsfc_d.asc
8.  Run Saga.
9.  Select MODULES > IMPORT/EXPORT - GRIDS > IMPORT ESRI ARC GRID
10.  Make these selections:
  • FILE - Navigate to and select the new ASC file
  • TARGET GRID TYPE - Use FLOATING POINT (4 BYTE) or (8 BYTE)
  • NODATA VALUE - Use USER DEFINED
  • USER DEFINED NODATA VALUE - Enter -99999 the normal Saga no data value.

Then click OK to import the grid.

11.  Here's the current contents of the data objects panel.
12.  Here is the grid, obviously upside-down.  This is a very common occurrence when working with grids, coming from the author's decision to begin the values in the upper left corner or the lower left corner.

Strangely, although the ESRI specification refers to the bottom left corner a the "anchor site," the actual values are read from the top left!  In the case of the "d" format, the author probably began in the lower left.

13.  There is a very quick, easy fix for this.  Select MODULES > GRID TOOLS > GRID ORIENTATION.
  • For GRID SYSTEM, select the 0-360 degree system
  • For GRID select the M2 tide component grid we just imported
  • For CHANGED GRID select the same grid name.  This will completely "over-write" the old grid with the changed one
  • For METHOD select FLIP.

Then click OK.

14.  The change is made, and the map instantly flips over.  Success!

NOTE:  The name of the grid has been changed to CHANGED GRID

15.  The author prefers more color contrast, which you can get with these preference settings (in the right-hand panel). 
  • Also, the 100 COLORS have been set to PRESET > RAINBOW.
  • And the mode has been set to LOGARITHMIC UP with a STRETCH FACTOR of 100 or more
16.  So here's the NASA grid in Saga.  It should be qualitatively similar to Panel 2. above.
17.  Here is the data panel in Saga.  Notice that the name of the grid has been changed for clarity. 

You can change object names in the Preference/Settings panel on the top-right of Saga.  Then click SETTINGS > APPLY (at bottom-right) to make the changes appear.

18.  Select PROJECTION-PROJ 4 > CHANGE LONGITUDINAL RANGE
19.  For GRID SYSTEM select the existing 0-360 degree system.  Then to select the grid to change, click the ellipsis (...).
20.  Select the only available grid.
21.  Move it to the right side (selected files) and click OK.
22.  Make sure the DIRECTION is set to convert 0-360 grids to -180-180.  Then click OK.
23.  This new grid system (top) appears, with a grid using the same name.
24.  Immediately change the name, so you will not confuse the grids.
25.  And here's the final grid in Saga, looking quite similar to Panel 2.
26.  Now you can do any visualization tricks with this grid that you did with the original grid.  But this new grid is more appropriate for most GIS applications, which typically use the same grid system as the default.  You can save this new grid in the folder PRODUCTS > SAGA > GRIDS with the filename tide_m2_richard.ray_gsfc_d_min180_plus180.sgrd

 

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