RealClimate logo

Please, show us your code

Filed under: — rasmus @ 17 December 2009

The 1991 Science paper by Friis-Christensen & Lassen, work by Henrik Svensmark (Physical Review Letters), and calculations done by Scafetta & West (in the journals Geophysical Research Letters, Journal of Geophysical Research, and Physics Today) have inspired the idea that the recent warming is due to changes in the sun, rather than greenhouse gases.

We have discussed these papers before here on RealClimate (here, here, and here), and I think it’s fair to say that these studies have been fairly influential one way or the other. But has anybody ever seen the details of the methods used, or the data? I believe that a full disclosure of their codes and data would really boost the confidence in their work, if they were sound. So if they believe so strongly that their work is solid, why not more transparency?

There is a recent story in the British paper The Independent, where Friis-Christensen and Svensmark responded to the criticism forwarded by Peter Laut (here). All this would perhaps be unnecessary if they had disclosed their codes and data.

Gavin and I published a paper in Journal of Geophysical Research, where we tested the general approach used by Scafetta & West, and tried to repeat their analysis. We were up-front about our lack of success in a 100% replication of their work, but we argue that the any pronounced effect – as claimed by Scafetta & West – should be detectable even if the set-up is not 100% identical.

However, Scafetta does not accept our analysis and has criticized me for lacking knowledge about wavelet analysis – he tells me to read the text books. So I asked him to post his code openly on the Internet so that others could repeat our test with their code. That should settle our controversy.

After repeated requests, he told me that he doesn’t really understand why I’m not able to write my own program to reproduce the calculations (actually, I did in the paper together with Gavin, but Scafetta wouldn’t accept our analysis), and keeps insulting me by telling me to take a course on wavelet analysis. Furthermore, he stated that there “are several other and even more serious problems” in our work. I figure then that the easiest way to get to the bottom of this issue it to repeat our tests with his code.

A replication in general doesn’t require full disclosure of source code because the description in the paper should be sufficient, though in this case it clearly wasn’t. So to both save having us do it again and perhaps miss some other little detail – in addition to using an algorithm that Scafetta is happy with – it’s worth getting the code with which to validate our efforts.

It should be a common courtesy to provide methods requested by other scientists in order to speedily get to the essence of the issue, and not to waste time with the minutiae of which year is picked to end the analysis.

The reason why Gavin and I were not able to repeat Scafetta’s analysis in exact details is that his papers didn’t disclose all the necessary details. The first point he raised was that we used periodic instead of reflection boundaries. The fact that the paper referred to the expression ‘1/2 A sin (2 pi t)’ to describe the temperatures or solar forcing would normally suggest that they used periodic rather than reflection boundaries. There was no information in the paper about reflection boundary. But this is no big deal, as we have subsequently repeated the analysis with reflection boundary, and that doesn’t alter our conclusions.

After further communication, we found out that Scafetta re-sampled the data in such a way that the center of the wavelet band pass filter was located exactly on the 11 and 22 year solar cycles, which were the frequencies of interest. He also informed me that a reasonable choice of the year when the reflection boudary was made should be the year 2002-3 when the sun experienced a maximum for both the 11 and 22 year cycles. This information was not provided in the papers.

I’m no psychic, so I couldn’t have guessed that all this was needed to reproduce his result. But since Scafetta has lost faith in my ability to repeat his work, I think it’s even a greater reason to disclose his code so that others can have a go.

For the record, we did not just use wavelets to filter the data – we obtained the same conclusion with an ordinary band-pass filter.

233 Responses to “Please, show us your code”

  1. 1
    Dappled Water says:

    Scafetta must have picked up a trick or two from Ian Plimer on how to avoid answering the question.

  2. 2
    Doug Bostrom says:

    Oh, naughty! Remember, you’re expected to be high-minded, aloof from the real world of human affairs, ensconced in a ivory tower without heed to brickbats thrown by detractors. Only contrarians are allowed to retreat behind secrecy when necessary. Secret finances, secret campaign coordination, secret penetrations of servers, and now secret science, apparently.

  3. 3
    Zorro says:

    Their code was designed by 10 separate programmers who are bound by property rights issues…… and the various offices required the signing of confidentially agreements……. Plus they lost it.

  4. 4

    You should write to the journal editors and let them know the authors don’t comply to release material linked to the publication they are otherwise obliged to release.

  5. 5
    Completely Fed Up says:


    Just thinking..

  6. 6
    KeithGuy says:

    If credibility in ALL aspects of climate science is to be maintained, then of course it is important that raw data and algorithms applied to data are fully disclosed. This surely applies to the work of Henrik Svensmark or to the HadCRU.

  7. 7
    Ben Lawson says:

    What is good for the goose is clearly not good for the gander. Surprise!

  8. 8
    Daniel J. Andrews says:

    RC…you’d be less than human if you didn’t get some slight satisfaction out of using that title for this article. :)

    I’m going to have to crack open a textbook to follow these points, but that’s ok…it’ll put my edumacashun to work.

  9. 9
    Robert says:

    waaah waaah someone won’t hold your hand and show you how to do math. run along now children and play with the elves and fairies. frauds, charlatans, and now cry-babies

    [Response:“People who are paid by the public should EXPECT their work to be examined by the public. It is not just our right, it’s our obligation.” – I wonder who said that? Oh yes. You. – gavin]

  10. 10

    Has Steve McIntyre requested the code?

  11. 11
    CPR says:

    There’s been a lot of new data since 1991 – have they repeated their work with the data since?

  12. 12
    BillB says:

    I am a “denier” that regularly reads CA, Lucia, Pielke Jr. etc. (but not WUWT) and I wholeheartedly join in your request for “the code”. If it isn’t given, then their paper should be ignored.

  13. 13
    RickA says:

    While tongue in check – it seems that you do present good reasons why the code and methods should be published.

    Why not agree that it would be a good idea, for future publications, to archive the data and software source code used to produce the graphs and analysis published in the paper. Preferably on the journals public download page.

  14. 14
    gv says:


  15. 15
    Jim says:

    “I’m no psychic, so I couldn’t have guessed that all this was needed to reproduce his result.” This line makes it sound like once you switched to reflection boundaries and re-sampled the wavelets you were able to reproduce their results but I am guessing I am just confused.

  16. 16
    cougar_w says:

    Or … you cannot replicate their results because their results cannot be replicated. Simply put, either this is a open process amenable to examination and replication by independent workers with reasonable skills … or it is faith-based. Being psychic (or even psychotic) ought not to be a requisite for verifying someone else’s work.

    But I think that must be your point, without saying nearly as much.


  17. 17
    NS says:

    tu quoque

  18. 18
    BlogReader says:

    But according to this blog and over at openmind code doesn’t matter.

    [Response: Mostly it doesn’t. You learn more my doing it yourself and that was what we tired first. But if the return criticism is that you didn’t do it exactly right, and the published description is insufficient for you to do that, it would seem sensible to look at the code to get that out of the way. – gavin]

  19. 19
    Chris Colose says:

    I wasn’t aware that their solar work was even longer taken seriously, let alone “influential.” The fact is that all attempts to argue for a significant solar forcing over the later half of the 20th century have failed miserably.

    [Response: True. But there are still some people (NIPCC, etc, etc, and I was trying to convince Fred Singer about this a couple of weeks ago) who believe that the sun is the culprit, and we have looked at the data, and argued for a while that there is little evidence of the sun causing the recent trends. We always have to be open for new ideas and new facts. Recent work suggest that solar activity can have an influence – albeit weak – causing climate fluctuations. So, it brings us back to science never being settled. -rasmus]

  20. 20
    ttt says:

    i also want to see their emails from the period in question

  21. 21
    Lynn Vincentnathan says:

    Yes, show us (well, not me, but those who can do the science) your code!

  22. 22
    Andrew says:

    I’m not exactly sanguine about the idea that some result of wavelet filtering is particularly sensitive to the boundary conditions. One of the advantages of wavelets is that local effects can stay local. If the boundary conditions largely determine the result, then there probably really wasn’t an essential contribution from the wavelet basis. Sounds like a more careful approach would be to explicitly consider edge kernels.

  23. 23
    Sam Gralla says:

    Yes, he should release his code. I hope the “skeptics” pressure him to do so as well. I also hope that the “orthodoxy” camp pressures their own to release code when the skeptics demand it.

  24. 24
    Doug Bostrom says:


    “Why not agree that it would be a good idea, for future publications, to archive the data and software source code used to produce the graphs and analysis published in the paper. Preferably on the journals public download page.”

    Definitely, please, on a server, somewhere else! Our garage is currently home to over 80 boxes of old data on paper, moldering diskettes, hard disks from long-dead computers, etc. None of this is factored in when allocating office space. Meahwhile, I can’t change my brake calipers until I move the whole bloody heap back into the main house after finishing painting indoors, because our repair space is full of my SO’s data, waiting for resurrection for whatever reason.

    Meticulous archiving with full access is ideal but needs to be paid for, let’s remember. In our case we’d love to send the whole mess out for digitization, but who’s gonna pay? Meanwhile, NSF etc. get a great deal because their grants buy ’em permanent storage, for free. Presumably they won’t have to pay the dumpster fees when we both croak, either…

  25. 25
    tharanga says:

    Absolutely hilarious.

    Though I’m unsure that going public with the complaint will advance the matter.

  26. 26
    Didactylos says:

    It might be a fallacy if rasmus used this piece as the basis of some argument that Scafetta is a fraud because he won’t share his data. No, this is satire. It is also rhetorical, because I have no expectation that Scafetta will be forthcoming.

    Most importantly, you forget that Gavin has, possibly more than any scientist in history, made his work public, and provided all the code you could ever want.

    [Response: I guess you’re right about the outcome. But I want to put the focus back on the issue of transparency and repeatability, which are two important aspects of science. Internal e-mails, however, are not very relevant – they only fuel charades and political spin because we will never know their true context and will never be able to understand their true meaning For instance, I often tell jokes and use sarcasm or irony when writing to close colleagues. Taken out of context, one would get a completely wrong impression. -rasmus]

  27. 27
    joe shea says:


  28. 28
    BJ_Chippindale says:

    I am mindful of the cosmic level of coincidence that is required for the sun to be the culprit exactly at the same time we are dumping CO2 into the atmosphere 50 times faster than we have any notion has ever happened before and to levels unknown for 3 million years… so as to fool us about the causality.

    That sort of coincidence (especially without having any significant changes in solar recorded) beggars imagination.

    It isn’t “scientific” evidence. However, it is hard for me to expect anything but things to be worse than either the denialsphere or the IPCC allow for.


  29. 29
    WAG says:

    Yet another example of deniers’ hypocrisy. I’ve counted 30 so far (including this one) – feel free to add more:

  30. 30
    Chris Crawford says:

    I’d like to offer a suggestion by way of a morality tale: once upon a time, terrorists attacked and destroyed the World Trade Center, killing 3,000 Americans. Americans were outraged and terrorized by this despicable act, and took proper action invading Afghanistan and eliminating the bases from which the terrorists operated. However, they remained terrorized by the terrorists, so they overreacted by invading Iraq. It was a ghastly mistake and has cost the USA dearly.

    The moral of this story is “Never allow yourself to be terrorized by the terrorists”. And it applies, at a much smaller scale, to your problem with deniers. Some members of the academic community allowed the bastards to get under their skin, and they overreacted. Now they are paying a price for overreacting. Their reactions were entirely human and completely understandable — but then, so was the American reaction to 9/11. Understandable, yes. Prudent, no.

    Keep your chin up and your upper lip stiff. Good luck.

  31. 31
    jeff id says:

    You have my support on his release of code.

    I’ve even personally emailed him to release it, to no avail. It will be quite a bit simpler than some of the other code but as you said the 11 and 22 year cycle issue is not obvious.

    The boundary issue could have been caught but the rest is not apparent and shouldn’t require you to waste your time divining an algorithm from text. As a fellow non-psychic, I hope you succeed on this front.

  32. 32
    cbp says:

    Heads up for the Americans:

  33. 33
    RickA says:

    Doug Bostrom #23:

    I see the problem with really old data.

    However, for new papers, you know they are working with data files and program files which are already digitized.

    So it really isn’t (or shouldn’t be) that much work to dump all the data and code to a server someplace.

  34. 34
    Nick says:

    Why should they respond to people trying to critises their work?

    Oh sorry, wrong way round.



  35. 35
    Molnar says:

    It’s a Solarist conspiracy! FOIA! FOIA! :P

  36. 36
    Mr Henderson says:

    This post is perfectly reasonable, but I think there’s a danger when examining any solar-cycle warming theory that the main message for the lay public gets obscured. (I speak as a member of said public.) The message being, as I understand it, that there’s nothing in solar warming theories that disproves the fundamentals of CO2 warming – they can only modify temperature predictions for a limited period. Is that correct?

  37. 37
    Mike W says:

    Not a total thread hijack, but hey, at least it’s still about radiative transfer.

    I posed this thought experiment elsewhere, so the tone may seem a bit odd, it’s not intended to presumptious or condescending in any way. It’s based on what I’ve been reading on physical chemistry, atmospheric radiation and thermal physics. Just wondering if my interpretation is on the money or if I’ve made any incorrect assumptions.

    “Time for another random thought experiment. Imagine a “balloon” filled with air, it’s not essential but we can also say its a closed system in a vacuum to make it simpler. The balloon is a spherical membrane completely transparent to infrared radiation at 4.3 microns (Sodium Chloride windows are transparent to IR correct, not saying you can build the experiment, just that it is plausible in design). Then you illuminate the “balloon” with infrared radiation at 4.3 microns.

    What happens then? Glad you asked…A CO2 molecule inside the balloon will absorb an IR photon, become vibrationally excited, undergo molecular collisions, gain a small amount energy in collisions, lose a small amount of energy in collisions, and then emit an IR photon almost identical to the one it absorbed (Kirchoff’s Law?), it’s a very small perturbation based on how much vibrational energy was gained from, or lost (transformed/exchanged) as translational energy during the collisions for this particular CO2 molecule we have been so intently following. I’m ignoring natural and doppler broadening for simplicity’s sake and because I’m mainly interested in the interaction between translational and vibrational energies.

    Based on what I’ve read I understand the vibrational energy is larger than the energy involved in collisions, and the collisions only affect the vibrational levels weakly. I’m sure the specifics of the exchange are buried deep in quantum processes that I’m probably not going to be able to undestand any time soon, I just have to take it for granted that the interaction between the translational and virbational energies is “weak”. Suffice to say that if the exited CO2 molecule can lose energy in a collision it is equally likely to gain energy in a subsequent collision, I think the Lorentzian profile of collisional spectral broadening bears this out nicely, nice symmetric broadening about the absorption peak, same amount of energy, just spread out over a wider range of wavelengths, half higher, half lower (unless there is some inequality in the equipartition I dont understand).

    On average though, over many molecules, many absorption/emission cycles and many collisions the amount of translational kinetic energy in the system stays the same, and the amount of vibrational energy stays the same. The radiation does get a little ‘messier’ (spectral broadening) but it never undergoes wholesale conversion into translational kinetic energy.

    So the average translational energy of the molecules in the gas stays the same, even when we illuminate it with infrared radiation. WARNING! I’M GOING TO USE CONCEPTS DERIVED FROM THE IDEAL GAS LAWS. I UNDERSTAND THAT THE KINETIC/MOLECULAR THEORY OF GASSES DEFINES THESE CONCEPTS DIFFERENTLY, PARTICULARLY TEMPERATURE. That’s important because average translational kinetic energy is what we’re defining when we talk about the temperature of a gas, particularly in the real world. Vibrational energy is a temporary form of internal energy that isn’t really relevant when we talk about the macroscopic properties of a gas like Temperature, pressure and Volume; those qualities are very specifically derived from average translational kinetic energy of the molecules in the gas.

    Let me clarify, I’m not suggesting you can’t get more “heat” moving through the gas when you illuminate it with IR; the thought experiment is very carefully designed to see if it will increase Volume or Pressure. I understand quite specifically that the definition of Temperature in the Ideal Gas Laws is different to that described by the Kinetic Theory of Gasses.

    SO, if we illuminate our “balloon” with infrared radiation at 4.3 microns, we would expect any increase in the average translational kinetic energy of the molecules inside the baloon to manifest itself as an increase in pressure, which we could measure as a change in the volume of the balloon (offsetting the pressure increase somewhat, I do realize) So, can the balloon expand by illuminating it with infrared at 4.3 microns? Based on what I’ve read and understand, I can’t see how.”

    Fun stuff, anyone got some extra insight to offer?

  38. 38
    Lynn Vincentnathan says:

    The real “ClimateGate” is not leaked emails, but a leaked CONFIDENTIAL Internal Note by the Secretariat at the UN Climate Summit — see

    They have calculated that the estimated increase in warming will be 3 degrees under current commitments, and wrote that this estimated temperature rise of 3 degrees “will reduce significantly the probability to stay within a temperature increase of 2 degrees Celsius.”

    Climate Interactive, however, using those same commitment figures estimates a 3.9 degree increase by 2100, with a CO2 concentration of 770. So even the leak is a sham.

  39. 39
  40. 40
    ZZT says:

    Absolutely, Scafetta should release both code and data.

    Hopefully, the upsides of the appalling climategate affair and aftermath will be that peer reviewing standards are improved (or actually enforced) and that openness with respect to codes and data are paramount.

  41. 41
    Dennis Hamilton says:


    Please help me understand: subtle changes in the relative percentage of CO2 gasses in our atmosphere can create an undeniable case for man-made warming yet large changes in the radiation from the veritable house furnace can be easily explained away whilst keeping the same man-made conclusion. Seems to me that the solar piece of this puzzle needs some serious attention, I assume you rest easy that the solar anomalies are properly calibrated in AGW theorem?


  42. 42
    Pete D says:

    Are you seriously suggesting that where critics are unable to replicate results without the data and code, authors should release it just to prove a point? What about IPR?

  43. 43
    John MacQueen says:

    “You learn more my doing it yourself and that was what we tired first. But if the return criticism is that you didn’t do it exactly right, and the published description is insufficient for you to do that, it would seem sensible to look at the code to get that out of the way.”

    Isn’t that McIntyre’s line?

    Nevertheless while learning more doing it yourself is a good point, releasing data and code as used on publication does not preclude one from doing it for one’s self.

    I support the position he should have archived it as used and released it with publication.

    It just seems to be good practice for all, especially in a science that has so much of humanities future riding on it.

  44. 44
    Brian says:

    Off subject, I just read tis article about a paper that you coauthored and I have a question
    are you saying that the warming caused by all the non-carbon dioxde GHG is equal to the warming cause by CO2?

    [Response: No, but close. Non-CO2 GHGs are about 40% of the total GHG effect. If you include black carbon and ozone, then CO2 while still the biggest single term, is slightly less than half (with some uncertainty). But note that CO2 is currently the fastest growing factor and is the only one that under BAU has the potential for really big impacts in the future. -gavin]

  45. 45
    ZT says:

    At least the code and data weren’t lost in an office move…

    (mind you, if you keep asking, they might be…)

  46. 46
    Richard K says:

    Here is an independent interview on the CRU data. He states he is not a sceptic and points out problems in the code. I would appreciate your take on this. Thanks

  47. 47
    Paul Farrar says:

    For what it’s worth, I was able, using information in the papers, to verify the numerical results of both Friis-Christensen & Lassen (1991) and Svensmark & Friis-Christensen (1997). I don’t, of course agree with either, and I think the first one definitely shouldn’t have been published, since it’s easy to see that the curve match is just coincidence and an artifact of their processing. (Laut and Gundermann were the first to say this in print I think.) As for S&F-C (1997), my take is in Farrar (2000) in Climatic Change.

  48. 48
    John Mashey says:

    1) It may be instructive to see watch Scafetta 2009 talk for EPA,
    and look at the slides, which end:

    “cooling is expected until 2030 – 2040 because of a 60 year cycle.”

    See also p.62-, in which Rhodes Fairbridge is mentioned…

    2) Recall that while Scafetta is at Duke, West is sometimes listed there, and sometimes at Army Research Office over at RTP. His Adjunct Professor Duke office contact gives an email at ARO and a phone number over there as well. This is the ARO.

    Here’s a list of Scafetta publications/.

    this 2009 paper says:
    N.S. thanks the Army Research Office for research support

    this 2007 paper says:
    Acknowledgments. N. Scafetta thanks the Army Research
    Office for support, grant W911NF-06-1-0323.

    and 2004 paper says:

    N.S. thanks the Army Research Office for support under
    Grant No. DAAG5598D0002.

    3) Exactly why our tax money goes to the Army to fund such research is unclear to me. I have often worked with military folks who at least seemed to be spending the money on what you’d expect, but this seems “odd”.

  49. 49
    Scott Fox says:

    This is what we call circling the wagons. :)

  50. 50
    Chris Crawford says:

    I will here attempt to answer the question posed in #35. This boils down to a long, complicated and overly technical sequence that doesn’t quite follow strictly at several steps. The important point is really quite simple: if you irradiate a gas with EMR that the gas is capable of absorbing, then you are putting heat energy into the gas and it will increase in temperature. The increase in temperature will create an increase in pressure. All your worrying about vibrational and translational motion seems overwrought to me. Yes, vibrational motion can translate into translational motion; imagine two vibrating rubber balls bouncing off each other. If one is expanding at the moment it collides with the other, it will impart some energy to it.

    But again, think in simple terms, not complicated terms. The IR is energy; you’re putting energy into the gas and some of that energy is absorbed by it; the energy is then dissipated through the gas; the gas heats up. If you have problems getting an intuitive grip on this concept, put some water in a microwave oven, turn it on, wait, turn it off, remove the water, and test its temperature with your finger.