07.23.2008 17:57

SQLITE tutorial

I told Gwennie that I would give her a quick SQL tutorial. She is another mac user (there were many at the Phoenix Sience Operations Center... probably over 100 Macs at the SOC). So here it is and this assumes you are running on a Mac and are comfortable on the command line.

See also: http://www.sqlite.org/sqlite.html for a quick tutorial

First, the Mac comes with Sqlite3. You can use either the Mac one or the one from fink. They are pretty much equivalent.
% type -a sqlite3
sqlite3 is /sw/bin/sqlite3
sqlite3 is /usr/bin/sqlite3
Sqlite is a great database program to use when learning SQL. There is no database server to setup. It uses a file for the database and if you don't like what you did, just delete the file. Note, that sqlite2 and older use an ASCII database format and are really slow (and have very large db files). Let's get started!
% sqlite3 demo.db3
sqlite> SELECT 1+1;
2
sqlite> .quit
Not so exciting, but it is a start. You have to specify a file to use as the database, but if unless you do something to the database, it won't create the file. SELECT is the basic lookup command. You can do basic math with it. You can also get the current time.
sqlite> SELECT CURRENT_TIMESTAMP;
2008-07-23 22:33:56
Some quick SQL convention notes. SQL reserved words are typically done in all caps and comments start with '--'. SQL statements end with a ';'.

Now we need to make some tables so we can do something a bit more interesting. This makes a 3 column table. The .schema command lists the tables in the database.
sqlite> CREATE TABLE somedata (aNumber INT, aFloat REAL, aString VARCHAR(30));
sqlite> .schema
CREATE TABLE somedata (aNumber INT, aFloat REAL, aString VARCHAR(30));
Now put some data into the table:
sqlite> INSERT INTO somedata values (1, 1.001, "a first string");
sqlite> INSERT INTO somedata values (6, 42.000001, "another string");
sqlite> SELECT * FROM somedata;
1|1.001|a first string
6|42.000001|another string
If you want to write out a csv file that you can import into Excel or some other database, try something like this:
sqlite> .separator ", "
sqlite> .output foo.csv
sqlite> SELECT aFloat, aString FROM somedata;
sqlite> .quit
% cat foo.csv
1.001, a first string
42.000001, another string
% open .output foo.csv
The next thing to look at is WHERE to limit searches to a subset of the data.

Posted by Kurt | Permalink

07.23.2008 17:40

GMT is 20 years old

Hello GMT users-
.
GMT quietly passed a major milestone sometime earlier this month.  20
years ago (in early July 1988), Walter and I released GMT version 1.0
to an unsuspecting group of students and scientists at Lamont-Doherty
Earth Observatory.  The first years GMT was used mostly at Lamont but
slowly migrated to other places as graduating students and various
visitors took 9-track tapes with them to their new institutions.
.
The official global launch of GMT did not take place until October 8,
1991 with our EOS article; hence we will hold off on the wild parties,
logo competitions, and other nerd trivia until we get closer to the
official 20-year anniversary in 2011.  Stay tuned!
.
Cheers,
Paul Wessel, Walter Smith, and the GMT team

Posted by Kurt | Permalink

07.22.2008 09:03

ogg and Apple

Apple's iTunes on the Mac does not play ogg?!?! I'm having to run Audacity to play a podcast.

Also, the UNH IT team says that their VPN is not compatible with that in Mac OSX 10.5.
To the best of my understanding the Mac built in VPN will work with
generic PPTP VPNs or a Mac server IPSec VPN.  What we run on campus is a
Juniper SSL VPN.  The Mac's built in VPN software will not connect to
it.  It needs to connect via the web Browser.
This big move to Browser RAS does not thrill me.

And the UNH travel expense Excel spreadsheet does not seem to be compatible with MS Office 2008 for Mac.

Posted by Kurt | Permalink

07.21.2008 17:44

Mac - Hiding the dock and menu bar

From Jake and Kenny: How to hide the menu bar and Dock on a Mac. [macworld]
Have you ever wanted the ability to hide the Dock and/or the menu bar
on an application-by-application basis? That is, when you launch
iPhoto, the Dock is hidden, when you launch Google Earth both the Dock
and the menu bar are hidden? This can be useful when working on a
smaller screen with a program that requires most of the screen for its
visuals, or if you just find the Dock and menu bar are cluttering your
view of things.
.
While there are a number of third-party programs out that purport to
do just this- ASM and MenuShade come to mind - it's actually quite easy
to do yourself. It just takes a couple of simple edits in one file
within the given application.
...
I made a copy of the Stickies application on my desktop.
  % cd ~/Desktop/StickiesCopy.app/Contents
  % emacs -nw  Info.plist
Then add the lines that say 'HERE:'...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>LSUIPresentationMode</key>
  <integer>4</integer>
        <key>CFBundleDevelopmentRegion</key>
        <string>English</string>
        <key>CFBundleDocumentTypes</key>
  ...
</dict>
</plist>
And the options for that variable:
  • LSUIPresentationMode 1 - Hides Dock. Dock will appear if mouse moved to where it is located.
  • LSUIPresentationMode 2 - Removes Dock.
  • LSUIPresentationMode 3 - Removes Menu Bar and Dock.
  • LSUIPresentationMode 4 - Hides Menu Bar and Dock. Menu Bar or Dock will appear if mouse moved to where Menu Bar or Dock is located.

Posted by Kurt | Permalink

07.21.2008 09:23

NOAA RNC disruption

I'm not sure what this means yet. All caps as the USCG sends its announcements. Note to the USCG: Putting URLs in ALL CAPS is not going to work. Most web servers are case sensitive on the text after the host name.
SUBJ: INTERRUPTION TO RASTER NAVIGATIONAL CHART (RNC) DISTRIBUTION
A. COAST GUARD NAVIGATION STANDARDS MANUAL, COMDTINST M3530.2
(SERIES)
1. THE NATIONAL OCEANIC AND ATMOSPHERIC ADMINISTRATION (NOAA) HAS
ADVISED THE COAST GUARD THAT AS OF 15 JUNE 2008 THERE IS A
TEMPORARY INTERRUPTION TO THE STANDARD DISTRIBUTION OF RNC UPDATES
AND NOTICE TO MARINERS.  THIS INTERRUPTION COULD LAST UP TO TWELVE
MONTHS.  NOAA IS IN THE PROCESS OF UPGRADING THEIR CHART PRODUCTION
SYSTEM AND DECREASING THEIR RELIANCE ON THIRD-PARTY DISTRIBUTORS.
2. AS DISCUSSED IN REF A, THERE ARE FIVE TYPES OF CHART DATA
AUTHORIZED FOR COAST GUARD USE. THE ONLY DATA IMPACTED BY THIS
INTERRUPTION OF SERVICE IS RNC WHICH WILL AFFECT THE US EAST COAST,
US WEST COAST, US GULF COAST AND GREAT LAKES REGIONS.  C2CEN HAS
DETERMINED THAT THE FOLLOWING COAST GUARD NAVIGATION SYSTEMS AND
CUTTER CLASSES ARE HEAVILY DEPENDENT ON RNC DATA:
 A. COMDAC-INS (WMSL/WHEC/WMEC/WPB-110)
 B. CAPN VOYAGER (WHEC/WMEC/WPB-110/WLIC/WLI/WYTL/EAGLE/BUSL-49)
 C. VOYAGE MANAGEMENT SYSTEM (VMS) (WPC-179)
3. OUR CURRENT STANDARD IN REF A STATES THAT ELECTRONIC CHART DATA
IS CONSIDERED UP-TO-DATE IF IT HAS BEEN CORRECTED WITHIN THE LAST
FORTY-FIVE DAYS. CURRENT RNCS DISTRIBUTED BY MAPTECH WILL PROVIDE
CUTTERS WITH UP-TO-DATE CHARTS THROUGH JULY 2008.
4. NOAA OFFICIAL ELECTRONIC NAVIGATION CHARTS (ENC) ARE THE MOST
UP-TO-DATE ELECTRONIC CHARTS AVAILABLE AND ARE THE PREFERRED CHART
BASED ON THE HIERARCHY DISCUSSED IN REF A.  ENC CHARTS AND UPDATES
ARE AVAILABLE FOR FREE DOWNLOAD AT
HTTP://NAUTICALCHARTS.NOAA.GOV/MCD/ENC/INDEX.HTM.
...

Posted by Kurt | Permalink

07.18.2008 12:03

Free online google earth NOAA charts for continental US

http://freegeographytools.com/2008/us-nautical-chart-overlay-for-google-earth

http://navimatics.com/maps.aspx

Make sure to zoom way into an area or you will only see the bounding boxes.

Posted by Kurt | Permalink

07.18.2008 07:52

TWIC and foreign students on ships

In the case of TWIC cards for Research Vessels, I really wonder what the DHS was thinking. Their cost-benefit model must be 'interesting'.

Quick Takes: Pentagon Pledges to Limit Restrictive Contracts, Oceanography Students Declared Not to Be Threat... [Inside Higher Ed]
The U.S. Department of Homeland Security has agreed to lift the
designation of some foreign graduate students in oceanography as a
security threat. The designation prevented the students, enrolled at
the Massachusetts Institute of Technology, many from countries
considered close U.S. allies, from doing certain research work in
harbors. While officials at MIT and other universities have called the
designations absurd, the government didn't lift them until asked to do
so by Rep. Brad Miller, chair of the Investigation and Oversight
Subcommittee of the House Science and Technology Committee. Miller
released various letters on the matter, praising the lifting of the
classification and calling on the government to take steps to avoid
hindering graduate students in similar situations.
And interesting read to go with this: Homeland Security Cost-Benefit Analysis [Schneier on Security]
The Pentagon has issued a policy statement that contracts for research
with universities should not generally have restrictions on
disseminating research findings unless the research is classified.
...
Now we need to keep some sense as to what is classified vrs unclassified. I've experience people putting unclass data on the class networks expecting me to get it from there. Um, no!

Posted by Kurt | Permalink

07.17.2008 09:53

Neptune LNG terminal construction

Work begins on 2nd local off-shore LNG site [NewburyportNews.com]
...
Carrying the 170 workers of Caldive, the global sea drilling company
from Quincy, the live-on construction barge Lone Star Horizon is now
in position for the project. It was towed out Tuesday night for Suez
Energy North America, according to company spokeswoman Carol
Churchill.
.
The site of the terminal - named Neptune - was challenged by the
fishing community, which objected to the loss of fruitful waters to
the energy industry, but then-Gov. Mitt Romney authorized the LNG
terminal on the site in December 2006. He also approved a second
terminal site to the south that has been built and began receiving the
tankers last month.
.
The Neptune site will consist of a buoy system at which the LNG
vessels will moor and discharge natural gas by using onboard
vaporization equipment, according to Suez Energy. The natural gas will
be transported via a 13-mile pipeline connecting to the existing
pipelines through Salem.
...
http://www.neptunelngconstruction.com/ by SUEZ
...
Neptune will implement vessel restrictions, including:
    * Speed restrictions to avoid striking marine mammals and sea turtles;
    * Downward lighting to minimize light attracting sea birds at night; and
    * Vessel shutdowns in the event of a marine mammal sighting.
During construction, two marine mammal observers (MMOs) are on duty on
each construction vessel 24 hours a day, seven days a week, to
visually monitor for the presence of marine mammals and sea
turtles. At night, the MMOs use infrared scanning devices to monitor
for the presence of marine mammals and sea turtles in the construction
area. In addition to visual observations, Neptune has installed a
series of acoustic buoys in the construction area that automatically
monitor for the presence of the endangered North Atlantic right
whale. If a right whale is detected, the MMOs are notified
immediately, and vessels will be placed on heightened alert.
...

Posted by Kurt | Permalink

07.16.2008 09:39

Phx Robotic Arm

I've headed away from the Phoenix project and am now back in the world of NOAA. However, I am still paying attention to the mission. Phoenix is a fantastic mission from a science perspective.

NASA: Robotic arm on Mars Lander shuts down to save itself - As weather window starts closing, scientists move to fix problem and speed up tests
...
After receiving instructions for a movement that would have damaged
its wrist, the robotic arm recognized the problem, tried to rectify it
and then shut down before it could damage itself, according to Ray
Arvidson, a co-investigator for the Mars Lander's robotic arm team and
a professor at Washington University in St. Louis.
.
NASA engineers yesterday worked to send new instructions to the Lander
so the robotic arm would come back to life and proceed with a new set
of instructions. The team is now waiting to see whether the code
resolved he problem.
...

Posted by Kurt | Permalink

07.16.2008 09:24

NOAA Tides Course

After my little exploration into tides I need to read up on tides. NOAA has an online course. This is a quick overview that will help people get at least the basics.

Tides and Water Levels


Posted by Kurt | Permalink

07.15.2008 11:08

Vessel Noise journal paper

Our latest paper is just out:

Hatch, L., C. Clark, R. Merrick, S. Van Parijs, D. Ponirakis, K. Schwehr, M. Thompson, D. Wiley, Characterizing the Relative Contributions of Large Vessels to Total Ocean Noise Fields: A Case Study Using the Gerry E. Studds Stellwagen Bank National Marine Sanctuary, Environmental Management, May 2008.
In 2006, we used the U.S. Coast Guard's Automatic Identification
System (AIS) to describe patterns of large commercial ship traffic
within a U.S. National Marine Sanctuary located off the coast of
Massachusetts.  We found that 541 large commercial vessels transited
the greater sanctuary 3413 times during the year. Cargo ships,
tankers, and tug/tows constituted 78% of the vessels and 82% of the
total transits. Cargo ships, tankers, and cruise ships predominantly
used the designated Boston Traffic Separation Scheme, while tug/tow
traffic was concentrated in the western and northern portions of the
sanctuary. We combined AIS data with low-frequency acoustic data from
an array of nine autonomous recording units analyzed for 2 months in
2006. Analysis of received sound levels (10-1000 Hz, root-mean-square
pressure re 1 lPa ± SE) averaged 119.5 +/- 0.3 dB at high-traffic
locations. Hightraffic locations experienced double the acoustic power
of less trafficked locations for the majority of the time period
analyzed. Average source level estimates (71-141 Hz, rootmean- square
pressure re 1 lPa ± SE) for individual vessels ranged from 158 ± 2 dB
(research vessel) to 186 +/- 2 dB (oil tanker). Tankers were estimated
to contribute 2 times more acoustic power to the region than cargo
ships, and more than 100 times more than research vessels. Our results
indicate that noise produced by large commercial vessels was at levels
and within frequencies that warrant concern among managers regarding
the ability of endangered whales to maintain acoustic contact within
greater sanctuary waters.
pdf

Posted by Kurt | Permalink

07.14.2008 14:09

Neptune deepwater port

Official vows LNG pipeline work will not interfere with Race Week
...
Neptune, which is owned by parent company Suez Energy, is building a
deepwater port approximately 10 miles off the coast of Gloucester. It
will consist of a buoy system where LNG vessels will moor and
discharge natural gas by using onboard vaporization equipment. The
13-mile-long sub-sea pipeline that will cross into 0.36 miles of state
waters under Marblehead's jurisdiction will be used to tie into the
existing Spectra Energy pipeline system's HubLine, which will deliver
the natural gas to consumers in Massachusetts and throughout New
England.
...

Posted by Kurt | Permalink

07.11.2008 10:06

Phx update

Progress on the Phoenix Mission Success Panorama
...
Scientists have totally different goals for their data. As much as we
love the images from spacecraft, the cameras are not there to send us
pretty pictures. They are there to send us data. Each pixel in an
image is a number, a measurement of how many photons of a certain
wavelength range of light reached the camera detector. When scientists
process images, they are very, very careful about what they do with
those numbers. What the amateurs do to blend images together -- to a
scientist, that's fudging the data. Not that the scientists dislike
what the amateurs do -- in fact I have seen in many operations
facilities where science teams have printed out the image products
produced by amateurs and posted them on their walls!
...

Posted by Kurt | Permalink

07.09.2008 14:37

phx updates

hoenix sol 43 update: Lots of imaging, hacking at Snow White, first touch for TECP, and more by Emily Lakdawalla [Planetary Society blog]
...
* The Mission Success Panorama is, as of this morning, complete --
  that is, all the data bits are on Earth. Work still remains to
  assemble it, and Mark has some ideas for things he'd like to shoot
  again to improve it, but we can now assemble a full, 360-degree
  panorama of all of Mars that Phoenix can see in full color.
* A tiny sample was delivered to the Optical Microscope on sol 38
  ("tiny" was what they requested). They had to wait a couple of sols
  for the wet chemistry lab to be ready (done with its first
  analysis), and then delivered everything else that was in the scoop
  to the wet chemistry lab on sol 41. Mark says that delivery was
  "perfect."
* The Thermal and Electrical Conductivity Probe (TECP) on the robotic
  arm finally touched soil on sol 43. The team is "excited to finally
  have that in play."
...


Fast-Track Phoenix Mars Ice Test [Aviation Week]

I don't believe that Phx has rasped yet other than to do sprinkles... so I don't think this is right (at least not quite yet)
...
Phoenix also was commanded to rotate the scoop into a third position -
this time to place the drill-like rasp on the backside of the scoop
against the ice. The rasp, just like an ice carver would use on Earth,
then rotated several times per minute to scrape additional shavings
out of the ice. The arm was then commanded to heap the scrapings into
piles, each with 10-20 cu. cm. of ice mixed in with the soil. This
equates to between two and four teaspoonfuls of ice in each pile.
...


Mars Lander Runs into Tough Digging [space.com]
...
or the past day, Phoenix has been using its robotic arm to scrape away
at a hard icy surface on the red planet, trying to claw enough dirt
out to pour into its onboard instrument. So far, it has only
accumulated small piles of shavings, which it has not been able to
scoop into the oven.
...

Posted by Kurt | Permalink

07.08.2008 12:20

Presentation on the big screen

Today we did another presentation on the big screen for a group of technical people visit the SOC here in Tucson. I sit in the back running Apple Remote Desktop (ard) to a 8 core intel mac with three ATI Radeon HD 2600 XT graphics cards with 256MB of VRAM each. I am definitely not pushing these cards the slightest with my series of still images.


Posted by Kurt | Permalink

07.07.2008 20:14

cowsay

We had a training session today and I learned a new (old really) unix command that is in fink...
% fink install cowsay
% cowsay -f moose "Welcome to New England"
 ________________________ 
< Welcome to New England >
 ------------------------ 
  \
   \   \_\_    _/_/
    \      \__/
           (oo)\_______
           (__)\       )\/\
               ||----w |
               ||     ||

Posted by Kurt | Permalink

07.07.2008 09:29

Papahanaumokuakea marine sanctuary

The new Papahanaumokuakea managment plan... this is the only mention of AIS.
Activity EN-2.3: Integrate additional automated monitoring systems and
ship reporting systems for all vessels transiting the Monument.
.
Existing automated monitoring / ship reporting systems will be
utilized for vessels transiting the monument and that are so
equipped. Many "larger" vessels are required to carry and utilize
Automated Identification Systems (AIS). As mandated through the
Maritime Transportation Security Act (MTSA), the use of Automatic
Identification Systems (AIS) is required on all commercial vessels
greater than 65-feet. As USCG and Naval researchers develop and expand
the systems to collect, manage (sort) and distribute this information
through shore based and satellite technologies, its use will be an
effective tool to monitor ship traffic within and around the monument.


Does the following mean AIS, LRIT, or what?
* 404.5 Requirements for a vessel monitoring system.
.
(a) Requirement for use. Effective August 28, 2006, an owner or
operator of a vessel that has been issued a permit for accessing the
Monument must ensure that such vessel has an OLE approved, operating
VMS on board when voyaging within the Monument.  An operating VMS
includes an operating mobile transmitting unit on the vessel and a
functioning communication link between the unit and OLE as provided by
an OLEapproved communication service provider. Appendix B to this part
404 provides information regarding OLEapproved transmitting units.


(b) Installing and activating the VMS. Only a VMS that has been approved by OLE may be used. When installing and activating the OLE-approved VMS, or when reinstalling and reactivating such VMS, the vessel owner or operator must: . (1) Follow procedures indicated on an installation and activation checklist, which is available from OLE; and (2) Submit to OLE a statement certifying compliance with the checklist, as prescribed on the checklist. . (c) Interference with the VMS. No person may interfere with, tamper with, alter, damage, disable, or impede the operation of the VMS, or attempt any of the same. . (d) Interruption of operation of the VMS. When a vessel's VMS is not operating properly, the owner or operator must immediately contact OLE, and follow instructions from that office. If notified by OLE that a vessel's VMS is not operating properly, the owner and operator must follow instructions from that office. In either event, such instructions may include, but are not limited to, manually communicating to a location designated by OLE the vessel's positions or returning to port until the VMS is operable. . (e) Access to position data. As a condition of authorized access to the Monument, a vessel owner or operator subject to the requirements for a VMS in this section must allow OLE, the USCG, and their authorized officers and designees access to the vessel's position data obtained from the VMS. Consistent with other applicable laws, including the limitations on access to, and use of, VMS data collected under the Magnuson-Stevens Fishery Conservation and Management Act, the Secretaries may have access to, and use of, collected data for scientific, statistical, and management purposes. . (f) Authority for installation and operation. OLE has authority over the installation and operation of the VMS unit. OLE may authorize the connection or order the disconnection of additional equipment, including a computer, to any VMS unit when deemed appropriate by OLE. . (g) Activities Regarding Vessel Monitoring Systems. Effective August 28, 2006, the following activities regarding vessel monitoring systems are prohibited and thus unlawful for any person to conduct or cause to be conducted: . (1) Operating any vessel within the Monument without an OLE typeapproved mobile transceiver unit described in this section; (2) Failing to install, activate, repair, or replace a mobile transceiver unit prior to leaving port; (3) Failing to operate and maintain a mobile transceiver unit on board the vessel at all times as specified in this section; (4) Tampering with, damaging, destroying, altering, or in any way distorting, rendering useless, inoperative, ineffective, or inaccurate the VMS, mobile transceiver unit, or VMS signal required to be installed on or transmitted by a vessel as specified in this section; (5) Failing to contact OLE or follow OLE instructions when automatic position reporting has been interrupted as specified in this section; (6) Registering a VMS or mobile transceiver unit to more than one vessel at the same time; (7) Connecting or leaving connected additional equipment to a VMS unit or mobile transceiver unit without the prior approval of OLE; and (8) Making a false statement, oral or written, to an authorized officer regarding the installation, use, operation, or maintenance of a VMS unit or mobile transceiver unit or communication service provider.

Posted by Kurt | Permalink

07.06.2008 23:06

4th of July

This year, I spent the 4th with much of the Phx team up at Jerry's. Rob and I had a combined birthday. No good fireworks pics this year, but I did get this of the pool and city lights.


Posted by Kurt | Permalink

07.06.2008 22:55

biosphere 2

This morning, I paid a visit to the Biosphere 2 build and took the tour. Here is the typical view of the main room. It's a lot bigger than I was expecting. This is quite the enigneering feat.



Check out the wild structure that supports the building.



The rain forest is very impressive.



There be monsters outside.



Luckily the biospherians had an airlock to protect them from the outside:



Definitely worth the trip.

Posted by Kurt | Permalink

07.06.2008 22:19

Another TV crew

We had another camera crew come through the operations center today. This group had a large boom/crane for their camera.


Posted by Kurt | Permalink