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 > 6. Plotting Motion Vectors > 6.3 GDP/NetCDF

6.3 Surface Current Vectors from the Global Drifter Program (GDP): NetCDF Option

1.  Spend a few minutes reading about the GDP.  Many interesting products and imaginative graphics make this a particularly interesting site.

Here's a note from Rick Lumpkin (GDP director) about the interesting cluster of drifters in the center of the Atlantic:  "You can read about the SPURS project here:"

2.  In the left-hand menu, select GLOBAL DRIFTER PROGRAM > DATA AND PRODUCTS
3.  In the left-hand menu, select PRODUCTS > MEAN VELOCITY ESTIMATES
4.  This long page describes three different "versions" of the GDP climatological products.  Read over it carefully so you are completely comfortable with the different resources.
5.  This is the revised text of the "second version" product description, with irrelevant items deleted.

The second version ( Matlab binary format/ ASCII/ NetCDF ) contains monthly mean values of surface currents and SST. The variable names for the NetCDF file are listed below, edited to omit irrelevant items.  [TIME is described further down this page.]

  • Lon (1x720): longitude (degrees), negative=West.

  • Lat (1x317): latitude (degrees), 73S to 85N.

  • U (317x720): eastward speed (m/s) vs. Lat/Lon.

  • V (317x720): northward speed (m/s).

  • SST (317x720): sea surface temperature (degrees C).

  • eU, eV, eSST: standard error for U, V, SST

  • N (317x720): Number of drifter-days per square degree.

6.  Download the NetCDF file for this second version of the climatology (indicated above by the yellow highlight).   Save it in the folder DATA > OCEAN > GDP with the filename (or higher if appropriate)

IMPORTANT NOTE:  This retrieval targets the latest available climatology, Version 2.04.  The GDP advises that if a newer version is available, use that.   They plan on updating the climatology approximately every six months as new data become available.

7.  Run HDFView
8.  Select FILE > OPEN and navigate to the folder DATA > OCEAN.  Make sure FILES OF TYPE is set to ALL FILES, so you can see NC files also.

Find the January NC file you just downloaded, and open it.

9.  Here is the initial view of the file objects.  Compare these items to the list above.
10.  If you select LAT, you'll see these metadata: 
  • 317 unique values
  • From -73 to +85
  • 0.5-degree intervals
11.  If you select LON, you'll see these metadata:
  • 720 unique values
  • From -180 to 179.5
  • 0.5-degree intervals
12.  If you select TIME, you'll find the method for specifying the months.  For example, December is 11.
13.  Right-click on the U grids, and select OPEN AS.
14.  This dataset selection window opens.  Notice that the HEIGHT, WIDTH and DEPTH axes appear to be properly identified automatically (not always the case with NetCDF).  [Ignore the reverse orientation of Latitude for now.  We can fix that later.]
  • Height = latitude (0-316)
  • Width = longitude (0-719)
  • Depth = month (0-11)

So you can click OK to open the parameter as a spreadsheet (the default view).

15.  Here is the data matrix of U values.  Notice that you can use the arrows above the matrix to move between the months.  The current month value is 0, indicating January.
16.  Select TABLE > SHOW SCIENTIFIC NOTATION to make certain that the "E" notation is used.  This improves readability by Saga.
17.  Here you see that values are in the E notation system.
18.  Select TABLE > EXPORT DATA TO FILE, and export the table to the folder PRODUCTS > HDFVIEW with the filename current_surface_u_jan_gdp_phod_0.5deg_ver2.04_hdfview.txt
19.  Using the same steps, export the January V grid to the file current_surface_v_jan_gdp_phod_0.5deg_ver2.04_hdfview.txt in the same folder.
20.  Using the same steps, save the July files by selecting TIME = 6 (the seventh month in a 0-11 month year), and then save the U and V grids to the files
  • current_surface_u_jul_gdp_phod_0.5deg_ver2.04_hdfview.txt
  • current_surface_v_jul_gdp_phod_0.5deg_ver2.04_hdfview.txt

You can close HDFView.

21.  Now, you have these TXT files
22.  Use use any good ASCII editor to open the file current_surface_u_jan_gdp_phod_0.5deg_ver2.04_hdfview.txt
23.  Manually add these 6 header lines (actually the standard header lines in an ESRI ASCII grid file). 
  • The ncols value comes from Panel 5, above
  • The nrows value comes from Panel 6, above
  • We are guessing that the data cells are "cell centered" so we use the lower left corner values seen in Panels 5 and 6, as centers
  • We know cellsize from the data source documentation
  • Notice that the nodata_value has been taken from visual inspection of the file values.  [The final character is a zero, not an "oh"]
24.  Save the new file in the same folder with the name current_surface_u_jan_gdp_phod_0.5deg_ver2.04_hdfview.asc (the new extension is the only change).
25.  Make the same addition to the other 3 files, and save them all with the new extension ASC.  You can close the ASCII editor.  And you can delete the TXT files, because you only need the new ASC files.
26.  Run Saga.
28.  For FILE navigate to and select the new ASC file for the January U component grid.
  • For TARGET GRID TYPE, select FLOATING POINT (8 BYTE).  This is standard practice to handle any "weird" NOAA or NASA no-data values (commonly encountered!)
  • For USER DEFINED NODATA VALUE, insert the standard Saga value of -99999.  This changes whatever we found in the incoming file to -99999.

Then click OK.


29.  In the same way, import the January V component grid.  Here you can see both grid objects in Saga.
30.  If you open the U January grid for visual inspection, you'll see that it is upside down (which we expected from our first view of it in Panel 9, above.
31.  To invert the grid, select MODULES > GRID TOOLS > GRID ORIENTATION.
  • For GRID SYSTEM and GRID, select the U component grid. 
  • For CHANGED GRID you must select [NOT SET] to copy the new flipped grid over the old grid.
  • For METHOD, select FLIP.

Then click OK.


32.  Perform the same flipping operation with the V component grid.
33.  Here you can see both flipped grids and they appear properly oriented. 
34.  These are both global grids, and we want to work only with Liberia data (or whatever area you've selected).  In the next few steps we resample the down to the Liberia area.
35.  Select FILE > GRID to load the dummy grid you made for Liberia:  frame_grid_liberia_0.5deg
37.  Make these choices:
  • GRID SYSTEM - Select the full global grid system
  • GRID - Select the January U grid
  • TARGET GRID - Grid

Then click OK.

38.  Make these choices:
  • GRID SYSTEM - Select the 0.5-degree target grid template for Liberia
  • GRID - Create
39.  For INTERPOLATION METHOD, select NEAREST NEIGHBOR to avoid creating cell values over land.  Then click OK.
40.  This new grid of U value for the January Liberia grid is produced.
41.  You can repeat the above steps, very carefully, with the January V grid.
42.  Here you can see the January V grid, made with ADD TO MAP > NEW MAP.
43.  Now is is very easy to make the vector arrows.  Select MODULES > SHAPES - GRID > GRADIENT VECTORS FROM DIRECTIONAL COMPONENTS


44.  Make these settings:
  • For GRID SYSTEM, select the system of the resampled component grids. 
  • For X COMPONENT, select the U grid
  • For Y COMPONENT, select the V grid
  • For STEP, select 1 to display all cells, [2, for example would display every second cell]
  • For MINIMUM and MAXIMUM, start with 0 and 1000; you can return later and use different values if these don't work well

Then click OK.

45.  A new shapes object appears.  Here is is visualized with SHOW MAP.
46.  To provide a visual magnitude scale, go the settings panel and select TYPE = GRADUATED COLOR.

Also select ATTRIBUTE = LEN (for "length").

Then click on SETTINGS > APPLY.

47.  Here you see the arrows offshore Liberia color-coded.
48.  Now go ahead and make the vector arrows for July.
49.  Make sure to save the shapefiles in the folder PRODUCTS > SAGA > VECTORS with names like
  • current_vecs_jan_liberia_gdp_0.5deg_ver2.04_hdfview_saga
  • current_vecs_jul_liberia_gdp_0.5deg_ver2.04_hdfview_saga
50.  We have rushed through many steps to get to these vectors.  You can take your time to go back and investigate the many options we passed over quickly.  Making good, visually impresive, vector arrows is as much art as science, so you should work to get more experience in this area.