Thursday, November 26, 2009

About that CRU Hack

In all the fuss around the supposed smoking gun inside one of the source code files from the CRU Hack no one seems to be pointing something out... the so called fudge factor that is in the program isn't used.

Here's the full listing of osborn-tree6/briffa_sep98_d.pro (I've used bold type to show the bit that everyone is talking about):

;
; Now prepare for plotting
;
loadct,39
multi_plot,nrow=3,layout='caption'
if !d.name eq 'X' then begin
window,ysize=800
!p.font=-1
endif else begin
!p.font=0
device,/helvetica,/bold,font_size=18
endelse
def_1color,20,color='red'
def_1color,21,color='blue'
def_1color,22,color='black'
;
restore,'compbest_fixed1950.idlsave'
;
plot,timey,comptemp(*,3),/nodata,$
/xstyle,xrange=[1881,1994],xtitle='Year',$
/ystyle,yrange=[-3,3],ytitle='Normalised anomalies',$
; title='Northern Hemisphere temperatures, MXD and corrected MXD'
title='Northern Hemisphere temperatures and MXD reconstruction'
;
yyy=reform(comptemp(*,2))
;mknormal,yyy,timey,refperiod=[1881,1940]
filter_cru,5.,/nan,tsin=yyy,tslow=tslow
oplot,timey,tslow,thick=5,color=22
yyy=reform(compmxd(*,2,1))
;mknormal,yyy,timey,refperiod=[1881,1940]
;
; Apply a VERY ARTIFICAL correction for decline!!
;
yrloc=[1400,findgen(19)*5.+1904]
valadj=[0.,0.,0.,0.,0.,-0.1,-0.25,-0.3,0.,-0.1,0.3,0.8,1.2,1.7,2.5,2.6,2.6,$
2.6,2.6,2.6]*0.75 ; fudge factor
if n_elements(yrloc) ne n_elements(valadj) then message,'Oooops!'
;
yearlyadj=interpol(valadj,yrloc,timey)
;
;filter_cru,5.,/nan,tsin=yyy+yearlyadj,tslow=tslow
;oplot,timey,tslow,thick=5,color=20
;
filter_cru,5.,/nan,tsin=yyy,tslow=tslow
oplot,timey,tslow,thick=5,color=21
;
oplot,!x.crange,[0.,0.],linestyle=1
;
plot,[0,1],/nodata,xstyle=4,ystyle=4
;legend,['Northern Hemisphere April-September instrumental temperature',$
; 'Northern Hemisphere MXD',$
; 'Northern Hemisphere MXD corrected for decline'],$
; colors=[22,21,20],thick=[3,3,3],margin=0.6,spacing=1.5
legend,['Northern Hemisphere April-September instrumental temperature',$
'Northern Hemisphere MXD'],$
colors=[22,21],thick=[3,3],margin=0.6,spacing=1.5
;
end

This code is written in a language called IDL and IDL uses a semicolon for a comment. So any line beginning with ; is ignored. Here's the same code without those ignored lines:

loadct,39
multi_plot,nrow=3,layout='caption'
if !d.name eq 'X' then begin
window,ysize=800
!p.font=-1
endif else begin
!p.font=0
device,/helvetica,/bold,font_size=18
endelse
def_1color,20,color='red'
def_1color,21,color='blue'
def_1color,22,color='black'
restore,'compbest_fixed1950.idlsave'
plot,timey,comptemp(*,3),/nodata,$
/xstyle,xrange=[1881,1994],xtitle='Year',$
/ystyle,yrange=[-3,3],ytitle='Normalised anomalies',$
title='Northern Hemisphere temperatures and MXD reconstruction'
yyy=reform(comptemp(*,2))
filter_cru,5.,/nan,tsin=yyy,tslow=tslow
oplot,timey,tslow,thick=5,color=22
yyy=reform(compmxd(*,2,1))
yrloc=[1400,findgen(19)*5.+1904]
valadj=[0.,0.,0.,0.,0.,-0.1,-0.25,-0.3,0.,-0.1,0.3,0.8,1.2,1.7,2.5,2.6,2.6,$
2.6,2.6,2.6]*0.75
if n_elements(yrloc) ne n_elements(valadj) then message,'Oooops!'
yearlyadj=interpol(valadj,yrloc,timey)
filter_cru,5.,/nan,tsin=yyy,tslow=tslow
oplot,timey,tslow,thick=5,color=21
oplot,!x.crange,[0.,0.],linestyle=1
plot,[0,1],/nodata,xstyle=4,ystyle=4
legend,['Northern Hemisphere April-September instrumental temperature',$
'Northern Hemisphere MXD'],$
colors=[22,21],thick=[3,3],margin=0.6,spacing=1.5
end

The critical thing to look for is yearlyadj which is the magic value that everyone is so excited about. But guess what? It's never referenced in the rest of the program. So much for a smoking gun.

Update: Read the comments below. It's been pointed out to me that there's a later version of code in the archive in which similar correction code is not commented out. Details and link below.

Labels:

17 Comments:

Blogger Kirk Hawley said...

Oh bull pizzle. The valadj array is being passed into the interpol function. What's happening to the data inside interpol? I don't know, and neither do you, but it's pretty obvious that valadj is doing something inside interpol OR IT WOULDN'T BE GETTING PASSED IN.

You're either trying on purpose to make this look innocuous or you're a lousy programmer.

7:22 PM  
Blogger Kirk Hawley said...

Oh bull pizzle. The valadj array is being passed into the interpol function. What's happening to the data in the interpol function? I don't know, and you don't either. But the simple fact that valadj is being passed into it infers that it's acting on the data in that function.

You either know that and are lying about it, or you don't know what you're talking about.

7:22 PM  
Blogger Kirk Hawley said...

Yes I AM so indignant I posted twice.

7:34 PM  
Blogger John Graham-Cumming said...

The function interpol being called is part of IDL. You can read its definition here: http://star.pst.qub.ac.uk/idl/INTERPOL.html In this program it is being used to do linear interpolation of the valueadj values into the yearlyadj array. Unfortunately yearlyadj is not used after being calculated. It is mentioned in commented out code, but is not used in the code as shown.

7:55 PM  
Blogger Kirk Hawley said...

My sincere apologies, I'm not an IDL programmer and I jumped the gun.

Of course, that leaves a question of why that code is in there at all, or any number of other alarming things in the harry_read_me.txt file.

8:23 PM  
Blogger Stone said...

I think you need to address the file briffa_sep98_e.pro as well. Yearlyadj appears to be used after it is calculated.

3:53 PM  
Blogger John Graham-Cumming said...

@Stone

Yes, that looks like it's correct. See http://di2.nu/foia/harris-tree/briffa_sep98_e.pro

There yearlyadj is used.

4:30 PM  
Blogger Joseph said...

Of course, that leaves a question of why that code is in there at all, or any number of other alarming things in the harry_read_me.txt file.

Comments are put in code only a for a couple reasons: To remind yourself of it in the future, or to inform the rest of your team about something.

If you have comments in all-caps like "VERY ARTIFICIAL", ending with "!!", and using words like "fudge" it means you're trying to caution your team about something.

You wouldn't put those kinds of comments in code when you're trying to obfuscate wrongdoing.

That was most likely a rudimentary, probably temporary version of the code.

I found the same thing in my latest post, BTW.

4:34 PM  
Blogger wrf3 said...

An important question is "which code produced what graphs?"

6:07 PM  
Blogger Dave Scotese said...

So John,

I see your response to Stone acknowledges that the basis of your article is kind of moot. I think it's important that you know that your article is in first place when searching for the infamous phrase.

Perhaps you could do the world a favor and point out that briffa_sep98_d.pro's name suggests it's an earlier version than briffa_sep98_e.pro, and that while the artificial correction is rendered impotent in the former, it is apparently used in the latter.

Thanks Stone, for providing us all with the info, and thanks John, for providing the link to the (apparently) latter file which shows that something is very seriously wrong.

That, perhaps, there is a great big bad out there and people could start paying attention to get rid of it. CampaignForLiberty might be helpful.

6:30 AM  
Blogger John Graham-Cumming said...

@Dave Done. I've added an update paragraph pointing people to the comments.

6:53 AM  
Blogger pete said...

Have a look at these.

briffa_sep98_decline1.pro
briffa_sep98_decline2.pro

It looks like the artificial correction was a placeholder until they'd worked out how to do their rotated PCA correction for the decline.

11:22 AM  
Blogger geoff said...

Hello, John! I am a layperson who doesn't understand any of this and am trying to keep up and stay as informed as I can about this issue. What exactly does the updated link prove/mean?
Thank you!

7:51 PM  
Blogger Kirk Hawley said...

It means his original post is wrong and he's not afraid to admit it, which is greatly to his credit.

2:05 AM  
Blogger Peter De Baets said...

In a lousy program such as this I wouldn't be surprised if before a run they would decide whether to leave the comment ";" in or take it out depending on the results they want. A better programmer would have coded this as a parameter passed to this routine, or one could imagine that this was meant to be hidden deep in the code.

5:03 PM  
Blogger Mikhail said...

How would I run this script? Assuming, I install GDL (which is the free clone of IDL)...

It would seem, the data series used by these weren't included in the charts, so we can only speculate, which version was used to produce the Nature's image...

Searching for the archives for the word "artificial" brings up some other worrying places, BTW. For example:

documents/osborn-tree6/mann/oldprog/calibrate_correctmxd.pro starts with:

; .... We have identified and
; artificially removed (i.e. corrected) the decline in this calibrated
; data set.

What do they mean by "artificially removing the decline"?

12:11 AM  
Blogger Martin said...

The paper which uses this code is

Osborn et al. 2004.

(It was on the CRU server that was taken down, this is HTML from google cache)

Look especially at sections 4.3 and 4.4. I am no dendro expert, but this looks like perfectly legitimate numerical experimentation, described in gory (boring?) detail.

11:23 AM  

Post a Comment

Links to this post:

Create a Link

<< Home