Monthly Archives: September 2009

Climate Model on a Mac: Snow Leopard

Snow Leopard, the latest OS offering from Apple, promised to be both 64-bit and faster. The question is whether Apple delivered those promises and whether those improvements impact modeling.

First, I got Snow Leopard booting to the 64-bit Snow Leopard kernal. There are instructions how to do this out there on the web (note that you don't have to bother if your machine is 64-Bit and you're running the server version).

More info below the fold..

For all of the compiling below, the target was 64-bit.

Next, I upgraded my compiler. I was using PGI 7, now I'm using PGI 9. Changing the compiler required updating all the supporting code.

Netcdf was next on the list. In this case, NetCDF was somehow incompatible with PGI 9 or Snow Leopard in one respect. fstat is a command to discover info about files. In this case, fstat was always returning a file size of 0 causing NetCDF to assume the file was not a valid netcdf file (note: this is netcdf 4 with no HDF support). I forced the compiler to use fstat64 and all was well…

Next came MPICH. I decided to drop MPICH 1 in favor of trying MPICH2. This worked fairly well with no major complications.

Finally, I recompiled the climate model, which also appeared to have little trouble.

So, was it faster??

Here is the preliminary result:

Before Snow Leopard:

32-bit compile, MPICH 1, PGI 7
12-13 model years per wall-clock day

64-bit compile, MPICH 2, PGI 9
18-19 model years per wall-clock day

This is a significant speed increase (somewhere around 50%), if it holds. If run constantly, this means an increase potential of over 2500 extra model years in a calendar year!

It's unclear, however, whether the performance is due to just 64-Bit, Snow Leopard, PGI, or MPICH. Regardless of what's causing the improvement, I'll certainly take it!

More Snow Leopard Geotagging With Services: Google Earth

As mentioned before, I feel geotagging is an important part of image metadata. In a previous post, I showed a simple Applescript-based Snow Leopard service to set images to a commonly used location.

With a slight modification to the Applescript in the service, you can pull the location out of Google Earth and embed your photos. I was really excited when Picasa supposedly had this feature, but it’s not mac compatible! Now, iPhoto can do the same thing.

Step 1. Set up the Automator Workflow as described in a previous post.

Step 2. Use the following Applescript

 

on run {input, parameters}
 local myLongitude
 local myLatitude
 tell application "Google Earth"
  set myView to GetViewInfo
  set myLongitude to longitude of myView
  set myLatitude to latitude of myView
 end tell

 tell application "iPhoto"
  set mySelection to selection
  repeat with myImage in mySelection
   tell myImage
    set longitude of myImage to myLongitude
    set latitude of myImage to myLatitude
    reverse geocode myImage
   end tell
  end repeat
 end tell

 return input
end run

Snow Leopard Services to Geotag iPhoto Images

In one of the updates to iPhoto 8, Apple added the capability to use Applescript to geotag photos – that is, embed latitude, longitude, altitude, and other geographic information. Adam Burt noticed this update and suggested a simple Applescript to geotag a photo with a specific latitude and longitude (see here).

It's quite simple to go from his script to a simple service in Snow Leopard. But first, why on earth would I want to do that? I'm keen on embedding as much metadata in my photos as possible, including location. However, it can be a pain to set a specific site over and over. An example of this problem is my home. Every photo shot at my house should be geotagged with that location, but making sure all the photos are properly set is difficult.

Now, imagine a service that I can select from a menu (or key combination) that would set the geotag for every selected photo in iPhoto to the coordinates of my house?

To create the service, open automator and create a service.

Set the service to recieve no input from iPhoto.

Add the “Get Selected iPhoto Photos” action to the workflow. (this might not be required, however)

Add a run Applescript action.

Set the code to look something like this:

on run {input, parameters}
 tell application "iPhoto"
   set mySelection to selection
   repeat with myImage in mySelection
     tell myImage
       set longitude of myImage to -10.0
       set latitude of myImage to 10.0
       reverse geocode myImage
     end tell
   end repeat
 end tell
 return input
end run

Now you can have several services set to specific locations you commonly use.

Thanks again to Adam Burt for the tip!