Monthly Archives: January 2014

Revisiting GMT, perl, and proj

The time has come to make a site map for our ship source level paper.  I always love this stage of a project — map making — because it still takes me back to some of the geekiest open source Unix stuff my PhD advisor, Russ McDuff, taught me: using public bathymetric data in Generic Mapping Tools (GMT) and Proj within Perl to make awesome maps of the ocean for free!  It’s always a chore to get all these tools working within your Li/Un/*ix operating system, but below is an example of what they can do from this working directory

In my latest attempt (within a account), I had to remember (again) the syntax and commands for setting path variables…

  1. edit .bashrc to include a path to your proj and GMT binaries
  2. export PATH=~/bin:~/usr/local:~/usr/local/bin:~/$PATH
  3. execute: . .bashrc to reinitialize the PATH variable
  4. check PATH with env
  5. check all is well with which proj

Here’s the perl script for making the (above) rough draft map of Haro Strait and the San Juan Islands.


#`gmtset X_AXIS_LENGTH 8.5i X_AXIS_LENGTH 11i`;
#`gmtset ANOT_FONT_SIZE 8 ANOT_OFFSET 0.037`;
#$gxscl=4; $gyscl=4;
#`gmtset GLOBAL_X_SCALE $gxscl  GLOBAL_Y_SCALE $gyscl`;

# Haro Strait region
#$prj=6;        # inches/degree
$lonmin=-123.5; $lonmax=-123; $latmin=48.25; $latmax=48.75;
#$xoff=2.5;  $yoff=4;
$xoff=2;  $yoff=2;
#$xoff=0;  $yoff=0;



`psbasemap $proj $bound -K -P -V -X$xoff -Y$yoff $tick > $out_ps`;
`grdimage $basemap -C$cptfile $proj $bound -P -O -K -V >> $out_ps`;
`grdcontour $basemap -C50 $proj $bound -W.05p -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -Cfig1cnt $proj $bound -W1p/255/255/255 -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -C10 $proj $bound -W.05p -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -C20 -A100f3 $proj $bound -W1p -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -C500 $proj $bound -W$cntpen -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -C0 $proj $bound -W$cntpen -Q10 -P -O -K -V >> $out_ps`;
#`grdcontour $basemap -C2000 -Af3 $proj $bound -W0.5p/50/50/50 -Q10 -P -O -K -V >> $out_ps`;

#`pscoast $proj $bound -Dh -A9 -W -G255/255/255 -S240/240/240 -N1 -N2 -O -K -V >> $out_ps`;
#`pscoast $proj $bound -Dh -A9 -W -N1 -N2 -O -K -V >> $out_ps`;
# Land grey:
#`pscoast $proj $bound -Dh -A20 -W0.5p/10/10/10 -G200/200/200 -O -K -V >> $out_ps`;
`pscoast $proj $bound -Dh -A20 -W0.5p/10/10/10 -O -K -V >> $out_ps`;

# Label pertinent features...
open (WORDS, ">labels");
print (WORDS "-123.75  48.445    $wfont 0 0 2 Victoria\n");
#print (WORDS "-124.690  48.245    $nodefont 0 0 TL Neah Bay\n");
#print (WORDS "-122.750  48.060    $nodefont 0 0 TR Marine Science Center\n");
#print (WORDS "-123.300  48.550    $nodefont 0 0 BR Orcasound lab\n");
print (WORDS "-123.065  48.525    $nodefont 0 0 TL Lime Kiln\n");
#print (WORDS "-122.700  48.425    $nodefont 0 0 TL State Park\n");
print (WORDS "-122.700  47.635    $nodefont 0 0 TC Seattle\n");
#`pstext -Jm -R -G0/0/0 -Dj$xtoff/$ytoff-O -K -V < labels >> $out_ps`;
# No background rectangles
#`pstext -Jm -R -G0/0/0 -O -K -V < labels >> $out_ps`;
# Background rectangles with rounded corners: [ -W[color,][o|O|c|C[pen]]
#`pstext -Jm -R -G0/0/0 -W255/255/255,Othick,255/0/0 -O -K -V < labels >> $out_ps`;
`rm labels`;

# Put symbols on nodes
open(SYM, ">nodes.lonlat") || die "Can't open nodes.lonlat!\n";
# print SYM "-124.675  48.390\n";  # Neah Bay
# print SYM "-122.750  48.125\n"; # Port Townsend
# print SYM "-123.200  48.550\n"; # Orcasound
 print SYM "-123.150  48.500\n"; # Lime Kiln
# print SYM "-122.350  47.600\n"; # Seattle
`psxy nodes.lonlat -Jm -R -P -Sc0.5/0/0/0 -G255/0/0 -V -O -K >> $out_ps`;

#Put more symbols on...
`psxy catscradle.lonlat -Jm -R -P -Sc0.05/0/0/0 -G255/0/0 -V -O -K >> $out_ps`;

# Good offset if using WS lat/lon labels
#$locyoff=1.8; $locxoff=2.8;
$locyoff=0.75; $locxoff=0.75;
#`psbasemap -Jm0.2 -R-135/-105/35/55 -O -K -X$locxoff -Y$locyoff -P -Ba10f5/a5f5WeSn >> $out_ps`;
#`psbasemap -Jm0.2 -R-135/-105/35/55 -O -K -X$locxoff -Y$locyoff -P -Ba10f5/a5f5wesn >> $out_ps`;
`psbasemap -Jm2.5 -R-125/-122/47/48.5 -O -K -X$locxoff -Y$locyoff -P -Ba10f5/a5f5wesn >> $out_ps`;
# plot the coast line
#`pscoast -Jm -R -O -K -W -G210/180/140 -S135/206/250 -N1 -N2 >> $out_ps`;
#`pscoast -Jm -R -Di -A200 -O -K -W -G216/242/254 -S148/191/139 -N1 -N2 -V >> $out_ps`;
# Seattle Aquarium Kiosk colors
#`pscoast -Jm -R -Di -A200 -O -K -W -G172/208/165 -S186/232/254 -N1 -N2 -V >> $out_ps`;
`pscoast -Jm -R -Di -A200 -O -K -W -G200/200/200 -S255/255/255 -N1 -N2 -V >> $out_ps`;

# Put symbols on key cities
open(SYM, ">cities.lonlat") || die "Can't open cities.lonlat!\n";
# print SYM "-123.45 48.45\n";
`psxy cities.lonlat -Jm -R -P -Sc0.5/0/0/0 -G0/0/0 -V -O -K >> $out_ps`;

# Small box around the zoomed area
$lonboxmax=$lonmax; $lonboxmin=$lonmin;
$latboxmax=$latmax; $latboxmin=$latmin;
open(BOX, ">magbox.lonlat") || die "Can't open magbox.lonlat!\n";
print BOX "$lonboxmax-$marg   $latboxmax+$marg\n";
print BOX "$lonboxmax-$marg      $latboxmin-$marg\n";
print BOX "$lonboxmin+$marg      $latboxmin-$marg\n";
print BOX "$lonboxmin+$marg      $latboxmax+$marg\n";
print BOX "$lonboxmax-$marg      $latboxmax+$marg\n";
`psxy magbox.lonlat -Jm -R -P -W4p/0/0/0 -V -O >> $out_ps`;
`rm magbox.lonlat`;

`convert $out_ps $out_nm.png`;

Late night notes on noise from ship propeller cavitation

In Val’s most recent plots of noise levels received from passing ships at our Lime Kiln study site, we’re seeing interesting peaks at high frequency (>20 kHz) that vary between ship classes. Most prominently, there is a peak near or just above ~40 kHz for many ship types that is sometimes quite narrow-band, other times really broad (+/- ~10 kHz).

What spectral patterns should we expect for modern commercial ships, particularly at frequencies between 10 kHz and 100 kHz?

Thus begins another dive into the ship noise literature… revealing:

  1. Merchant ship propeller diameter (in meters) is about equal to their length in meters divided by 25 (Gray, Greeley, 1980).

    From Gray and Greeley, 1980

    From Gray and Greeley, 1980

  2. Mean blade-rate frequency varies a bit with ship length, but basically for big ships a typical frequency is about 8 Hz.

    Blade rate frequency for ~200m ships

    Blade rate frequency for ~200m ships (from Gray and Greeley, 1980)

  3. The blade-rate frequency shows up because cavitation noise is maximized when a propeller blade tip passes through the low velocity and pressure region of the wake field (the top of their rotation on single screw ships).  There is also a lot of energy at many harmonics of the blade-rate frequency.  Similar patterns of peaks are created by engines (firing rate harmonics) and generators (generator harmonics).
  4. The following plots from (Arveson, Vendittis, 2000) show that underwater noise data collected <~600m from a 173 m long coal carrier contain these numerous harmonics.
    Blade, engine, and generator harmonics

    Blade, engine, and generator harmonics

      1. All those peaks and additional broad-band noise from the collapse of the cavities add up to create spectra (e.g. 1/3-octave levels, below) which have led to the common characterization of shipping noise as having most of the energy at low frequencies (1-500 Hz).  As Areveson and Vendittis put it:“In addition to the blade rate harmonic series, cavitation generates a wideband spectrum due to the chaotic collapse of cavities. This spectrum has a broad, high-level ‘‘hump’’ centered at about 55 Hz, followed by a continuum that decreases by 6 dB per octave on a constant-bandwidth plot, or 3 dB per octave as seen on a 1/3-octave plot.”

        1/3 octave levels vs ship speeds

        1/3 octave levels vs ship speeds

  5. What is commonly overlooked is the rise in high-frequency noise that occurs with increases in ship engine RPM (and correspondingly ship speed).  Note that the increase in noise between the highest two RPM levels at 30,000 Hz is 2-4x the increase at 30 or 300 Hz.
  6. The authors note: “Above the cavitation inception speed the shape and peak frequency of the wideband cavitation spectrum do not change appreciably with ship speed. Only the overall level changes; it increases smoothly with speed according to 104 log (rpm), or about 31 dB per double speed.”
  7. While these spectra are interesting, they are not showing much structure above 20 kHz…
  8. At least for the cruise ships going 10 knots and measured at 500 yards by (Kipple, 2002) there are no dramatic peaks in the 10-40 kHz range, nor any indication that there is a peak near 40 kHz.

    Cruise ship 1/3-octave spectra

    Cruise ship 1/3-octave spectra

Gray, L. M., & Greeley, D. S. (1980). Source level model for propeller blade rate radiation for the world’s merchant fleet. The Journal of the Acoustical Society of America, 67(2), 516–522. doi:10.1121/1.383916
Arveson, P. T., & Vendittis, D. J. (2000). Radiated noise characteristics of a modern cargo ship. The Journal of the Acoustical Society of America, 107(1), 118–129. doi:10.1121/1.428344
Kipple, B. (2002). Southeast Alaska Cruise Ship Underwater Acoustic Noise (Technical Report No. NSWCCD-71-TR-2002/574) (p. 92). Naval Surface Warfare Center – Detachment Bremerton. Retrieved from