Adding NOAA bottom profile to section plots01 Apr 2017
I use the
section-class plotting method in the
oce package a lot. It’s one of the examples I really like showing to new oceanographic users of R and
oce, to see the power in making quick plots from potentially very complicated data sets. A canonical example is to use the built-in
Note the grey bottom profile that is automatically overlaid on the plot – the values for those points come from the individual stations in the
section object, from the
waterDepth metadata item in each of the stations in the section. The values can be extracted to a vector with our trusty friend
However, many CTD datasets don’t automatically include the water depth at the station, and even if they do the large spacing between stations may make the bottom look clunky.
marmap package to add a high res bottom profile
To add a nicer looking profile to the bottom, we can take advantage of the awesome
marmap package, which can download bathymetric data from NOAA.
To add a nice looking bottom profile to our section plot, we can use the
get.depth() functions. Note the
resolution=1 argument, which downloads the highest resolution data available from NOAA (1 minute resolution), and the
keep=TRUE argument, which saves a local copy of the data to prevent re-downloading every time the script is re-run (note that at 1 minute resolution the csv file obtained below is 29 MB):