Archive | December 2009

-40C, yikes!

I now know what it is like to be at the same temperature on both the Celsius and Fahrenheit scale… yep a lovely -40C/F. Yikes.
I decided to go for a walk… that was a bad idea.. but I got some nice shots.
Tree with Snow and Tower
City Hall…
City Hall
Not the weather for a tea party..
Not the weather for a tea party
and yep my windows, not that I want to open them, are frozen shut…
Snow on window
I’m gonna be glad to be heading back to a “tropical” UK this week. If I don’t get around to blogging again this side of it, Merry Christmas to you all.

Converting Video for the Ipod on a linuxbox

After my flights to and from Puerto Rico the other day I decided it was about time I put a few other video clips onto my ipod (I’ve watched Master & Commander way too many times on it). The problem is how the heck did I convert them in the first place. I actually have this awful feeling it was quite a few years back and I used an evil Windows program todo it! Well, how do you do it in Linux… simply really install ffmpeg (and a few related things), in Ubuntu it should be as easy as:

sudo apt-get install ffmpeg

.. but just in case [read here]. Then its just about running said task and waiting for the processing to finish. Simples. Oh run something like:

ffmpeg -i Input.avi -f mp4 -acodec libfaac -ar 44100 -ab 128 -vcodec mpeg4 -maxrate 2000 -b 1500 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -s 320×240 -r 30000/1001 outfile.mp4

Going from sexigesimal to decimal…

I decided (and since I had todo this today) that for consistency (see [my post from there other day]) I should post how to convert between astronomical sexigesimal and decimal coordinates in awk:

awk ‘{h=($2*15)+($3/60)*15+($4/3600)*15; h2=$5+($6/60)+($7/3600); print $1,h,h2}’ input > output

see its nice and simple really… the input file given here simply as “input” should contain a list of Source Name (which is $1, not necessary but you normally have it…), RA (in H M S, all separated by spaces) and DEC (D M S, again space separated)…. enjoy.

How things change in a week…

The beach in Arecibo (around +35C)…
Me on a beach in Arecibo
The tundra that is Calgary (around -20C with wind chill anyway)…
Playing in the snow at UofC
Oh the life of an astronomer… biggrin.gif

Using Awk to add a column to a file

I had a need to add an extra column of numbers (all the same) to dataset the other day… so simple todo with an awk script

#!/usr/bin/awk -f
BEGIN {
}
{
printf(“%10d %10d %6dn”, $1, $2 ,”10″);
}

Just save the above input like something like add_column.awk, make it executable (something like chmod 700 add_column.awk) and run it (the above just adds “10” to each line and is simple to change to a variable or some other string):

add_column.awk yourinputfile > youroutputfile

and job done.

Convert decimal to sexigesimal in awk

Yesterday I had the need to convert a decimal number to a sexigesimal one – I know there are lots of astronomical tools out there todo this but I felt then need to do this in awk… so here it is:

awk ‘{if ($2>=0) {h=($1/15); h2=h-(h%1); m=(h-h2)*60; m2=m-(m%1); s=(((h-h2)*60)- m2)*60; d=($2-$2%1); am=($2-d)*60; am2=am-(am%1); as=((($2-d)*60 -am)*60); print h2, m2, s,d, am2, as} else{h=($1/15); h2=h-(h%1); m=(h-h2)*60; m2=m-(m%1); s=(((h-h2)*60)- m2)*60; d=($2-$2%1); am=(d-$2)*60; am2=am-(am%1); as=((am – (d-$2)*60)*60); print h2, m2, s,d, am2, as} }’ sourcelist.dat

were sourcelist.dat is a space separated file with ra and dec in decimal.
This is a typical thing that you might want to do in astronomy, though you tend to want to take the position in HMS and make a decimal number, don’t ask why I wanted to go the other way.

A day out in San Juan

Whilst I was at Arecibo I got to spend an afternoon out in Old San Juan. For a Caribbean town I was surprised to how European it looked:
Old San Juan Street
One of the most interesting buildings was the tiny Chapel of Christ the Saviour:
Chapel of Christ the Saviour
and all of the pigeons that congregate in the park next to it:
Pigeons on  Chapel of Christ the Savior
The streets were very European:
Old San Juan Street
The cathedral also felt “old”:
San Juan cathedral
San Juan cathedral Puerto Rico flag, virgin mary
We also took a walk out to the impressive (and you can understand why when the USA took the Island they came from the otherside… and why that “pirate” as they call him, Drake, failed) Castillo San Felipe del Morro:
Castillo San Felipe del Morro
Castillo San Felipe del Morro looking up at main body
You can see the modern improvements (well modern being Second World War) on the left hand side:
Castillo San Felipe del Morro
Oh and on the way back to Arecibo I saw probably the most weird thing I’ve ever seen on a motorway… a plane!
Plane on the highway!
At first we thought it had crashed, but it turns out that it was being taken to some town to be turned into a restaurant but a tyre on the truck it was on blew out!
Oh if you wanna see more from this trip just take a look [here]