Patrick Applegate — Climate Risk, R, and Publishing a Free Textbook
Patrick Applegate is a Scientific Programmer with SCRiM, the Sustainable Climate Risk Management Network at Penn State, and co-editor with Klaus Keller of the free Leanpub book Risk Analysis in the Earth Sciences. In this interview, Len Epp talks with him about his path from geologist to data scientist, sea level rise and geoengineering, the R programming language, and his experience publishing an open-source textbook.
Len Epp: I usually like to start these interviews by asking people for their origin story. How did you first become interested in your academic field, and what was your journey to your current position with the SCRiM network at Penn State?
Patrick Applegate: I actually started out life as a geologist, but ended up in this position, and along the way I ended up as a data scientist and a technology educator. It turns out there are lots of different kinds of geologists, and I was the type of geologist who goes and looks at glaciers to see how they’re changing, and at traces in the landscape that tell us how glaciers have changed in the past. We do this because glaciers are really sensitive to past climates, so they can tell us about how the climate has changed in the past. We’re also really interested in glaciers and ice sheets because when they melt, they make sea level go up. If all the ice on land right now were to melt, sea level would go up by tens of meters or hundreds of feet, and people living along the coast would definitely notice that. People are already starting to notice that. If even a small fraction of the land ice that’s out there right now were to melt, that would really matter for people. Understanding the past helps us say something about the future.
So I stopped being a straight-up geologist and became more of a computer person during my PhD. The landscape tells us how glaciers changed in the past, but we need a time signal in order to get at rates of change. There’s a method out there that lets us take samples from the landscape and figure out the ages of different landforms, and that provides the time signal we need. Turns out that method isn’t perfect. There’s a lot more noise in the data than we would expect based on our measurement techniques. So I spent my PhD developing computer models that help us to understand that noise and to pick out the signal in already published data sets. That was my first step towards being somebody who spent more time in front of a computer.
Then a couple years before I finished my degree, the fourth Intergovernmental Panel on Climate Change report came out, in 2007. The IPCC is a big body organized by the United Nations, and it organizes scientists to assess every few years what’s known about the climate system and how it works. One of the main conclusions of that 2007 report was that we really didn’t know how the great ice sheets were going to contribute to sea level rise in the future. That really surprised me, because at that point people had been building computer models of how the ice sheets work for decades. We know a lot about how ice sheets behave. So my question was, well, how is it that we still don’t know enough to predict what’s going to happen with the ice sheets and sea level rise? To try and understand this better, my first job after my PhD involved going to Stockholm University in Sweden and working with one of these computer models to try and understand where these remaining questions were coming from. So there again, step number two away from being a geologist towards being a computer person.
Eventually that project came to an end and I moved back to the U.S. I kept working with sea level rise, but the group that I moved into, the SCRiM group, uses the R programming language for everything. This is one of the key languages that people use in data science, a discipline that combines programming, statistics, and a real understanding of data to pull out insights. I know that you’ve already interviewed Roger Peng, Jeff Leek, and Brian Caffo for this podcast series, so it’s a lot of fun to be following them here. During my time here I’ve spent a lot of time writing code and a lot of time teaching other people how they can write their own code. I co-taught a course that developed into the book that we published with you guys at Leanpub, and then I spent a year as an instructor at one of our branch campuses, bringing programming into those courses, which was a lot of fun. At some point I realized that I really enjoy writing code and teaching other people to write code. That’s the story of how I went from being a geologist to being a data scientist and technology educator.
Len: Tell us a little bit about the Sustainable Climate Risk Management Network, what its purpose is, who the people working on it are.
Patrick: SCRiM is a network of people, mostly at universities, who look for strategies to help us manage the risk caused by future climate change. We expect that climate change is going to have consequences for us now and in the future, and we’d like to figure out how we can best address those challenges. The network’s mission statement says that the strategies that SCRiM is trying to come up with need to be sustainable, scientifically sound, technologically feasible, economically efficient, and ethically defensible. I’m just reading from the website here so that I don’t mess this up. As you can imagine, creating strategies that satisfy all those requirements requires bringing together a lot of people with very different expertise. SCRiM is this organization that makes that conversation possible. And I should mention that what really makes this work is a generous grant from the U.S. National Science Foundation. So we thank them for that support.
Len: You had an article published in 2015 about something called solar radiation management geoengineering. Could you explain as an expert a little bit more about what that is, and maybe talk about climate engineering more generally?
Patrick: One of the things that I loved about Jeff Leek’s podcast in your series here was that he was careful to say at some point, “that’s actually a little outside my expertise.” So I’m going to give you a partial answer here and try to flag the parts that I know more about versus the parts that I know less about.
The part of this problem that I’m the most familiar with has to do with the connection to sea level rise and the ice sheets. Solar radiation management, which is also called albedo modification, is the idea that we could deliberately change the Earth’s climate to be something that we would prefer, by changing the Earth’s reflectivity essentially. If we were to somehow make things so that a little more solar radiation went back into space instead of making it through the Earth’s atmosphere to the surface, then that would make things cooler down here and maybe we would like that better. I should mention that this technology has not been tested. People are starting to talk about testing it. There are other strategies out there for potentially changing the climate. But the aspect that we looked into had to do with claims that some scientists had made that this would help us avoid sea level rise.
On the face of it, this makes a lot of sense. As temperatures go up, the glaciers and ice sheets melt, the ocean waters expand, and that all makes sea level go up. So it seems pretty logical that if you were to just make it so the temperatures went down or didn’t go as high, that should save you from sea level rise. Our work involved using one of these computer models of ice sheet behavior, and what we were able to show is that it’s a lot less effective than you would think in terms of preventing sea level rise from the ice sheets. That anticipated benefit of solar radiation management and other geoengineering schemes probably won’t materialize if they’re put into practice.
Len: And why is that?
Patrick: What’s going on is that the ice sheet creates its own weather, because it’s both white on the top, which makes it reflective, and it’s also tall. There’s the thing called the atmospheric lapse rate, which means that temperatures decrease with elevation. The higher you go on a mountain, the colder it gets. Because the Greenland ice sheet’s a couple kilometers tall above sea level in its middle part, and because it’s reflective, it’s cold up there. But if the ice sheet gets a little bit smaller, then that reduces that weather-generating effect that the ice sheet has. So if it shrinks a little bit and then you try to save it by bringing the temperature down, you’re unlikely to be successful, because the system develops an inertia that keeps it going in the direction you don’t want it to go.
Len: I think a lot of our listeners are on board with the idea that climate change is real, and many of them know that a rise of tens of meters would be very disastrous. It wouldn’t just mean some beaches go away. Without committing yourself to any kind of position professionally, what’s your personal feeling about the direction things are going with respect to attempts to mitigate the future impact of climate change?
Patrick: I want to be careful to emphasize that we’re not talking just yet about a future where sea level goes up by hundreds of feet or tens of meters. It’s more that relatively small changes can still create problems for us, and we want to think in advance about how we’re going to meet those challenges. That’s really what SCRiM ends up being about, understanding what the challenges might look like and developing strategies to try and address those. In terms of where I feel our efforts are going, there I really have to say that is totally outside of what I can address. I’m sorry.
Len: No, that’s okay, and I appreciate your being straightforward about that. I can see from your bio that you’ve taught college-level courses and done two postdocs, and I wanted to ask about the value you see in university education. Especially in the startup tech scene, there are people who repeat the refrain that university education is no longer necessary, as the more extreme version of “we should all learn online now.” I was curious to hear your opinion.
Patrick: The value that I have seen in my education is that, from a straight-up personal level, I’ve gotten to do a lot of cool things as a result of it. I’ve gotten to do field work in Greenland and Peru and the western United States. I’ve gotten to visit glaciers in Canada and Iceland, lots of different places, and that’s the kind of thing that I certainly wouldn’t have received if I’d studied all these things in an online program. Also, there is a habit of thinking and a way that you’re taught to think in advanced education that you certainly can’t acquire for yourself outside of it. I still think that the system of graduate education that we have here in Canada and the United States and also in Europe is really very excellent, and that’s something that’s worth preserving and maintaining.
Now, I can speak to the other side of your question, because I have gone on all these Coursera courses and also done some online education through Penn State. If you’re a very self-directed learner, absolutely you can pick up everything you need to know that way to do lots of different things. For sure, if your goal is to be someone who’s more on the tech side, then maybe the best strategy really is to do some personal projects, get involved in projects that other people are doing, find a code base to work on, and pick up what you need to know from the internet. But if you’re doing something that’s more hands-on, or requires you to travel and see things, I still think in-person education winds up being a good way to go. Better or worse, I won’t say.
Len: Turning to your book, you mentioned the programming language R. Could you explain why its popularity is growing amongst scientists and data scientists in particular?
Patrick: R is a great language because it’s free, it’s open source, and there are a lot of people that use it and they share their code. If you’re working at a university or a company that has site licenses for whatever statistical packages you want to be using, that’s all fine. But if you’re cash strapped or you’re working in a smaller organization, it sure is nice to know that there’s a full-featured statistical and computing environment that you can just go download off the Internet and do whatever you want with. We’re getting to the point in the modern world where you really can operate almost exclusively in a free software environment and not have to pay for things. It used to be that if you wanted a good vector drawing program, you had to get Adobe Illustrator. These days you can go download Inkscape. It’s the same way in scientific computing. Pretty much everything you need can be had for free.
The other part of it, I mentioned that people share their code. R has this great system called the package system, where in one line of code you can download and install these nicely formatted software libraries that other people have written, and then you’re off to the races. That’s just a tremendous time saver, because it saves you from reinventing the wheel and also from testing any tools that you might build. You could write your own Markov chain Monte Carlo algorithm, for example, but why would you when someone else has already done it and a million people have used it and it works.
Len: Speaking of free versus paid, when you were first getting on board with Leanpub, you emailed us and asked us to set your book so its maximum price would be zero. Just to explain to people listening, this is relatively unique. Leanpub books are sold on a variable pricing model: you set a minimum price and a suggested price, and customers can pay anything from the minimum up. You can set both to zero, but it’s still possible for people to pay for your book. If you email us, like Patrick did, we’re happy to set the maximum price to zero so that it’s a totally free book that people can’t pay for. I wanted to ask you to explain why the book is free.
Patrick: Well, you probably have already guessed the answer. As I mentioned, we were funded to do all the work that the book is based on by the U.S. National Science Foundation. We got paid to do this from public funds, and it seemed to us best to make that free and open source. Not only is the book free on Leanpub, but you can go download all the source off GitHub and build your own book if you want. We felt that this was really the most honest way of distributing what we had done so that other people could use it.
Len: We don’t currently have a ton of textbooks on Leanpub, but we would love to have more. From your perspective, is there anything missing from Leanpub that might help us attract more textbooks or accommodate the needs of textbook authors and editors better?
Patrick: I can’t think of anything. I do think that Leanpub is a great platform for publishing this kind of thing, so you have some penetration, particularly in the technology field already. I wouldn’t be surprised if in the future you had more people writing textbooks there. I’ve contemplated putting together essentially book forms of notes from classes that I’ve taught. I wouldn’t hesitate to do it.
Len: Do you think that for a textbook author, the in-progress model of publishing that Leanpub allows might be useful? I’m curious if someone writing a textbook would be open to changing a chapter based on feedback they’ve publicly received from a reader.
Patrick: That’s a good question. The in-progress model that Leanpub follows is tremendously helpful to us. We’ve recently released an updated version of the book that incorporates a lot of feedback that we’ve gotten from our classroom users. Some of the authors have taught a course with the book and gotten feedback where people said, “hey, this part needs improvement. I didn’t understand it.” So where we can, we’ve gone and fixed those things. We’re also going to add a bunch more chapters. The book’s going to get something like 50% longer in the not too distant future. I would think that particularly for fast-moving fields, that’s very nice.
In terms of traditional textbooks, you have to have some kind of minimum length. Ideally, a textbook is something that you can use to teach a one-semester course or even a full-year course. You do want to make sure that your book has some number of chapters before you publish it. If you’re going to be doing a calculus textbook, the body of knowledge there does not change rapidly, and also it has to be a particular length in order to be of use.
Len: That’s a very good point. A professor isn’t going to buy your book on the hope that chapter five will be ready in time for week five.
Patrick: Yeah, the standard for the minimum viable product for a textbook that’s going to be used in the classroom is probably a bit higher.
Len: I believe you wrote your book using your own tools, produced a PDF, and then uploaded it to Leanpub. I’m curious if you would think about writing in plain text, in Leanpub-Flavored Markdown or Markua as we’re developing in the future.
Patrick: Potentially, yes. This was a case where we had a technology in mind that we wanted to use to write the book, and I got really excited when I realized that Leanpub would let us put up our own homebrewed PDF. I noticed recently that you do have GitHub integration, which could make this very simple for us. The reason we did things the way we did is because in R you have this great technology called R Markdown. It’s R-flavored Markdown, and it lets you have pieces of R code interweaved with your human-readable text. The interpreter goes through, generates a nice LaTeX document, and then turns that into a PDF, but it also processes the code and dumps any results to the PDF document. That is very nice, because if you then go back and change the code part of the document, you don’t have to remember to update the output part. You just have to check and make sure it doesn’t look funny afterwards.
Len: Do you intend to make a print version of your textbook?
Patrick: We haven’t thought about that. Certainly that is a discussion that would have to happen with particularly my co-editor, Klaus Keller, but also the other authors, and that’s something that hasn’t come up so far.
Len: One thing I always like to finish with: if you could ask us directly to add one feature or fix one problem and we would go to work doing it for you, what would that be?
Patrick: You and I had a little email correspondence recently about the past downloads page, and this is so trivial that I hesitate to bring it up. Let’s just say no. I can’t think of anything substantial. From an author’s side, I don’t think there is anything.
Len: One last thing, is there anything that I left out that you wish I’d asked you about in this interview?
Patrick: I want to be sure that I give appropriate credit to my co-authors on the book. It’s been great fun to work with these people. The people who are on the book right now include Klaus Keller, Ryan Sriver, Greg Garner, Alexander Bakker, and Richard Alley. I should mention Klaus in particular. He’s head of the SCRiM network and he was co-instructor on the course that gave rise to the book. Ryan’s an atmospheric scientist who thinks a lot about tropical meteorology and hurricanes. Greg’s an atmospheric scientist who works on decision science. Alexander thinks about sea level rise. And Richard Alley is a great guru of ice sheet science and climate science in general. There’s a lot of different expertise among the people who’ve been involved with this book, and we’re only going to add people as time goes on.