## 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} ;     $i++ ) 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: