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.30 Argo MLDs

2.30 Adding UCSD/Scripps/Argo Mixed Layer Depths Climatology to Maps 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:  Adding UCSD/Scripps/Argo Mixed Layer Depths Climatology to Maps in Saga: Argo

  • Abstract:  In this exercise you'll learn how to access a very interesting library of mixed layer data products, derived from the global Argo program.  The grids are in a somewhat obscure format, but fortunately can be read by Saga.  One read, however, they are found to be in abysmally bad geographic reference systems, requiring manual tweaking of the metadata for the grids to give them usable coordinates.  The final results are very good, and should be useful for nutrient dynamic studies, etc.

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

  • Required Software:

  • Other Resources: 

  • Author:  Murray Brown

  • Version:  1-23-2014

1.  The exercise involves managing and displaying any of the interesting products relating to the ocean Mixed Layer Depth (MLD), from Scripps.  You really should read some of the preliminary articles, above, to get a better idea of how complex these can be.  Although many oceanographers have a good idea of what the MLD is, they might be unfamiliar with the many ways scientists have tried to automate its quantification through various algorithms that examine the temperature, salinity and/or density profiles.  This exercise will focus on two different methods in use at Scripps.
2.  Open the Scripps MLD website, and take some time to read about the project and methods in use.  You'll find that the MDL products examined here are only part of this data offering.  Bulk mixed-layer salinities, temperatures and densities are also available.  Come back on your own time to explore the possibilities.
3.  Scroll down the page (quoted here from the original page) to find the MLD climatology, as you see here.  The file we want is the link that begins DOWNLOAD ARGO MLD CLIMATOLOGY.

You should use SAVE AS to save this file to the folder DATA > OCEAN > UCSD/SCRIPPS, with the filename mld_global_ucsd_scripps_argo.nc

In the panels that follow we'll examine this file to see what it really contains and in what format.  But the lengthy list of objects caught our attention, and it is color-coded here to indicate what we actually found below.  The explanations for the colors are given below the list.

Mixed layer depth climatology (updated through December 31, 2011):
The climatology is determined by grouping the profiles into 1 degree bins and then calculating the mean, maximum, and minimum mixed layer properties (depth, temperature, salinity, and potential density) in each bin. These mixed layer properties are calculated separately for the density algorithm, the density threshold, the temperature algorithm, and the temperature threshold. The maximum and minimum values in each 1 degree bin are the means of the five highest or lowest values. The climatology uses the variable density threshold.
  • Download Argo MLD climatology: mixed layer properties averaged into 1 degree bins (14 MB, netcdf format)

The climatology contains the following fields averaged into 1 degree bins [COLOR CODING ADDED BY THE AUTHOR OF MDL; SEE BELOW FOR THE KEY]:

  • maximum density algorithm mixed layer depth, temperature, salinity, and potential density
  • maximum density threshold mixed layer depth, temperature, salinity, and potential density
  • maximum temperature algorithm mixed layer depth, temperature, salinity, and potential density
  • maximum temperature threshold mixed layer depth, temperature, salinity, and potential density
  • mean density algorithm mixed layer depth, temperature, salinity, and potential density
  • mean density threshold mixed layer depth, temperature, salinity, and potential density
  • mean temperature algorithm mixed layer depth, temperature, salinity, and potential density
  • mean temperature threshold mixed layer depth, temperature, salinity, and potential density
  • minimum density algorithm mixed layer depth, temperature, salinity, and potential density
  • minimum density threshold mixed layer depth, temperature, salinity, and potential density
  • minimum temperature algorithm mixed layer depth, temperature, salinity, and potential density
  • minimum temperature threshold mixed layer depth, temperature, salinity, and potential density

BLUE - Listed, found, but not used here

RED - Listed, but not actually found in the file downloaded from the website

YELLOW - Listed, found and used in the exercise below

4.  So what is the format of the file?  Testing with 6 different programs gave a variety of clues:
  • IDV cannot read it at all, either as HDF or NC
  • Panoply can read it, but does not find the variables indexed by X and Y to allow mapping
  • HDFView reads as either HDF5 or NC, but cannot handle NaN values for blanks in either format; ASCII export possible, but not tested
  • ncBrowse (as shown below) can read it and map objects; they appear in the unwanted 0-360 and 0-180 coordinate frame discussed below
  • Context ASCII editor reveals the ASCII tab "HDF" at the beginning of the file.
  • GDAL/OGR Modules in Saga can, fortunately, read the grids, and describes them as NetCDF
3.  The gold standard for NetCDF recognition (but also CDF recognition, a very different format, so beware) is ncBrowse.  Here it is opened in ncBrowse, and the first object, da_mld_max is loaded for examination.  This is the best way to check and confirm object full names, as you see here by VARIABLE NAME.

Line by line checking of the grids inside the NC file, using ncBrowse, resulted in the categories you see above in Panel 3.

4.  Another good check to make with ncBrowse, is to use GRAPH VARIABLE, to see what they actually look like.  Here you can see the expected global map, but the coordinates are wrong and will cause problems below:
  • The longitude goes from 0 to 360
  • The latitude goes from 0 to 180

If there are offsets that could be applied by the NC file itself, then they have not been supplied by the publishers.

5.  So the bottom line is that we will use these grids in the NC file, as revealed by ncBrowse.  The "object names" shown here will be out guide to finding them when used in other software programs.
  • "Average of all of the MLDs found by the density algorithm in 1 degree bins"

    • NetCDF Object:  da_mld_mean

  • "Average of all of the MLDs found by the variable density threshold in 1 degree bins"

    • NetCDF Object: dt_mld_mean

6.  Run Saga.  Then select MODULES > IMPORT/EXPORT-GDAL/OGR > GDAL: IMPORT RASTER.  Then make these choices:
  • FILE - Select the NC climatology file, using the helper window for selection
  • MULTIPLE BANDS - Check
  • TRANSFORMATION - Check
  • INTERPOLATION - Nearest neighbor (for simplicity; try others later)

Then click OK.

7.  This window will appear, where you can choose which grids to actually load from the entire NC file.  Find and check the two objects we decided to use above.

Then click OK.

8.  Here are the grids in Saga.  Notice the grid system has 2 major problems with the geometry, already noted above:
  • The lower left longitude cell is centered at 0.5 degree, but we would expect -179.5 (for cell-centered grids)
  • The lower left latitude cell is centered at 0.5 degre, but we would expect -89.5 (for cell-centered grids)
9.  And if you use ADD TO MAP to display the grid, you can see another problem, the raster is upside-down.  We need to fix all of these issues, but it will require separate steps. 
10.  To mend the orientation, select MODULES > GRID TOOLS > GRID ORIENTATION, then make these choices:
  • GRID SYSTEM - The downloaded object grid
  • CHANGED GRID - Create
  • METHOD - Flip

Then click OK.

11.  This new object appears.
12.  Change the name (SETTINGS > NAME, then SETTINGS > APPLY).
13.  Use ADD TO MAP to see the raster, and it looks good.  But if you place the cursor at the very center of the map, you will see strange longitude and latitude values, as you can see just below it..
14.  Now, to fix the coordinate system, we need to save the existing flipped grid to file.  Right-click that object, and select SAVE AS.
15.  Navigate to PRODUCTS > SAGA > GRIDS and save the file as dat_mld_mean_flipped.sgrd
14.  Now to change the coordinate system away from the problems we saw above in Panel 4, open the SGRD file in a good ASCII editor (but not Notepad or Wordpad).

The problem is in the POSITION_XMIN and POSITION_YMIN lines.

15.  Change the XMIN and YMIN values as you see here.  Then save the SGRD file back to the same location.

It is not very elegant to have to edit he SGRD file like this to translate the grid.  Perhaps there is a module in Saga to do this, but the author could not discover it.

16.  Now use FILE > GRID > LOAD GRID to load the grid da_mld_mean_flipped
17.  Here you can see that it loads with a different grid system.  Change the name, as you see here, to indicate it has been moved (SETTINGS . NAME then SETTINGS > APPLY).
18.  Now you can use ADD TO MAP to show the moved grid in a NEW map, as you see here.

The cursor has been place near Liberia, and you can see from the X and Y values below the map that the coordinate system is good.

19.  It's always a good idea to see the histogram of the grid values, so you can understand the range of values.  Right-click on the flipped and moved grid, and select HISTORGRAM.  Here you can see that most values fall below 200 m, and there is a pronounced peak at around 50 m.
20.  To visualize these data better, find the COLORS settings in the properties/settings panel.  Click on the ellipsis (...) to the right, to get into the color controls.
21.  Make these choices.
  • COLORS - Set 100, and pick PRESETS > RAINBOW
  • VALUE RANGE - Set to 0 and 200 (from our histogram viewing)

Then select SETTINGS > APPLY just below.

22.  And here is our final global map of MLD, from the method we selected at the very beginning.
23.  And here is the histogram for the final grid, as colored above.
24.  But what about Liberia?  First we need to load the 0.5-degree dummy grid to use for the resampling.  You should have already made this, but ask your instructor for a copy if you did not.
25.  Select MODULES > GRID TOOLS > RESAMPLING.  Then make these choices:
  • GRID SYSTEM - The flipped, moved final grid
  • GRID - The final grid 3 Panel above here
  • PRESERVER DATA TYPE - Check
  • TARGET GRID - Grid (which means we will be asked which grid to use)

Then click OK.

26.  You are next asked which grid to use for the resampling, so select the 0.5-degree dummy grid (or any other you may prefer).  Then click OK.
27.  You can select any resampling option, such as Nearest Neighbor, as here.  Then click OK.

Come back later for your own experiments.

28.  This new data object appears, in the same system as the dummy grid you selected.
29.  And here you can see it using just about the same coloring choices as for the global map.  But the value range is only 0-50, which seems appropriate from a histogram.
30.  Before you go on to other work, make sure to save the grid in the folder PRODUCTS > SAGA > GRIDS with the filename mld_liberia_all_density_algorithm_ucsd_scripps_argo_0.5deg.sgrd
31.  Now return to Panel 5 and go through all these steps with the other object dt_mld_mean which uses a different algorithm to estimate the MDL.