Wednesday, October 21, 2009

Planet Money blows it

The most recent episode of Planet Money talked to an American oil worker in Angola and an Angolan about the differing ways of experiencing their country. This is a noble thing, indeed and I have no complaints about it – in theory. But I think they really dropped the ball this time.

In particular, there was a discussion about the Chinese government hiring Chinese laborers to build Angolan infrastructure as part of deal to guarantee oil prices to China, but they missed the obvious question: how many Angolans does the oil company hire vs. foreigners? Who's getting the $20,000/mo rent for the American's apartment?

But the thing that surprised me most was the way in which they seemed surprised at what the Chinese were doing.  This sort of thing has been SOP for aid-giving countries for decades (though they don't usually send labor). I once met a woman at dinner party who worked for a company that existed only because of aid tying. (The company made very large pipes for use in water/sewer systems), a friend of grew up in Egypt because his parents sold American farm-equipment around North Africa.  Obviously American farm-equipment is of high quality, but nonetheless, the people were "buying" it with American aid money and had no choice but to buy from an American manufacturer.

Similarly, the oil for infrastructure deal is as old as colonialism – think of the Reuters Concession in Iran in the late 1900s, or any number of "concessions" that were forced upon the decaying Ottoman empire in the 19th century. Similar arrangements were widely made in Africa. Chances are our American oil worker is working for a company with quite similar "arrangements".

In general, I think Planet Money has been fantastic at exploring economic issues (albeit with something of a tendency to gloss over or ignore serious critiques of the statements given by their various interviewees), but so far their work on the economics of development has really been lacking.

Come to think of it, I think maybe their thinking is just too narrow - much like economics in general, they try to oversimplify the world to fit into economistic models rather than looking at the societies and politics that economics is operating in. Like many economists they forget that economics is not physics - it's not something that operates independently of human beings. It is a creation of human beings – something we should always be careful to remember. This, of course, was so elegantly argued by Karl Polanyi decades ago, but is so easily forgotten.

Here's hoping that in the future they take a bit more care in how they report and who they choose to discuss development economics. I'd love to see them get someone like Ha-Joon Chang – but that might be hoping for too much.


Monday, October 5, 2009

Buffering only the upslope areas of a DEM

OK, here's the solution to the problem proposed in my previous post.  It's not a perfect solution, as it doesn't account for all possible types of terrain (more on that below), but it's pretty close and in the data I have, works pretty well.

The first thing to do is take care of the slope and the 10' elevation change in one swoop. By adjusting the size of our pixels, we can make sure that any change in the slope that meets the 40% rule also meets the elevation change. In other words, what is the minimum Δx (i.e. the resolution) that yields a change of Δy>=10' at an angle θ?

  • Because: y=x·sin(θ)
  • We substitute: 10= x·sin(tan-1(.4))
  • Solving for x yields x=26.9. We round that to 27 for convenience.

  • Now calculate your slope raster with an output resolution of 27ft (or equivalent, depending on your projection).
  • Reclass that raster so that everything < 40% is null.
  • Using your >=40% layer assign a value to each grouping (in GRASS, this is r.clump; in Arc*, this is the Region Group tool from Spatial Analyst).
This next part is hard because looping pretty much requires a programming language - I used GRASS (wrapped in a shell script), you could use AML or Python if you're an ESRI user.

For each group:
  • Find minimum elevation in that group
  • Buffer out 300' from the group
  • Delete all pixels from the buffered region where slope is null and elevation is less than the minimum for that group.
Ta da!  You have a raster buffered out 300' upslope.

But wait....

What if a pixel is both downslope from one face and upslope from another? (Imagine a ledge or an old lake shoreline like the bench in northern Utah created by Lake Bonneville.)  Well, in this case, we will have eliminated those pixels, which we don't want to do.

We can solve this by taking an intermediary step - creating an empty raster, then instead of deleting the pixels, do a logical OR against the output of the previous iteration of our loop. This allows us to keep our pixels if they're within 300' of any upslope region.

Unfortunately, that loop can add some significant processing time, anyone have another way to do it?

Thursday, October 1, 2009

Interesting challenge

Given that lately I've been doing a lot of ETL, which involves working with a lot of low-level data structures and data transformation, I don't get much chance to think about some interesting analysis problems, particularly raster based ones. But today, I got presented with one.

Using a DEM, create a 300' buffer around any slope greater than 40%, where the change in elevation from one edge of the slope to another is at least 10', but buffer only on the upslope side.

How would you do it?  I'll post my own answer soon.