Design and documentation journal for my interactive fiction (text games); also reviews and other miscellaneous stuff.

Wednesday, September 22, 2010

Innards: Growing Degree Days

Growing Degree Days is one of those wonky agricultural concepts that appears initially to make no sense whatsoever and then you realize that everyone ought to be using this. Like the metric system. (If you are living in a metric country: kudos.)

Here's the basic idea: Plant growth is a function not only of light, but temperature. Sure, plants need to be above a certain temperature to survive, but also above a certain temperature to grow. This temperature is different from plant to plant, but usually it's about 50F. Any lower than that, and it's better for the plant to wait for the temp to rise. Above that point, growth is not purely arithmetical; photosynthesis is temperature dependent (assuming full sun).There's a peak to the photosynthesis rate as well; as temperature rises past that point, proteins in the plant become less stable, and the rates slow pretty quickly. This is one reason that you're not necessarily better off in a greenhouse; if that thing overheats, you'll find growth slowing to a crawl even before heat stress kills your plants. That point is around 85-90F; usually plants will cope up to about 100F, and then flounder. Photosynthesis isn't the only reason for this, of course, but it is a major one.

If photosynthesis and growth were just tied to day length, farmers and gardeners could predict harvest dates with a high rate of accuracy. Unfortunately, while sun exposure is pretty constant, temperature swings way up in the summer. In about two months, the average temperature increases by 30-40F/day, with a corresponding burgeoning of plant growth. The bulk of growth happens in July-August because that tends to hit the ideal temperature range.*

There is a fantastically complex equation for putting all this together and calculating how much heat a plant has gotten, but it's complicated and involves curves and people like nice easy numbers. Growing Degree Days gets you pretty close to the real thing: The average of the highest and lowest temperature for the day, minus your base. If the number is less than 1, no growth happens (but neither is it reversed). You'll notice that most normal temperatures will give you more than one degree "day" per 24-hour period, but that's scientific acronyms for you.

The good news about GDD for FTA is that it gives you a single data point for maturity, and a single data point determining how close the plant is to maturity. The growing degree days to maturity for a given plant does not vary much, if at all; the growing degree days for a given day are easy to calculate and track. As an internal mechanism, it's hard to mess up, since it doesn't rely on anything except one extension.

Each day, the game grabs the high/low temp (Weather presents these as NTemp and Dtemp), averages them, subtracts 50, and adds any result above zero to any living, growing crop. A few crops, like cabbages, actually will grow below 50, so I may need to tweak stuff there.

The downside of this method is I need to track down these numbers and calculate them for any crop I want to put in the game. Despite the niftiness of GDD, pretty much every seed catalog uses plain old days (ie 110 days to harvest). This is subpar, since they rarely tell you where those 110 days take place. 110 days in Georgia are a far cry from 110 days in Maine, so there's a surprising amount of guesswork involved, but at least the chosen numbers will be internally consistent.

(The other nice thing this opens up is letting weather changes affect the whole crop without having to tweak various conditions. Which is nice.)

Small steps, but it's nice to get hold of helpful equations to drive the internal mechanisms - writing those is always the hardest bit.


* This also explains why you can plant, say, one tomato plant two weeks earlier than another, and they both ripen at just about the same point. The growth rate later outstrips the earlier growth dramatically, decreasing any advantage the early tomato might have gotten. Also, the earlier tomato may have had to deal with frost risk and a wider spectrum of hungry predators. The moral of this story is to let your neighbors plant the early tomatoes; you won't lose anything if you wait.


  1. So if everyone ought to be using the metric system, why are you giving all the temperatures in Fahrenheit? ;)

  2. Fahrenheit is actually a better system for crop management (arguably!). There's a bigger spread of temperatures (~50*F to 100*F vs. 10*C to 37*C). This increases accuracy and complexity without work, and decreases the need for decimals, which is good, because decimals are not a feature of Inform.

    Also, Weather (the extension) is written in *F, and consistency is a good thing. I could rewrite it, I suppose; I've already had to do some fiddling. But it would change a fair bit.

    Also also, most of the resources I'm using are USian, so they use F.

    So there is method to the madness.