Compiling 64-bit NetCDF4 with HDF5 on Mac OS X

I needed a 64-bit version of HDF5 and NetCDF4, here’s how you get that going on Mac OS X 10.6.

  1. Download the and uncompress the static HDF5 1.8.6 binaries.
  2. Download the and uncompress the NetCDF 4.1.2 source.
  3. Get rid of all of the .la files in the HDF5 libs folder.
  4. From the command line, set the following environmental variables,
    export CC='gcc' CFLAGS='-g -m64' CFLAGS='-g -m64' CXXFLAGS='-g -m64' HDF5DIR='/path/to/hdf5/folder' LIBS='-lsz' LDFLAGS='-L/path/to/hdf5/folder/lib' You will obviously have to use the true path to the folder.
  5. Make sure you’re in the NetCDF folder and run the following,
    ./configure --disable-f77 --disable-f90 --target=x86_64-apple-darwin -build=x86_64-apple-darwin --host=x86_64-apple-darwin --with-hdf5=$HDF5DIR --with-zlib=$HDF5DIR --with-szlib=$HDF5DIR --enable-shared

I ran make check and everything worked well. I just wanted the resulting libraries, which can be found in liblib/.libs/, but I’m sure you can do a make install if you actually want to install the libraries.

Republican party has lost all my respect

I was just talking to a coworker today about how I used to be really tolerant of other people’s beliefs and ideas, to the point of being overly tolerant. I was definitely a moral relativist on some level, but sometime during college I took a step back and realized that moral relativism is only reasonable to a point — and here I am today, a decade later, and I am hard pressed to find a single action or value in the Republican party that I can respect. Paul Ryan and Joe “cooperate-but-not-compromise” Walsh sure had me riled up this week, but then I read this piece on Ars Technica,

As part of the legislative maneuvering ahead of the bill’s likely passage, Democrats attempted to insert an amendment that recognizes the conclusions of scientific organizations such as the American Association for the Advancement of Science and the National Academies of Science. The amendment read, “Congress accepts the scientific findings of the Environmental Protection Agency that climate change is occurring, is caused largely by human activities, and poses significant risks for public health and welfare.” It was rejected in a 184-240 vote.

Really? Really, really? The Mayan’s were right, 2012 might be the end of the world… sigh.

Greenies against nuclear power

I’ve always been annoyed by the shortsightedness of environmentalists who lobby against nuclear power (as opposed the more informed group of environmentalists who lobby for appropriate safety measures). There’s a great article by George Menbiot subtitled the green movement has misled the world about the dangers of radiation that describes the evidence meltdown in the green movement against nuclear power. According to the Dot Earth blog at the NYTimes, George Menbiot went from one of these evidence-blind greenies to a supporter of nuclear energy in the last month.

This reminds me of when I was touring a lumber mill in Oregon with my family where, by the end of the tour, the guide and part owner of the mill started talking to us about the occasional hostile outbreaks by the environmentalists and greenies that take the same tour. It’s funny because I considered myself an environmentalist and was taken aback for a moment before I realized that it’s true, I’m not one of those environmentalists. The difference is that nobody my family was outright against logging, and we were especially impressed at their environmental stewardship and sustainable practices. People get so caught up in their ideals that they fail to take a step back and see how it fits into the big picture.

Buy locally

I’m all for buying locally and, given a choice, will even pay a bit more for locally grown or locally produced products. However, I think that as a movement it will not succeed with any amount of education or marketing and will remain an ideal practiced by select individuals (read: people with money and education). That only thing that will make real change is a change in the economics of transporting goods. So if you want to support real change, instead of wearing ‘Buy Local!’ stickers, you should probably wear ‘Raise the gas tax!’ or ‘Eliminate tax breaks for oil companies!’. Heh, well, okay — maybe that won’t do either.

Good STB post

Seattle Transit Blog continues to be a wonderful resource for both news and opinion on Seattle/WA transit related issues. There are quite a few remarkable posts that I haven’t pointed to, but here’s one in which I’ve enjoyed both the original post, as well as several of the intelligent comments,
http://seattletransitblog.com/2011/04/02/on-rail-nostalgia/
It’s rare these days that one can find a forum that is only lightly moderated that still contains such a civil and intelligent group of commenters.

How much is a park worth?

The basic idea is this: Fire District 41 wants a new fire station. The current fire station is too far south and is unable to serve the northern reaches of the district with a reasonable response time. The original proposed location for the new fire station near Finn Hill Jr. High School turned out to be too expensive, costing an estimated $4.5 million to build. The new proposed location will only cost $3.5 million (or $3.8 with a new traffic light), but, unlike the site near the school, will require 1.8 acres of land from the local wooded park.

After attending the public meeting last night, it became clear that that the site near the school is already complete rejected because it can’t be afforded and that there is no backup site to the woodland park. The cost difference between these two sites is not trivial, but what’s $700,000 to this community? This community would easily jump at the opportunity to acquire additional acres to the park (they’ve done so in recent the past), so wouldn’t it be fair to say that preserving this parkland is worth that cost to the community?

The sad part about this is that from King County’s perspective (the folks in charge in of the parkland), they are getting compensated for the use of their land. What do they get in return? More park? Cash? Nope, a parking lot. No joke, the county felt that just compensation for giving up their land was a 10 space parking lot. It’s understandable that this is difficult for the community to swallow.

Simple implementation of VMT tax

Electric cars don’t consume gasoline and therefore owners of electric cars will generally contribute less to the general road maintenance fund because they aren’t paying a gasoline tax. A bill introduced to the state Senate attempt to put a bandaid on this problem by requiring that electric car owners pay an annual $100 fee. While the general idea that electric car owners should contribute to the road maintenance fund is sound, the method is kind of stupid. A far better solution is a vehicle miles traveled tax. Gas mileage in automobiles varies so dramatically that owners are already paying disproportionate amounts of gas tax.

The vehicle miles traveled tax could be implemented in a fairly practical manner using existing systems in place. The idea would be to charge owners based on the number of miles they drove and the weight of their car. The combination of those two factors more accurately reflects the impact each car has on the road network. To implement this, simply have every car owner annually or biannually submit their current mileage to the State of Washington. This can be done each time the license tabs need renewing, and can be checked by the state during each emissions test and each time the title is transferred.

If it turns out people aren’t truthful enough, then we’d need to require additional checks to a car’s mileage by the state. In the long run, maybe something like wireless OBD can automatically verify the vehicle’s mileage.

The bottom line is that I think we’re at a stage where VMT can and should be implemented.

Ayn Rand Fantasyland

Here’s a favorite quote of mine that I’ve seen tossed around,

There are two novels that can change a bookish fourteen-year old’s life: The Lord of the Rings and Atlas Shrugged. One is a childish fantasy that often engenders a lifelong obsession with its unbelievable heroes, leading to an emotionally stunted, socially crippled adulthood, unable to deal with the real world. The other, of course, involves orcs.

I first fell in love with Ayn Rand’s philosophies in high school when I was 17 after reading Atlas Shrugged. When discussing different Ayn Rand books with my sister during my freshman year in college I remember admitting that I enjoyed Atlas Shrugged over The Fountainhead because it appealed to my science fiction tastes. That probably should have been my first hint that something was wrong. Arguments with my uncle around this same time sowed doubt in my mind, but it wasn’t until my mid-twenties that I realized her ideas were all fantasy. Someone just needs to tell Rand Paul, the Tea Party and the current batch of Republican leaders.

Washington State Ferry diverts to rescue windsurfer

The rescue craft heading out to the windsurfer, also visible in the photo.

I was heading back from Bremerton to Seattle on the Washington State Ferry yesterday when I noticed we made an abrupt course change out in the middle of Puget Sound. Instead of heading in towards Elliot Bay, we were suddenly heading towards the point just south of Alki Beach. It took more than a few minutes before the captain announced that the a body had been spotted in the water and we were being divert to go look. We headed toward the point, then stopped a quarter mile or so off of Alki Beach while everyone looked around. After five minutes we then headed northwest (further off shore) and again came to stop. At that point several passengers spotted something in the water… you can read another account here. Apparently this windsurfer had a cell phone and was in communication, but it’s not clear whether he made the original call for help or not.

The windsurfer was standing on the car deck with his wetsuit and board as I drove off. He looked in good shape, but I assume he ended up further offshore than intended. As far out as he was, with the wind blowing to the north, I would have to imagine it would have been difficult to get back.

Update: The Seattle Times clarifies that it was the windsurfer who made the original call for help. The problem was that his mast broke!

Fortran compiled mex files with Matlab 2010b on Mac OS X

Although I personally have don’t need to compile any mex files in fortran for Matlab, another scientist here at NWRA does, so I thought I was post how to get this running for anyone who is interested.

The instructions are specific to the 64-bit Matlab 2010b on Mac OS X. According to MathWorks, we need to use gfortran version 4.3.

1. Download and install Xcode 3.2 from Apple (this will give you a c compiler).

2. Download GMP version 4.3.2.

3. Download MPFR version 2.4.2.

4. Check out gcc version 4.3.4 with

svn co svn://gcc.gnu.org/svn/gcc/tags/gcc_4_3_4_release

5. Make an empty build folder for gcc, I called it “gcc-build”

6. Move both gmp and mpfr to the “gcc_4_3_4_release” folder and make sure they’re labeled exactly “gmp” and “mpfr”. At this stage I have a root folder called “gfortran” with,

gfortran/gcc_4_3_4_release
gfortran/gcc_4_3_4_release/gmp
gfortran/gcc_4_3_4_release/mpfr
gfortran/gcc-build

7. From within the gcc-build folder run,

../gcc_4_3_4_release/configure --enable-languages=c,fortran --target=x86_64-apple-darwin -build=x86_64-apple-darwin --host=x86_64-apple-darwin

8. Compile gcc, gfortran, and the associated libraries (this will take a while),

make -j4

9. Finally you can install this with,

sudo make install

From within Matlab, run “mex-setup” and choose the gcc option. At this point you should be able to compile the yprimef example code included with Matlab.