Tuesday, December 22, 2009

There's a hole in my bucket, dear Liza, dear Liza

So the Met Office released source code for analysis of the recently released land surface temperature data and there appears to be a bug in it.

If you take a look at lines 87-91 of station_gridder.perl there's a loop that reads data from the observation files and extract data between the start and end years. Unfortunately, this appears to be wrong and the program ends up reading suspect data and using it.

# Push anomaly for each year and month to @GridA
for (
my $i = $Station->{start_year} ;
$i <= $Station->{end_year} ;

The $Station hash (actually hash reference) contains entries for start_year, end_year and first_good_year. These correspond to the entries Start year, End year and First Good year in the observation files.

The First Good year is documented as "First Good Year — data before that year are suspect." (see here). My program uses that to remove any suspect data, the Met Office version does not.

This means that it adds suspect data to the averages. I don't know if this really matters, but since they say data before those years is suspect I was assuming that it shouldn't be used.

You can fix the program by changing the lines to:

# Push anomaly for each year and month to @GridA
for (
my $i = $Station->{first_good_year} ;
$i <= $Station->{end_year} ;

If you run the two versions you'll see a slight change in the trend (which affects the early period when data was considered suspect). Here's a chart showing the original version (the red line) and the corrected version (the green line).

Notice something funny? There's a gap at 1855. In fact there's no data output for 1855. Digging in, this turns out to happen because there are no valid southern hemisphere measurements at all in 1855.

Hence there's no global average for 1855.

That's a bit odd, but not serious. But it makes me suspect something: I'll bet a mince pie that this code the Met Office has released is not the code they actually use to create CRUTEM3. I bet they wrote it especially for this release.

Of course, I could be wrong about that.

UPDATE. See this blog posting for the Met Office's reply. Looks like the bug is not a bug, it's an error in their documentation.


If you enjoyed this blog post, you might enjoy my travel book for people interested in science and technology: The Geek Atlas. Signed copies of The Geek Atlas are available.


<$BlogCommentDateTime$> <$BlogCommentDeleteIcon$>

Post a Comment

Links to this post:

<$BlogBacklinkControl$> <$BlogBacklinkTitle$> <$BlogBacklinkDeleteIcon$>
Create a Link

<< Home