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.25 NetCDF with NaN

2.25 Visualizing a NetCDF Grid with Not-a-Number (NaN) Values 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 a NetCDF Grid with Not-a-Number (NaN) Values in Saga

  • Abstract:  This exercise addresses a fairly uncommon situation, the presence of Not-a-Number (NaN) values in NetCDF grids to be used in Saga.  Fortunately NaNs are not usual.  The Saga authoring group has announced that the next version of the program will recognize NAN values, so this exercise will soon become unnecessary.

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

    • NaN - Wikipedia article

  • Required Software:

  • Other Resources: 

  • Author:  Murray Brown

  • Version:  8-21-13

1.  Download the BZ2 datafile to an appropriate location in the main DATA > OCEAN folder.  Then unzip it in place, with 7Zip.
2.  Run Saga
3.  Select MODULES > IMPORT/EXPORT-GDAL/OGR > IMPORT RASTER

NOTE:  Not the adjacent "Import NetCDF" module.

4.  Makes these choices to load the NetCDF file.  Then click OK.
5.  This is the "Multiple Bands" selection.  Check the SST object, and click OK.
6.  Here is the grid, mapped in Saga.  We know there is a problem, because it is all black.
7.  Look in the properties panel on the right to see these items.  The "No Data" values seem to be correctly identified, but Saga doesn't actually use them to ignore any values, because they show up in the Value Ranges at the bottom.
8.  As some Saga users have already noted, you can adjust the settings to see the SST in color, but you simply cannot eliminate the black color over the NaN areas (i.e. land and clouds).

To change the black to whte (a simplistic description of getting Saga to honor the NaN cells as No Data) we need to take two more steps, below.

9.  Select MODULES > IMPORT/EXPORT GRIDS > EXPORT ESRI ARC/INFO GRID.
10.  Select the system and grid you have just made for the input (top 2 lines).  Then select the same filename, but with the extension ASC for the output.

Then click OK.

11.  You can immediately select MODULES > IMPORT/EXPORT GRIDS > IMPORT ESRI ARC/INFO GRID.
12.  Make these choices:
  • For FILE, select the ASC file you just exported above
  • For NODATA VALUE, select USER DEFINED.
  • For the USER DEFINED VALUE, insert -99999

Then click OK.

15.  Check the data objects in Saga to see the new imported ASC grid.  The grid system appears nearly exactly the same as the NC grid, but Saga lists them separately!
16.  And there is the mapped grid, ready to use for any usual purposes.  The white areas have the usual NODATA VALUE of -99999.