sodb_inpolygon documentation

The sodb_inpolygon returns measured (not gridded) data for all SODB stations within a specified polygon.



StationData = sodb_inpolygon(lat,lon)
StationData = sodb_inpolygon(x,y)
StationData = sodb_inpolygon


StationData = sodb_inpolygon(lat,lon) returns a structure array of SODB station data within the georeferenced polygon given by the arrays lat,lon. Variables in the structure array are as follows:

   StationData.sta   station            station number   latitude           °N
   StationData.lon   longitude          °E
   StationData.t     time               datenum format
   StationData.dep   depth              meters
   StationData.prs   pressure           dbar
   StationData.gam   neutral density    kg/m3
   StationData.ptm   potential temp.    °C
   StationData.sal   salinity           PSS78
   StationData.tem   measured temp.     °C
   StationData.oxy   oxygen             umol/kg
   StationData.sil   silicate           umol/kg
   StationData.po4   phosphate          umol/kg
   StationData.no3   nitrate            umol/kg
   StationData.no2   nitrite            ?
   StationData.f11   CFCs               pmol/kg
   StationData.abs   absolute sal.      g/kg  (Requires GSW toolbox)
   StationData.con   conservative temp. °C    (Requires GSW toolbox)
   StationData.dtm   T-T_freeze         °C    (Requires GSW toolbox)

StationData = sodb_inpolygon(x,y) defines the polygon in polar stereographic (re: 71°S) eastings and northings in meters. If no point the first input array has an absolute value greater than 90, ps71 units are assumed.

StationData = sodb_inpolygon allows user to define a polygon by clicking on a current map.


Perhaps you're interested in the Amundsen Sea. For context, here's a 1000 kilometer wide map of the Amundsen Sea region:

mapzoom('amundsen sea',1000,'inset','ne')
bedmap2 patchshelves
bedmap2('patchgl','oceancolor',[0.0118 0.4431 0.6118])

Where are the SODB stations? Let's plot them as red pentagrams:


Now say you want all the SODB station data within some arbitrary polygon. Let's define that polygon and plot it on our map:

lat = [-71.49,-70.66,-69.81,-69.65,-70.25,-72.31,-74.6,-75.78,-76.65,-76.54,-75.72,-74.32];
lon = [-99.94,-101.3,-106.43,-112.75,-117.43,-122.11,-124,-121.54,-112.17,-103.32,-98.8,-98.58];


We can get all the SODB station data within the yellow polygon as a structure array sd with one simple command:

sd = sodb_inpolygon(lat,lon);

Structure arrays may be a little confusing if you haven't seen them before, but once you see how they work hopefully you'll think they aren't so bad. Here, we have sd which is a structure array containing all the station data within our polygon lat,lon. The latitudes of all the stations are given by,sd.lon. To confirm that we've gotten all the data within our polygon, let's plot our station locations as yellow circles:

plotm(,sd.lon,'yo') % sup

Now each measured variable has its own cell array within sd. For example, potential temperature is given by

ptm = sd.ptm;

If you check your variable workspace you'll see that ptm is a 1x95 cell array. That's one entry for each of the 95 stations inside our polygon. So for the first of the 95 stations, a temperature profile is given by ptm{1} or more directly, sd.ptm{1}. The temperature profile at the second station is found in sd.ptm{2} and so on.

There are a few ways we can plot the data for our 95 stations. One way is to loop through each of the 95 stations. Let's do that as we plot temperature profiles:

hold on
for k = 1:length(sd.sta)
xlabel 'potential temperature ({\circ}C)'
ylabel 'depth (m)'

If you do not need to keep track of which stations are which, you can concatenate all station data for each variable into a single array to make for easy plotting. Here we concatenate potential temperature, depth, and salinity:

ptm = cell2mat(sd.ptm(:));
d = cell2mat(sd.dep(:));
sal = cell2mat(sd.sal(:));

With potential temperature, depth, and salinity each concatenated into their own arrays, we can make a T-S diagram using the scatter command:

ylabel 'potential temperature ({\circ}C)'
xlabel 'salinity (PSS 78)'
axis tight
cb = colorbar;
ylabel(cb,'depth (m)')

Citing these datasets

If you use SODB data, please cite: Orsi, A. H., T. Whitworth III, Hydrographic Atlas of the World Ocean Circulation Experiment (WOCE). Volume 1: Southern Ocean (eds. M. Sparrow, P. Chapman, and J. Gould), International WOCE Project Office, Southampton, U.K. More info on SODB here:

If you use any of the datasets which use GSW conversions, cite IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of seawater - 2010: Calculation and use of thermodynamic properties. Intergovernmental Oceanographic Commission, Manuals and Guides No. 56, UNESCO (English), 196 pp. More info on GSW & TEOS-10 here:

Author Info:

This function and supporting documentation were written by Chad A. Greene of the Institute for Geophysics at the University of Texas in Austin and David E. Gwyther of the Institute for Marine and Antarctic Studies, University of Tasmania in July 2015.