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, and mapped remote sensing imagery

Up
8.5 THREDDS Servers
8.6 OPeNDAP & LAS
8.7 SOS Servers
8.8 NetCDF in Saga/IDV
8.9 WMS Servers
8.10 ncWMS Server
8.11 SST Time Series
8.12 NOAA GEO-IDE

Home > 8. 8. Access & Services > 8.8 NetCDF in Saga/IDV

8.8 Viewing and Managing NetCDF Grids in Saga and IDV

  • Exercise Title:  Viewing and Managing NetCDF Grids in Saga and IDV

  • Abstract:  This exercise shows you how to load NetCDF grids into Saga (either directly or through IDV), a capability now robust enough to be called routine.  Now, when NetCDF grids are "well formed" (meaning they fully comply with the standard format specification), they can be loaded directly into Saga and used like any other grid.  This is possible through the general GDAL "Raster Import" module in Saga, but not through the "NetCDF Import" module.

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

  • Required Software:

  • Other Resources: 

  • Handholding:  Joleen Feltz, Sean Arms

  • Author:  Murray Brown

  • Version:  May 2013

1.  There are 2 basic routes to obtaining NetCDF files (NC) that may be compatible with Saga.  There are many examples of either method in the exercise group Handling Operational & Synoptic Marine Data.  
  • METHOD ONE:  Loading already downloaded NC files directly into Saga, either entire grids or after online subsetting.  In the first part of this exercise we'll use the SST file listed above, which was obtained in this way. 
  • METHOD TWO:  After remote gridded data resources have been accessed by IDV, use a special function in IDV to export local NC data files.  The new local files will be in NC format, either entire or locally subsetted.

This exercise assumes you are already familiar with IDV use, so it will not go into great detail with that program.  This exercise focuses on NetCDF files.  Similar results might also occur with local GRIB files but this has not been tested.

2.  METHOD ONE:  Loading a local NC file into Saga.  The source of the NC file is not relevant, so long as it is "well formed".  A small but significant percentage of NC files downloaded from the web are not fully compliant with the NetCDF specification and cannot be used in Saga.  You just have to find out individually.
3.  Run Saga
4.  Select MODULES > IMPORT/EXPORT-GDAL/OGR > GDAL: IMPORT RASTER

NOTE:  Not the nearby IMPORT NETCDF because it is apparently too restrictive in the expected format of the file!

5.  Make these choices:
  • For FILES navigate to and select the NC example listed above
  • Put a CHECK in SELECT FROM MULTIPLE BANDS, which allows you to pick individual days from multi-day files (and possibly other types of selections, such as depths, when available)
  • Uncheck the item TRANSFORMATION, for which this author cannot find documentation.  Do some experiments on your own if interested, and let me know.

Then click OK.

6.  This BAND SELECTION window opens. 
Select the second item, which seems to be the second day of a 2-day composite.  Then click OK.
7.  This new data grid appears in Saga.
8.  Use ADD TO MAP to display the grid.  You can see that Saga initially displays NC in shades of gray, and this particular file plots upside-down (a common occurrence with all sorts of grids).
9.  Run the module GRID TOOLS > GRID ORIENTATION.
  • For GRID SYSTEM select the system for the SST grid
  • For GRID select the SST grid
  • For CHANGED GRID select the SST grid, so the new version copies over the old version
  • For METHOD select FLIP

Then click OK.

10.  The grid immediately flips over to the correct orientation.  Here you can see it with 100-color "preset" rainbow palette.  You can find this in SETTINGS > COLORS > COLORS.
11.  Take a minute to change the NAME as you see here.  Edit it at the top of the SETTINGS panel, then click SETTINGS > APPLY at the bottom of the panel.
12.  Save the renamed grid, using SAVE AS; navigate to PRODUCTS > SAGA > GRIDS and use the filename sst_20101221_liberia_ghrsst_poet_esip_9km_nc_saga.sgrd
13.  That completes the method (when it works!) for NC files you have saved on your own computer. 
14.  METHOD 2:  Now we move on to the many files you used, but did not physically download, with IDV.
15.  Run IDV.  On the dashboard, select CATALOGS > THREDDS CATALOG
16.  In the catalog, navigate to one of the first global sources, as you see here in the National Center for Environmental Prediction (NCEP) > Global Ensemble Forecasting System (GEFS).  Click on ADD SOURCE.

 

NOTE:  If this source is not available today, go for something in the next item, the NCEP Global Forecast System

17.  This new source, the NCEP GEFS appears in the object list on the left.  Right-click on it and select PROPERTIES.
18.  On the TIMES tab, pick USER SELECTED and then scroll down to the last possible time (actually a forecast).
19.  On the SPATIAL SUBSET tab, draw a small rectangle (with your cursor) anywhere near the area of interest.  It does not have to be exact.

Then write the correct value for the TOP, LEFT, BOTTOM and RIGHT in the small spaces on the left.

Then click OK.

20.  Now you can select the specific variable to display and the type of display.
  • FIELDS - Navigate down into the 2D item and select the MAXIMUM TEMPERATURE (6HR - UNWEIGHTED MEAN).
  • DISPLAY - Select COLOR-SHADED PLAN VIEW

Then click CREATE DISPLAY at the bottom.

 

21.  After a short wait, IDV displays this plot (with no adjustment of the palette).
22.  You can click on the name of the display (on the right) or find the dashboard window for this item, to see these settings.  The values by the color table clearly indicate that these data are in Kelvin degrees (C + 273.15).
23.  You can select EDIT > CHANGE DISPLAY UNIT to get this small settings window.  Here you can change Kelvin to Celsius, and click OK.
24.  This changes the display units, as you see here.

NOTE:  This is only a temporary display change, because when you export the NC file (as we're about to do) the Kelvin units remain with the file.

25.  At the top of the dashboard (or layer window) for this display, select SAVE > EXPORT NETCDF as you see here.
26.  Navigate to the folder PRODUCTS > IDV and save the file with the name temp_kelvin_avgmax_liberia_20130601_gefs_ncep_idv.nc
27.  Using the steps you saw above (except FLIP, which isn't needed for these data) you can load the NC file into Saga and display it as you see here.

NOTE:  To change the units from Kelvin to Celsius in Saga, use MODULES > GRID CALCULUS > GRID CALCULATOR and subtract 273.15 from each cell value.

28.  Finally, don't forget to use SAVE AS to save this new grid in the folder PRODUCTS > SAGA > GRIDS with the filename  temp_kelvin_avgmax_liberia_20130601_gefs_ncep_idv_nc_saga.sgrd.  Or remove kelvin from the name if you changed the units.
29.  This author guarantees that you will run into all kinds of complications with these methods.  Just be patient and try different settings.  Remember there are NC files that simply cannot be loaded into Saga, due to formatting issues.  Good luck.

 

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