UH LADCP computers are generally going to be
a recent version of Ubuntu Linux
configured as UHDAS PCs with associated software
- gcc, python
- netpmb libraries
- numpy, basemap, matplotlib
- all UH programs (repositories + topography)
- matlab
LADCP user is science
You should be familiar with the following aspects:
- Setting up for a new cruise
- Permanent directory layout
- Serial Ports
- Networking
- Computer clock
- External disks and backups (USB disk, USB key, CD, firewire)
- Automount and nfs
- Samba (Windows Shares)
- Exporting a disk with nfs
- Unix hints
This step may already be done:
# on the processing computer
ladcp_newcruise.py CLIVARNAME processing
# on the logging (acquisition) computer
ladcp_newcruise.py CLIVARNAME logging
where CLIVARNAME is the name of the new cruise to be set up.
You should choose a name that includes the year and the CLIVAR leg if needed. In other words, a clever name! Past examples are:
P16S_2006
P16N_2006leg1
I8S_2007
I6S_2008
I5_2009
The command new_cruise.py will create in /home/science:
current_cruise and current_cruise_logging are symbolic links to CLIVARNAME and CLIVARNAME_logging, respectively. You can work in either of them.
The processing directory CLIVARNAME (and its symbolic link current_cruise) contains many subdirectories:
data
data/ladcp
data/ctd_timeseries
data/ctd_2db
data/gps
data/shipboard_adcp
scripts
proc
proc/ladcp_uh
proc/ladcp_ldeo
proc/ladcp_ldeo/checkpoints
proc/ladcp_ldeo/processed
docs
docs/shipping
docs/logsheets
docs/cruise_reports
web
web/profiles
web/qc_plots
web/index.txt
web/index.html
web/sections
web/vector
The acquisition directory CLIVARNAME_logging (and its symbolic link current_cruise_logging) contains these files:
wh150.cmd
wh300.cmd
ladcp_wh150.py
ladcp_wh300.py
The first two contain default parameters for the two LADCP instruments. These files should not need to be modified. The next two files are python programs that run the acquisition software to communicate to the LADCP instrument. See Data Logging Programs for details.
The home directory of the LADCP operator, /home/science/, should also contain permanent directories, NOT TO BE CHANGED. If they do not exist, make them. Recommended:
directory : contains
--------- : ----------------------------------
/home/science/docs : documentation files for this computer
: provided for the science user
: These include cruise writeups and
: files related to earlier cruises
: that one might want to access.
: Files are stored by cruise name
/home/science/docs/CLIVARNAME : contains the "docs" subdirectory of
: the cruise CLIVARNAME. Specifically:
: - cruise_report
: - log_sheets
: - shipping
/home/science/scripts : possibly useful scripts, named by cruise
When ladcp_newcruise.py is run (to make a processing or a logging directory), the following symbolic links are also made. Do not alter them. The ladcp_newcruise.py program will manage these links:
##-- symbolic links --##
/home/science/web : skeleton pointing to current_cruise/web
: (for sharing figures and data).
/home/science/current_cruise : current cruise processing directory
/home/science/current_cruise_logging : current cruise acquisition directory
It may also contains the cruise directories of previous cruises and some personal ones. If you want to make your own personal ones simply:
mkdir my_personal_dir
in /home/science/.
Older laptops may have a built-in serial port (“db9” 9-pin male port on the back of the computer). Newer laptops do not have serial ports built in; one must use an adapter. We will usually use a USB-serial adapter for communication with the LADCPs, one port per LADCP is needed. At present, ‘keyspan’ devices do not work; we are using Prolific or FTDI chips (eg. one-port devices by “trendnet”)
ports physically set in program
----- ------------ ----------------
ttyUSB0 USB-serial ladcp_wh300.py, ladcp_wh150.py
ttyS0 built in ladcp_wh300.py, ladcp_wh150.py
To know which serial port is needed, plug in the device and type
ls -ltr /dev/tty* | tail
The list is ordered chronologically with the last line giving you the port of the most recently plugged device. Each port of a multiple-port USB-serial device will be listed; notice that, in this case, the port numbers in the list start from 0 (USB0, USB1, etc) while the port numbers written on the USB-serial device usually start with 1.
There will be
Every ship has a different networking scheme, different requirements and limitations, and they evolve. Usually, “plug into the network, wait, and it will find a number”. This is called DHCP. This computer will keep the number as long as it is booted, and sometimes even if you reboot or take it off the network for some time. You may have to give the MAC address to the computer tech before you can get a number.
Use the command “ifconfig eth0” to get the MAC address (HWaddr, below) and to to see what the IP number is, for example:
eth0 Link encap:Ethernet HWaddr 00:0C:29:1F:5B:CB
inet addr:172.20.101.247 Bcast:172.20.255.255 Mask:255.255.0.0
The number here is 172.20.101.247 and to access the account science using ssh, you will use:
ssh science@172.20.101.247
With a proper DHCP network and appropriate settings in the computer you should be able to refer to the machine by its name (run hostname on the computer) with ”.local” appended. Example: if the processing computer is called “artoo” you can access it from another computer using artoo.local. If no other unix computer knows this one by name, you’ll have to work with the number.
If you want to deal with a name instead of the IP number during the cruise, open /etc/hosts/ and add a line with the IP address followed by the name of computer. Example: 172.20.101.247 artoo. Notice, however, that this method will work only during the cruise.
If you must change network settings, use the network icon in the task bar or possible “network” under “system”. (This changes in ubuntu from version to version). Click or unclick the appropriate box, change settings, wait 10 seconds or more for those changes to take effect. There is usually some kind of message indicating that it’s thinking. You may need to reboot.
The computer clock should be set to UTC. For some computers this means choosing a time zone called Rejkavik (they are on UTC and evidently don’t use daylight savings time)
It is important that the computer clock be close to UTC time. It should not be off by more than 1 second when an LADCP cast starts. That can be accomplished by:
- manually setting the clock before each cast
- setting the computer to look for the time using an NTP server.
Setting the NTP server
The file /etc/ntp.conf has a line that says “server”. Use “sudo” and edit it to use the local time server on the ship. In this example the time server is 128.171.154.123
Ask the computer tech on the ship for the NTP server’s IP number.
# You do need to talk to an NTP server or two (or three).
server 128.171.154.123
sudo /etc/init.d/ntp restart
ntpq -p
You should see something like this:
remote refid st t when poll reach delay offset jitter
===============================================================================
*ticktock 128.171.154.123 2 u 54 64 337 214.323 3.906 2.355
Manually setting the clock
Go to the clock icon and right-click. Follow your nose.
Computer should be set to UTC (Reykjavic works)
On most of our Ubuntu laptops, if you plug in a USB disk while you are logged in, it will automatically mount. You will see an icon appear on the desktop. You must manually unmount it before unplugging it from the computer or you risk damaging the data.
Automatic mounting is done by the window manager (XFCE) and the File Browser it uses (“Thunar”). Unfortunately sometimes it is very difficult to tell from the icons whether an external disk is mounted (or even attached).
Unmount by one of these means:
- right-click the icon; select “safely remove”; wait till it’s ready, unplug.y
- bring up a file browser; click the ‘eject’ icon near the disk; wait till it’s ready, unplug.
- on the command line, type “sudo umount /media/usbdisk” (or whatever it’s called). Type “df” to make sure it’s not on the list. unplug when unmounted.
All data should be on two media as soon as practical. Do not delete anything you care about until there are two copies.
During the cruise, you should have one external disk called (for example) AC_backup for the acquisition computer. The acquisition software (ladcp_wh300.py or ladcp_wh150.py in the current_cruise_logging directory) is configured to copy the data there after the LADCP data are downloaded.
See this section for more information about partitioning and formatting a disk for linux.
A service called “automount” is also installed. This allows automatic mounting of various other kinds of disks. Specifically, in /etc/auto.master, a line is uncommented allowing automatic mounting of disks shared with nfs. This means that, for example, if you can ping the uhdas ADCP computer by name, (called “currents”) then you should be able to access its nfs shares as
/net/currents/home/data
/net/currents/home/programs
/net/currents/home/adcp
If you need to mount an nfs share without automount, make a mount point (as root), eg “/mnt/tmp”, and mount it as
mount currents:/home/data /mnt/tmp
Read the man page on mount for more info.
Disks are sometimes shared using samba, to make life easier for people with Windows or Macs. Linux can mount samba-shared disks using the smbfs filesystem type, but the command can get rather long. Read the man page for smbmount. Samba mount must be done as root or using the “sudo” command. One example that worked is
sudo mount -t smbfs -o username=guest,password=,workgroup=tgt//p16n/P16N\ Shared /mnt/p16n-ctd
In this case,
- the samba-shared disk is “p16n”
- the disk is “P16N Shared”
- the user is guest
- there is no password
- the workgroup is tgt
- the disk is being mounted as /mnt/p16n-ctd
If you have problems with permissions, you may need to be root
uid=51077,gid=1076
You can edit the file /etc/exports to share a disk via nfs. This example is from “currents” and shows the read-only export of three directories:
# /etc/exports on "currents"
/home/adcp *(ro,async)
/home/data *(ro,async)
/home/currents *(ro,async)
#
To make this active, type
sudo exportfs -r
Computers configured for LADCP acquisition and processing will also export /home/science read only to all, so backing up from the acquisition PC to the processing PC is easy (see (3) Copy LADCP data from the acquisition computer)
If you want to export a particular disk for read-write access (for example, export /home to the processing computer, whose IP number is 192.168.2.123)
# /etc/exports on the acquisition PC"
/home 192.168.2.123(rw,async)
#
To make this active, type
sudo exportfs -r
This link has some common unix commands.
Two other useful things:
Convert a postscript file to a png file
To convert a .ps or .eps file into a .png file, use one of the following (comments preceeded by “#”)
convertps.py file.ps # written at UH (better graphics)
convert file.ps file.png # part of the system
enscript -p logsheet.ps logsheet.txt
# smaller font
enscript -p logsheet.ps -f courier10 logsheet.txt
Then you can print logsheet.ps with lpr logsheet.ps