Home > Uncategorized > The Met Office ‘climategate’ Perl code

The Met Office ‘climategate’ Perl code

December 25th, 2009 Derek-Jones

In response to the Climategate goings on the UK Meteorological Office has released a subset of its land surface climate station records and some code to process it. The code consists of 397 lines of Perl (station_gridder.perl and make_global_average_ts_ascii.perl).

At various times I have been asked to suggest which part of an application’s or product’s source code should be made available to a third party. The third party may have been interested in evaluating the quality, getting a feel for the complexity or felt that they ought at least be able to say they had seen some code. In these situations there is always a trade-off between impressing the customer (e.g., well structured code containing lots of comments) and not revealing too much (e.g., impenetrable code with no comments).

Have the Met Office released the code they have used over a period of time or have they release newly written code?

The source does not have the characteristics often seen in well worn, ‘old’, code. There is no revision history (that may be due to poor programming practices or may have been stripped off prior to release; I discuss pretty printing below), the visual layout is generally consistent (this may be because the same small group of people have worked on it over time), there are no obvious hacks used to get around previous design decisions that have changed and unscientifically it just feels to me like newly written code.

Was the original code written in another language (e.g., Fortran), perhaps as part of a larger program and been rewritten in Perl?

The code does not have a Fortran ‘accent’ to it. The code was written by people who are fluent in Perl; perhaps they do not know Fortran very well and were given time to craft something presentable, hence no Fortran accent.

Why have I been referring to the code authors, plural, when writing 397 lines is well within the capabilities of a competent developer working for a day (I bet the authors spent longer in meetings about this code than actually writing it)? Developers tend to have very fixed habits when it comes to bracketing statements with curly braces, there are those who always put the open brace at the end of the line and those who always put it on a newline. The Met Office code contains both usages, sometimes within the same subroutine. Also the use of whitespace around punctuators and operators does not follow a consistent pattern, which for me rules out the use of an automated pretty printer and kind of implies more than one person doing the editing. And why are some variables names capitalized and other not (the names in subroutine read_station are all lower case while the names in the surrounding subroutines are mostly upper case)? More than one author is the simplest answer.

One Perl usage caught my eye, the construct unless is rarely used and often recommended against. Without a lot more code being available for analysis there are no obviously conclusions to draw from this usage (apart from it being an indicator of somebody who knows Perl well, most mainstream languages do not support this construct and developers have to use a ‘positive’ construct containing a negated condition rather than a ‘negative’ construct containing a positive condition).

  1. Peter
    December 25th, 2009 at 15:29 | #1

    Given that it was written in perl, it should have been rewritten as a one-liner.

  2. December 25th, 2009 at 17:29 | #2

    The people who wrote these scripts may be “fluent in Perl” (whatever that means), but they are certainly no masters of the language, nor are they plugged into the general Perl community. There is no usage of CPAN modules (many of which would have made this code more comprehensible). There are several subtle bugs in the code and the code is unnecessarily imperative. While it may not be “Fortran-accented” (and I agree), it is definitely “C-accented”. (I would say “Java-accented”, but someone will argue that there aren’t any objects.)

    If I had to guess, this code was written by 3-5 developers who are conversant in several languages and prefer Java or C++ over most other languages (likely they have a large Java or .Net application to maintain and this is a side project). Someone decided that since this was manipulating text, Perl would be the best choice and everyone else just went along. The code has undergone at least 3 internal bugfix/upgrade cycles and possibly as many as 6+.

    And, finally, this code isn’t being released to the OSS community - it’s being released as a political maneuver.

    (Oh - Damian’s anti-unless screed is almost completely disregarded by the Perl community at large, at least as judged by CPAN authors.)

  3. December 25th, 2009 at 22:24 | #3

    I think the code is comprehensible as written and somebody who knows a language other than Perl could probably figure out what is going on. CPAN does contain lots of useful modules but when writing relatively small amounts of code, unless the developer happens to be familiar with a module that solves the problem at hand it is generally less effort to to write the required code. Not using CPAN modules also makes life simpler for non-PERL users who will not know about CPAN (here is one).

    The code does have a strong imperative feel to it. I don’t see this as being necessary or unnecessary, but then I am always less than impressed by the cryptic code much beloved of Perl aficionados. I see no C or Java specific ‘accent’, but then 400 lines of code is the briefest of conversations.

    Unless you have inside information the numbers in your second paragraph might just as well been delivered by Santa Claus.

    The release of the data is obviously driven by a public relations agenda and the code might just have been tagged on as an after thought. Perhaps a couple of Met Office web site developers had some spare time on their hands and decided to put something together.

  1. No trackbacks yet.
Comments are closed.
FireStats icon Powered by FireStatslevitra canada prescription

cheapest priced propecia

cialis to buy

online propecia prescriptions

online viagra levitra cialis

low cost canadian viagra

getting cialis from canada

cialis pfizer

canadian healthcare viagra sales

cialis brand name

lowest price on non generic levitra

levitra from canadian pharmacy

next day viagra

cialis germany

generic levitra cialis

cialis cheap us pharmacy

cheap canadian viagra

order propecia prescriptions

buy cialis without prescription

canada meds viagra

canadian healthcare pharmacy

buy levitra online

cialis iop

cialis canada

how strong is 5 mg of cialis

cheap viagra from uk

cialis usa

canadian pharmacy viagra legal

generic viagra from china

cialis and diarrhea

cialis alternative

canadian healthcare pharmacy

cialis testimonial

cialis tablets vs viagra

cialis online without prescription

generic propecia canada

china viagra

cialis next day

buying generic propecia

buying generic cialis mexico rx

cialis for less 20 mg

cialis professional

buy real viagra online without prescription

canada viagra pharmacies scam

can i order viagra from the chemist

best price for propecia online

buy levitra now

cialis buy overnight

healthcare of canada pharmacy

online pharmacy propecia

buy levitra us

buy online propecia

canadian viagra generic

buy levitra uk

buy cheap levitra online

best prices for propecia

cheapest priced propecia

buy pfizer viagra online

ordering cialis gel

buy cialis

generic propecia viagra

buy propecia online usa

buy propecia online prescription

buy cialis once daily

buy real cialis

cialis brand only

buying cialis

order levitra online

cheap viagra pills

buy drug propecia

buy dosages levitra

buy cialis online without prescription

levitra online prescription

generic viagra online

levitra info

cheapest propecia online

cialis from mexico

best deal for propecia

cheap levitra without prescription

cialis price 100 mg

cheap propecia uk

cheapest propecia sale uk

cialis once daily

buy cialis professional

canadian healthcare viagra

order levitra

bio viagra herbal

buy levitra now

buy cialis usa

generic cialis from india

buy vardenafil levitra

canadian pharmacy

cialis no rx

cialis from mexico

how much does cialis cost

generic viagra canadian

buy now propecia

order propecia online

non pescription cialis

buy levitra overnight

5 mg cialis canada

hydrochlorothiazide cialis

buy propecia online without prescription

how to get viagra

cheap viagra or cialis

buying viagra with no prescription

non prescription viagra

buy viagra pills

buy propecia without prescription

buy levitra online

how to get cialis

buy cheapest propecia

lowest price for levitra

cheap online propecia

how much to buy viagra in pounds

buying viagra in canada

best online generic levitra

buy viagra germany canadian meds

buy cialis online canada

best viagra

buy levitra low price

cialis daily dosing cost

cialis daily

brand cialis for sale

best price levitra online

canadian drugs propecia

discount generic propecia

buy daily cialis

cialis usa

cialis 20 mg

levitra vardenafil

info levitra

hydrochlorothiazide cialis

cheap propecia order online

cialis and canada custom

cialis alternatives

how much does cialis cost

generic prescriptions propecia

bio viagra herbal

buy drug propecia

cialis trazodone

cheap online levitra

effect of cialis on women

canada pharmacy propecia

index

bying viagra online cheap us

discount cialis levitra viagra

cialis vs levitra

buy levitra uk

canadian viagra india

buy levitra vardenafil

combine cialis and levitra

online cialis

levitra cost

buy cialis online uk

cheapest propecia pharmacy online

cialis for sale

generic propecia for sale

brand cialis for sale

buy cialis canada

buy pfizer viagra in canada

cost of propecia

brand name cialis overnight

brand viagra professional

low cost levitra

buy cialis in usa

how to get cialis in canada

levitra 10 mg

5 mg cialis

buying viagra

buy online propecia

express viagra delivery

levitra vs viagra

discount propecia online

cialis brand only

ordering viagra overnight delivery

best way to use cialis

buying online propecia

cialis daily in canada

best way to use cialis

indian cialis

best levitra prices

buying viagra without prescription

buy cialis online uk

buy cialis in usa

brand viagra without prescription buy

discount canadian cialis

buy fast propecia

canadian pharmacy cialis pfizer

cialis and ketoconazole

best price for propecia

buy canada levitra

cialis on sale

buying cialis without a prescription

mexico levitra

ordering propecia

canadian pharmacy discount code viagra

cialis angioplasty

cialis canadian

generic cialis canadian

cheapest prices for viagra

cialis quick shipment

generic cialis india discount

cialis 30 mg

cialisis in canada

cialis 5 mg italia

cialis testimonial

best price levitra

cialis daily canada

buy generic propecia online

best price for generic cialis

internet pharmacy propecia

cost of viagra in germany

cheapest propecia uk

canada viagra

cialis vs levitra

buy cialis without a prescription

cialis next day

discount propecia rx

canada cheap propecia

levitra ed

buy now propecia

cost levitra low

brand viagra over the net

buy viagra without prescription

canadian pharmacy viagra

buy pfizer viagra in canada

cialis dosagem

cialis en mexico

how to get cialis

cheap canadian viagra

canada online pharmacy propecia

cheap prescription propecia

cialis order

cialis dosage

order propecia propecia

cialis from canada

cialis tablets foreign

cheap propecia no prescription

best way to take cialis

cialis alternatives

generic cialis next day delivery

cheapest price propecia cheap

cialis price 100 mg

best price propecia

brand viagra

canadian viagra and healthcare

brand viagra over the net

how strong is 5 mg of cialis

buying cialis in canada