MB-System Basic Plotting

(From my old blog, but a post that I like to go back to…)

Here’s how I put together a rough bathymetry plot of a couple of survey areas, overlaid with the track lines.

1) Created a list of the files that I wanted to plot. I got this from one of Kurts blog posts from the Revelle:

ls *_raw.all | awk '{print $1, 56}' > PatchLines

I’ve never used Awk before. I felt some guilt in just blindly copying Kurt’s Awk command – it felt like cheating. But it would have taken me a long time to figure out some alternative: either do it in Python or Bash or Matlab or something (time consuming), or figure out enough Awk that I could understand how to construct this command myself (ugh, even MORE time consuming). So I just blindly copied.

2) Used the MB-System command mbm_plot, which takes some arguments, and then creates an executable script that generates a GMT plot of the bathymetry.

mbm_plot -F-1 -IPatchLines -N -G1 -W1/2 -Z1050/2100

The -F is the format. I set it to a negative number to tell the program to look into the list of files in the PatchLines file (generated in step 1).

The next argument, -I gives the name of the file containing the list of files, along with the file identifier.

-N gets the tracklines on the plot.

-G1 generates color filled bathymetry data

-W1/2 tells the program to to use continuous color shading (instead of discrete), and I specified color palette 2 (high intensity colors)

-Z1050/2100 says that the depth color scale goes from 1050m to 2100m.

3) The previous step generated PatchLines.cmd. I run this using ./PatchLines.cmd, and wind up with a Patchlines.ps postscript file. Here’s the final product, bearing in mind that it is completely raw data (no corrections, no cleaning, no sound speed corrections, nothing):

And one from the grid survey:

Auto-commenting Latex files in Aquamacs

Yet another reason why I love Aquamacs… I love being able to do this in Matlab (Ctrl-T/Ctrl-R), but it always bugged me that I couldn’t figure out how to do this quickly while editing scripts in Emacs.  I still don’t know how to do it in plain old Bash emacs, but I did find out how to do it in Aquamacs:

ctrl-c ;

This toggles between commenting and uncommenting. I still haven’t checked to see if I can do the same thing in Aquamacs with Python files. I suspect there’s a way. (actually I suspect there’s a way in command line emacs as well, I just haven’t found it).

SQLite configuration file

I just created a simple configuration file for SQLite. It’s in my home directory, and is called .sqliterc. It contains the following lines:
[sourcecode language=”bash”]
# SQLite configuration file
.echo ON # repeat every command
.header ON # print column names
.separator “t” # change default separator to tab
.nullvalue “Null” # print the word “Null” rather than having empty fields
[/sourcecode]

Now, every time I start SQLite, these commands will be run.

* Thanks to Kurt, who showed me how to do this!

bzippin’

So, here’s another one of my posts where I describe how to do a painfully easy thing, simply because it’s the first time I’ve ever done it. Today it’s How to Compress a File Using bzip2!

SO EASY:

bzip2 [-options] [filename]

Options are described here. But if you are not worried about options and want to use the default, it’s this easy:

bzip2 superfile.foo

Unzipping is easy too:

bunzip2 superfile.foo.bz2 or bzip2 -d superfile.foo.bz2.