Oceanographic Data with R: Plot VENUS Network Data

By Allan Roberts

This tutorial provides instructions on downloading raw data from the Victoria Experimental Network Under the Sea (VENUS 2012) and plotting that data with the statistical application R (R Core Team 2012). For this tutorial, I will assume that you have at least some experience with R; however, if you have R installed, and can enter an instruction or two on the command line, that should be enough. If you want to plot data from the NEPTUNE Canada network, refer to my previous post, “How to plot NEPTUNE Canada data with R.” In general, downloading VENUS data is similar to downloading NEPTUNE data, but I did find that there are some differences.

Step 1. Download a data file 

1.1 Go to the VENUS network website:                                     www.venus.uvic.ca

Venus logo

1.2 If you already have an account click on “LOGIN.” (Note: If you have a NEPTUNE Canada account you can use the same e-mail and password to log into the VENUS site.) If you don’t have an account, click on “Register”:


1.3 Click on “DATA” and choose “DOWNLOAD DATA”:

Download VENUS data

1.4 Under “Search Type” choose “Stationary Platform”:

Stationary platform

1.5 Under “Stationary Platform Data” choose “Search by Instrument”:

Search by instrument

1.6 There are gaps in the data record; for this example, I’ve chosen the last two weeks of August, 2012, as an example of a particular interval with available data. Under “Time Range” set the starting and ending date and time, and then click on “Search Active Locations”:

Search active locations

1.7 Under “Location” choose “Saanich Inlet”, “Central Node”, and “VIP-17.” I found these to be the default settings.


1.8 Under “Instrument” choose “Aanderaa Optode 4175 (S/N 1684).” (Again, I found this to be the default setting.)

Anderaa optode

1.9 Under “Sensor(s)” choose “Temperature”:

Select temperature

1.10 Under “Processing” choose “No Averaging”:

No averaging

1.11 Under “Data Format” choose “Comma Separated Value Text File”:

csv file format

1.12 Leave “Metadata” (i.e. documentation) at the default setting of “FGDC HTML”, and click on “Search now”:

Search now

1.13 Wait ….

Requesting data

1.14 Click on the text file….

Data file

… you should get something like this:

Data file output

1.15 Here is one place where I found that downloading VENUS data differed a bit from downloading NEPTUNE data. For the VENUS data, I’ve found that the following works: Copy and paste the downloaded data into a Word file, and then save that file as a plain text file. The plain text file is readable from R. To copy the VENUS data, click on “Select All” …

Select all

… then click on “Copy”:

Copy from Safari

1.16 Paste the file into a Word document. Click on “Save As”; make the document name “VENUS data example”; make the location your desktop, and make the format “Plain Text”:

Save as plain text

When you save as a text file you may get the following warning. (The idea of saving as a text file is that we are not interested in fancy formatting, pictures, etc., we are only interested in the data.) Click “OK”.

File conversion

The result should be a “.txt” file called “VENUS data example” on your desktop:

File icon on desktop

1.17 Create a new folder, called “VENUS network data”, and drop the text file “VENUS data example” into this folder.

VENUS network data

Now that you have the VENUS data saved as a “.txt” file in your “VENUS network data” folder, you are ready to move onto the next step: reading the data file into R.

Step 2. Read the data file into R 

The steps for changing the working directory are the same as in the NEPTUNE data tutorial:

2.1 In the R console type “getwd( )”. This will tell you what your current working directory is:


2.2 If you are on a Mac click on “Misc”, and choose “Change Working Directory”:

set working directory mac

If you are on a PC, click on “File”, and choose “Change dir …”:

set working directory pc

2.3 If you are on a Mac, browse for the “VENUS network data” folder, click on it, and click on “Open”; if you are on a PC browse for the “NEPTUNE data” folder, click on it, and click on “OK.”

2.4 In the R console, type “getwd( )”; the “VENUS network data” folder should now be your working directory:

wd again with correct wd

2.5 Open the text file, and look at it. We want to skip all the documentation lines before the first line of data. For this example, there should be 15 lines. This includes the line with the variable names. (The variable names are not yet formatted for R; variable names in R need to be without spaces.)

read file skip 15 lines header false

2.6 Check the downloaded data by entering “head(data)”; this will show the first few lines of the data frame. (To see all the data, just type ”data”, and press enter.)

show data

2.7 To give names to the columns, type:

give names to columns

Enter “head(data)” again, and you should see names at the tops of the columns. (For this tutorial, we are not concerning ourselves with the flag variable in the third column.)

data with labels

Now that the data have been downloaded, you are ready to move onto plotting …


Step 3. Plot the data 

3.1 For a rough plot of the data, type:

rough plot code

rough plot

3.2 To plot the data as a line graph with a title, and with better axis labels, we can use two steps. First: The following command will plot the data without axis labels, and make the graph a line graph in blue.

line graph code

Second: Leave the graphics window open, and enter a command to add the title and axis labels.

Add title line

You should get a graph like the one below. I’ve found that the easiest way to put a graph made in R into a written document or slide show is to click on the graphics window and then use copy and paste.

final graph

3.3 Now go explore the other data available from the VENUS network!


VENUS, 2012. Website. Last accessed Oct. 17, 2012: www.venus.uvic.ca

R Core Team (2012). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria.

4 thoughts on “Oceanographic Data with R: Plot VENUS Network Data

  1. Pingback: Network Data Host » Blog Archive » How to Plot VENUS Network Data with R | BMSC Student Blog

  2. Pingback: Fractal Graphics with R: Part 2 | BMSC Student Blog

  3. Pingback: The Octopus of Saanich | The Madreporite

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s