Wednesday, November 14, 2007

Sample movie for GETM

Here is a sample script for generating a series of figures (that can be turned into a movie with ffmpeg, see [below](http://pong.tamu.edu/~rob/?p=100)). The case used is the box_curvilinear test case.

Wednesday, October 31, 2007

How to make screen movies w/voiceover.

People have asked me how I make my HOWTO movies, like [this one](http://pong.tamu.edu/~rob/movies/roms_project.mov). The good news is that it is ridiculously simple.

python gets some love from Leopard

[It seems](http://www.cmlenz.net/blog/2007/10/python-on-leopa.html) that Mac OS X Leopard has quite a few excellent features installed by default. Including numpy!

Monday, October 15, 2007

Unix things I did not know..

Some interesting unix commands I recently discovered: xargs and seq. With these you can do this, for example:

Find all of the files named foo, and create a tar file:

find . -name foo | xargs tar cvfz tarfile.tar.gz

Iterate through your cluster nodes:

for i in `seq 0 7` ; do scp foolib c0-$i:/usr/local/lib ; done

Monday, October 8, 2007

movies from sequences of files.

Based on some advice I found [here](http://electron.mit.edu/~gsteele/ffmpeg/), I discovered how to make high quality movies from series of png files using [ffmpeg](http://ffmpeg.mplayerhq.hu/). I use png files because they have a high color depth (unlike 256 for gif), and they are non-lossy (unlike jpg).

First you need to make a sequence of _ordered_ files that have filenames like frame\_001.png, frame\_002.png, etc. For example, in python's matplotlib, you would have a line like:

saveframe('frame_%03d.png' % framenumber)

Then, you need to run ffmpeg on all of these files. The command is quite simple:

ffmpeg -r 10 -sameq -i frame_%03d.png test.mp4

where the -r flag sets the frames per second. Otherwise, the only other key option is the -sameq flag, which keeps the same non-lossy quality of the png files. Pretty easy. Also, you don't need to install xvid or h264 libraries for this to work. The codecs that come with ffmpeg seem to work just fine.

Also, the size of the resulting movie file is quite reasonable. I tested 121 frames at 1000x600 (with considerable non-changing space in the field). The resulting movie was 2.8M big. This is about seven times smaller than simply concatenating all of the images together. Not too bad.

Sunday, October 7, 2007

public access large-scale model data

This may not be new news, but it was a good find. Here is a very extensive archive of publicly available model output. This could be used, for example, for regional model boundary conditions:

[http://apdrc.soest.hawaii.edu/dods/public_data/](http://apdrc.soest.hawaii.edu/dods/public_data/)

An example python script for making a movie of ssh in the Indian ocean from the Navy Layer Ocean Model is found after the fold

Sunday, August 26, 2007

Working with roms projects

Here is a [movie](http://pong.tamu.edu/~rob/movies/roms_project.mov) [~200 Megs] showing how to download ROMS using subversion, and start a project.

Tuesday, August 14, 2007

SAGE for symbolic mathematics

[SAGE](http://www.sagemath.org/) is a symbolic mathematics solver, based in python. I have compiled it, and done some simple test cases, and it seems to work well. This may be a good, free alternative to Mathematica for doing simple analytic solutions.

Universal gfortran

The folks over at R (the statistical programing language) have developed a [universal gfortran](http://r.research.att.com/tools/), installed with a normal Mac installer (unlike the version over at [Mac HPC](http://hpc.sourceforge.net)). It has been used to compile universal binaries for [scipy](http://www.scipy.org) successfully, so this seems like a good option to use.

Wednesday, June 27, 2007

Getting more out of the Terminal in mac os X

I like to have specific terminal settings for my remote machines. Here are the steps I take in getting a nice, easy-to-use window for remote machines:

- First of all, open a new terminal window
- Control-click in the window, and select 'Window Settings'
- Select 'Processes' and click on 'Never' for prompt before closing a window.
- Select 'Color' and change the color you like -- I prefer a unique color for each remote machine, and I try to pick light colors, so that black text shows up well.
- Optionally, set the transparency. I like to use about 90% transparency. That way, I can see through my stack of terminal windows to find what is underneath.
- If you haven't already done so, go to the 'Display' window, and at the very least select 'anti-aliasing' for the fonts. Also, select a nice mono-spaced font. Monaco is fine, but there are other good ones. I usually set the fonts and transparency beforehand and save this as the default for all windows.

Now, you are ready to save this setup. Close the Terminal Inspector, and hit 'Save As..' in the File menu. Pick a name, the name of your machine probably, and then in the dialog below, click on Execute this command, and uncheck 'Execute command in a shell'. The command I use is something like this:

ssh -Y machine.tamu.edu

The -Y flag turns on X11 forwarding. You could also set any other ssh options here, like a cypher, or whatever.

Now you can open this window right away from the Terminal File -> Library menu. Or, even better, you can use quicksiler to open these term files. Just start typing the name of the host, and it will pop up as host.term.

Wednesday, May 30, 2007

myMPI

Recently linked at [MacResearch](http://www.macresearch.org/) is a new python mpi module [myMPI](http://peloton.sdsc.edu/~tkaiser/mympi/). This looks interesting, because unlike [pyMPI]( http://pympi.sourceforge.net/), myMPI is a module.

Friday, April 20, 2007

MarsEdit markdown test.

This is a test of MarsEdit's Markdown capabilities. Why use Markdown?

- It's easier to write
- It's easier to read the source

This is some code:

def rot2d(x, y, ang):
'rotate vectors by geometric angle'
xr = x*cos(ang) - y*sin(ang)
yr = x*sin(ang) + y*cos(ang)
return xr, yr

So, check out [this link](http://www.red-sweater.com/blog/324/marsedit-markdown), or see how [Markdown syntax works](http://daringfireball.net/projects/markdown/syntax).

Wednesday, April 11, 2007

PyQwt5 -- another plotting package for numerical python

Although matplotlib is the standard 2D plotting tool for numerical python, PyQt5 looks like an interesting alternative. Although the graphics appear to be more geared toward on-screen display, it is also (supposedly) very fast, so it might be a good platform for real-time data analysis.

Tuesday, April 10, 2007

Setting up Parallels to read a serial port

I need to set up parallels to run windows so that I can use software (windows only) that came with my RBR-620 CTD. The solution is much easier than some of the hints found on the web. Simply install the USB to RS232 drivers in windows, and then allow parallels to see the device by checking the appropriate device in the 'Devices -> USB' menu. That's it.

Just make sure to turn it off again when you want to use the port on the Mac side, as they don't share devices well..

Tuesday, March 20, 2007

serial ports and Mac os X

It is pretty straightforward to add a serial port to your Mac using a serial to RS232 converter. I bought a USBG-232 converter from usbgear, that has a foot cable, and lights so you can check the connection at the hardware level.

Don't bother with the drivers on their website, which are outdated. Go to FTDI, the company that makes the chip inside. They have up-to-date drivers even for intel Macs.

To talk to your serial device, you could get goSerial, but I wanted to do some on-the-fly analysis using python (of course). For this, I use pyserial. You just have to make sure that you link to the serial device correctly, as the FTDI drivers call it something nonstandard.

Wednesday, March 7, 2007

non-linear colormaps in matplotlib

Here is a way to do non-linear colormaps in matplotlib. You can select a base colormap, and a series of levels, and this class will remap the (linear) colormap such that your new selected levels define the linear positions along the map. This can be used for plotting bathymetry, specifically, where you may want to have more contours in the shallows than deep. Grab the code here: nlcmap.py.

Wednesday, February 28, 2007

Hypoxia and river discharge.

Here is a plot of hypoxia and river discharge. The discharge is measured at Tarbert Landing, and is plotted in 1000 m3/s. The measured bottom hypoxic area is plotted as read lines in terms of area (1000 km2). The length of the lines represent the period over which the data were taken.

Figure after the jump

Tuesday, February 27, 2007

New submission of the hypoxia paper

I finally got around to doing my revisions, and sent the hypoxia paper in. You can get it here:

hypoxia.pdf [8 Mb]

Enjoy.

Saturday, February 24, 2007

Test post from Mars edit.

Ok, so my test post from TextMate never amounted to much. Here is another test post from MarsEdit. I think it can handle figures:
Photo 33.jpg
(automatically uploaded and linked -- cool). Now I just need better content....

Wednesday, February 7, 2007

PYROMS on Google code

I have put together some of the python tools I have been writing into a package called pyroms. It is available on google code:

http://code.google.com/p/pyroms/

Please contact me if you would like to be on the developer list.

How to make a grid (in python)

I just competed a movie on how to make a grid using pyth0n. The methods, I think, are about the same whatever platform you use. You can watch the movie online, or download the movie.

Wednesday, January 31, 2007

Simple ROMS case

Below are two movies I made of a seminar on how to create a simple case in ROMS. The case is of a sequentially upwelling/downwelling wind on a shelf. There were some compiler issues, that are not included, so the movie is in two parts (the second part is after the issue got fixed). For the record, it was TS_MPDATA that caused the failure on my laptop (a segfault, then a bus error -- not so good). Using more conventional tracer advection options (Akima 4th order and splines) works great. Here are the links:

Tuesday, January 30, 2007

ROMS grid class in Python

I have just finished a beta version of a grid class for ROMS (or other curvilinear C-grids). I have not cut out a release from the svn yet, as I am waiting for comments from others. However, you can see the source code here. You can get the entire toolset from svn with:

svn co http://pong.tamu.edu/svn/python/trunk/ rdh_python


I have also posted an introductory tutorial here. Other tutorials (and a fancier page) will be posted to

http://pong.tamu.edu/~rob/python/tutorials/