Utility Functions 3 Adding Your Own Datasets to the OPeNDAP Matlab GUI A Getting Started with the OPeNDAP Matlab GUI Software Index
NVODS Home

3.3 Adding a New Dataset

Here's an example of how to add a gridded dataset to the OPeNDAP Matlab GUI.

We start with just a URL:

http://ferret.pmel.noaa.gov/cgi-bin/dods/nph-dods/data/
  PMEL/large_trenberth_moncl.nc';

We will do this iteratively, improving our archive M-file as we go. For the first step, we'll use the following. (We've shortened the URL here for formatting reasons. Use the whole URL shown above.)

GetFunctionName = 'getrectg';
Server = 'http://ferret.pmel.noaa.gov/...
          
LonRange = [-180 180];
LatRange = [-90 90];
TimeRange = [1800.0 2000.0];
DepthRange = [0.0 0.0];
Resolution = NaN;
DataName = 'Trenberth Wind Stress - PMEL';

SelectableVariables = str2mat('Wind Stress U', 'Wind Stress V');

It's missing the DodsName variable, but we can find that information using loaddods. At the Matlab command line, type:

DAS =loaddods('-A','http://ferret.pmel.noaa.gov/... ')

You can look at the DAS variable now, and you'll see a TAUX and a TAUY, so those must be the names for the stresses.

So we'll add the following to the bottom of our tentative archive M-file:

DodsName = str2mat('TAUX', 'TAUY');

Now open the bookmarks editor (control-B is a shortcut), select a wind dataset and copy and paste it to get a copy. Open the properties editor for the new entry, and erase the name and archive. Pick a new color, too. Click Apply to make the changes in the bookmarks, and Reload to force the old archive files to be cleared, and to be reread, along with this new archive. The dataset name should be filled in automatically with the information from the new (but still tentative) archive M-file.

Now click OK to dismiss the properties dialog. Once back in the bookmark editor window, Save (and apply to the GUI) and Close.

Once back in the browser window, select the new dataset. Select the entire time range and click Get Details. You can examine the URLlist returned, and you'll see that the URL returned has only twelve data points in the time dimension. This would imply that this is a climatology, containing monthly averages.

http://ferret.pmel.noaa.gov/...?TAUX[0:1:11][0:1:72][0:1:143]...

We still don't know the resolution or actual geographic extent, but we can correct the original guess for TimeRange. Substitute the following line for the original time range guess:

TimeRange = [1800 str2num(datestr(date,10))];

To update the bookmarks, you can press Ctrl-B to bring up the bookmarks editor, select the new dataset, Ctrl-I to get the properties editor, Press Reload/Clear, then OK to dismiss this window, Ctrl-S to save the bookmarks and apply them to the GUI again.

Now select June 1947 and Wind Stress U and V and click Get Details. You will probbaly need to identify the axes again because reloading the archive clears the cached metadata. Check the URL again, and you'll see the time slice which is selected in the URL:

http://ferret.pmel.noaa.gov/...?TAUX[5:1:5][0:1:72][0:1:143]...

Month 5 (starting at zero) is June, so the time axis is set correctly. Had it not been, we could use the Time-Offset feature of getrectg to correct it.

Now we can click Get Data. Go with the default plot option, and you'll see that the extent of the dataset is indeed global.

To figure out the resolution, type this at the Matlab command prompt:

>> diff(R1_Latitude)

This gives a value of 2.5 (so does the same test with Longitude), so we'll replace the Resolution line in the archive file with this one (111 km is the distance of one degree of longitude at the equator):

Resolution = 2.5*111; 

To reload the new file, hit Ctrl-B to get the bookmarks editor, Ctrl-I get the properties, 'Reload/Clear' one more time, dismiss the properties, Ctrl-S, save and close. Select the new dataset, reselect June 1947, and this time, a Resolution of 555.0 km. Click Get Data, re-identify the axes one last time when prompted, and change the quiver plot color to 'r' (red). Select "overplot" to plot on top of the previous ploy, and you'll see that the scaling is now different. But you also see that you have every other data point and they are also clearly one per 5 degrees, so the addition has been a success.


Tom Sgouros, December 21, 2004