Friday, January 9, 2015

New Toy

One of the things on my list of long-term projects is a DIY book scanner. There are a ridiculous number of paper books in my house, and I'm getting old enough to think about downsizing the living quarters at some point. Lots of people have done impressive things in the field, like this one. Being who I am, though, I want a system where the hardware is simpler and smaller, even if that means that the software has to be somewhat more competent. The rough rule-of-thumb of "put everything possible into software" served me well for 25 years in a high-tech field, and I'm not about to give it up.

The usual camera people put into a DIY scanner is either an old smartphone or an old snapshot grade digital camera.  Those are cool, particularly if there's one or both readily at hand.  My own experience with them, at least with a book scanner in mind, is getting them to take the picture when I want it, and to get the picture out of the camera into a computer where it can be worked on.  One a different tack, I've also been wanting to spend some time playing with a Raspberry Pi computer.  Hoping to get two birds with one stone, I purchased a Pi (model B+), a micro-SD card that would let me set up Raspbian easily, and a five mega-pixel camera module.

After going through the old electronics box, I plugged a monitor into the HDMI port, a keyboard and mouse into two of the USB ports, plugged in an Ethernet cable to tie it to the switch in my office and powered it up.  Looked like... Linux.  I felt like the little girl from Jurassic Park: "It's a UNIX system.  I know this!"  The second day I put all of the old electronics back in the box and just ran "ssh -Y" with the appropriate options from my Mac. I haven't gone very far with the camera yet, besides configuring the Pi to use it and verifying that it works. On the other hand, I have spent some time entertaining myself by porting a variety of small software that I've written over the years to the Pi.  Just to see how things went. And "porting" implies that the process was harder than it actually was.

After fooling around for a bit, I copied part of my collection of cartogram software over to it. One of the core pieces is written in C – after downloading a couple of needed libraries (using the provided Debian aptitude and apt-get commands), those just compiled. My front- and back-end code that sets things up for those core number-crunching programs is written in Perl – had to download the GD module, but that also just worked. Copied over some data and map files and ran things and – cartograms! Things ran pretty slowly, but the chip doesn't have the kind of heavy-duty double-precision floating point hardware support that "real" processors provide.

I'm looking forward to seeing how much of the job can be done on the Pi.

Thursday, November 6, 2014

Why Did I Think It Would Take Longer?

One of the things that I anticipated would happen, when the Republicans regained control of the US Senate, was that movement conservatives would start talking about opening the Yucca Mountain nuclear waste repository.  I thought it would be somewhere down the line, after they had dealt with the PPACA, tax rates, and (in the energy realm) CO2 regulation.  Silly me.  In today's George Will column in the Washington Post, George has it on his list of six things the Republicans should do very first thing.

I know I'm not entirely rational on the subject.  For many years, though, it has struck me as odd that there were a bunch of people making arguments that spent fuel is safe enough to store less than 100 miles upwind of a major metropolitan area in the West, but it's not safe enough to store in the states where it's produced.  That the dry storage casks are so tough that nothing can happen if they fall off of a truck or train in a Western state, but not tough enough to be safe to store in the states where the waste is produced.  And politically, pundits who oppose the idea that the federal government can ever force anything on individual states seem to be just fine with forcing transport and storage of spent nuclear fuel on states that (a) don't want the stuff and (b) mostly don't have reactors of their own producing waste.

I've said it before, but the federal government's record is not encouraging.  Ask people near Hanford, Savannah River, or the former Rocky Flats how they feel about it.  The first radioactive waste arrived at the Waste Isolation Pilot Plant in New Mexico in 1999, which is supposed to be safe for at least 10,000 years.  This year, americium and plutonium particles were detected above ground a half-mile away from the facility.  Granted, the containers from which radioactive material leaked were much less robust than dry casks in which spent fuel is stored.  OTOH, I'm inclined to agree with Ryan Flynn, New Mexico Environment Secretary, at a news conference after the WIPP incident: "Events like this simply should never occur. From the state's perspective, one event is far too many."

Tuesday, October 28, 2014

A Different State-Splitting Trend?

In 2013 there were a number of proposals put forward to create new states by splitting existing ones.  The most widely covered ones have been Colorado's 51st State movement, the State of Jefferson movement in far northern California and southern Oregon, and the movement in western Maryland.  One thing that all of these have in common is that they represent more rural portions of the states in question seeking to "escape" from the urban parts of the states.  Certainly in the cases of California and Colorado, the escape would come with a hefty price tag -- the rural areas that want to leave are subsidized financially by the urban areas.

This year there have been two new state-splitting proposals with the opposite perspective: urban areas seeking to be free from the rural areas.  The first of those was the ballot initiative in California that would seek to split the state into six parts.  Funding for signature collection came from a Silicon Valley venture capitalist who reportedly believes tax rates in his new state would would be substantially lower because they wouldn't have to subsidize the Central Valley and rural northern California.  Too few signatures were collected for the initiative to make this November's ballot.  The second is a proposal to split off southern Florida, so the urban areas there could begin taking steps to deal with climate change consequences like rising sea levels.

The proposed split of Florida is shown in the upper portion of the figure to the left.  Things are in an early stage.  South Miami's city commission passed a resolution calling for the separation and will now send the proposal to the 24 counties that would be South Florida.  As is true for so many of this type of proposal, this one probably won't go anywhere.  The hurdles for actually splitting a state are pretty darned high.  Among other things, Congress would have to bless it, and the balance of power between political parties, particularly in the Senate, becomes a major consideration.

Why do I say this is a movement by an urban part of the state to flee the rural part?  The lower part of the figure is a cartogram with counties resized to represent population.  The green line shows the proposed division between north and south.  The red/blue coloring is the standard one for election cartograms and shows whether the county voted majority-Obama (blue) or majority-Romney (red) in 2012.  The three biggest urban areas in the state -- Miami, Tampa, Orlando -- would be in South Florida.

Thursday, September 18, 2014

Write Like the Wind

Today, in my e-mail, was a request for a political contribution.  That's not unusual, but today, to sweeten the pot, I was offered the chance to win a dinner with George R. R. Martin, author of the Game of Thrones series.  I don't dare send them any money; I might win.  Then I would find it necessary to play the video below at the meal, because neither George nor I are getting any younger and it would be convenient if he finished the damned series before one of us dies.

Monday, August 18, 2014

It Takes More Than Turbines

The Telegraph ran a brief story earlier this month about UK regulators paying wind farms in Scotland nearly £3.0M to not generate so much electricity for one day.  High winds due to the remnants of Hurricane Bertha coincided with a period with low local demand for electricity, and the grid lacked capacity to carry the available power elsewhere.  Such situations are neither new, nor confined to the UK: in both 2011 and 2012, the Bonneville Power Administration ordered wind generators in Oregon shut down to avoid oversupply problems.  The problems in both cases are not that the grid isn't smart enough to handle the intermittent nature of wind; the problem is that the grid lacks sheer bulk transport capability to move the excess wind power to someplace it could be used.

The map to the left is a portion of a graphic from an NPR story about the US power grid, showing the US portion of the Western Interconnect.  The bold orange lines represent a proposal by the American Wind Energy Association for an overlay high-level grid that would allow full use of wind when it is available in a geographically diverse set of sites.  This overlay grid passes "close" [1] to all of the major population centers in the West, as well as the best of the wind resources.

Building a reliable grid from intermittent renewable sources requires not just geographic diversity, but source diversity as well.  The AWEA overlay also happens to pass close to excellent solar resources in the desert Southwest, undeveloped hydro resources in the Northwest, geothermal resources in the Great Basin, and sites suitable for pumped hydro energy storage.  Balancing all of those resources against demand across eleven states (plus western Canada and a bit of Mexico) is a complex but doable task, given enough bulk transport.  Speaking broadly, the situation in Oregon with too much supply and not enough demand shouldn't happen.  If there really are no consumers for it, it ought to be pumping water uphill against future need.

The AWEA isn't the only group that draws proposals for overlay super grids [2].  In the Western Interconnect, they all tend to look similar.  As I've noted in other posts, geography plays a big role.  The people are concentrated in a small number of areas; the easy routes for transportation or transmission are few and obvious; the energy resources are where they are, many of them either close to one or more demand centers, or along one of the routes between those demand centers.  This is a good part of the reason that people can draw up nuts-and-bolts sorts of plans for a heavily-renewable power grid in the Western Interconnect.  The other parts of the country present a much more difficult challenge.  And as always, I raise the question of whether those other parts of the country will demand a single national energy policy that makes the West's efforts difficult or impossible.

[1] "Close" in the West can be rather different than close in other parts of the country.  As in, "it's only a hundred miles", or "it only has to cross one mountain range".

[2] The AWEA map does get used a lot, though.  Part of that is probably that it shows up in Wikipedia's Wikimedia Commons, unencumbered by copyright.  An interesting feature of the full national map is that it doesn't show any additions in the Southeast part of the country, where wind resources are rather poor.

Sunday, August 3, 2014

TABOR Conspiracy Theory

I let myself believe in conspiracy theories on alternate Tuesdays; that'll be relevent in a moment.

TABOR -- the Colorado Taxpayers Bill of Rights -- added a section to the Colorado state constitution in 1992 that, among other things, said the state legislature couldn't pass tax increases, they could only refer such measures to the voters.  In 2011, a group of state legislators sued the State of Colorado, asserting that setting tax rates is a fundamental job of government, and that by denying the state legislature that power, the state constitution was in violation of the Guarantee Clause of the US Constitution.  If it's been a while since you read the Constitution, that's the sentence which requires every state to have "a republican form of government."

The conventional wisdom at the time was that the suit would be short-lived.  To borrow from the defense's summary, the federal court would promptly find that this fell under the Supreme Court's political-question doctrine, that the plaintiffs lacked standing, and that the case would be dismissed.  Things have not, so far, worked out that way.  The district court judge ruled that the plaintiffs did have standing; this case differed from the political-question precedents; and the arguments should be made at trial rather than in a preliminary hearing.  The defense appealed.

A three-judge panel of the federal appeals court, arguing de novo, ruled the same way: sufficiently different from the precedents, plaintiffs had standing, and ordered the case returned to district court for trial.  The defense appealed to the entire court for a rehearing.  This past Tuesday, I read that the full appeals court declined to rehear the case, thereby affirming the ruling by the three-judge panel.  Presumably, the defense will now appeal to the Supreme Court, so it will be at least a few months before anything interesting can happen.  The quickest would be if the Supremes declined to hear the appeal, in which case the district court would schedule a trial date; the wheels of justice do grind slowly.

My impression is that the defense has been poorly prepared throughout.  That they were assuming that "political question, no standing, case dismissed" alone would carry the day.  When I read about the latest development, I was struck by the possibility that this was intentional and not just a matter of overconfidence.  Both parties have found themselves tied in knots by TABOR when they controlled the legislature following a recession: the Republicans following the 2000-01 recession, and the Democrats following the one in 2007-09.  The single-subject amendment to the Colorado constitution in 1994 makes it unlikely that TABOR could be removed in its entirety; it would have to be cleared a bit at a time (some experts think as many as 20 separate amendments would be necessary under the current rules).  "What," I thought on Tuesday, "if the secret plan is to lose the TABOR lawsuit and let the federal courts accomplish what the politicians can't?"

Nah, that's too crazy even for me on a Tuesday.

Monday, July 21, 2014


A while back at Ordinary Times, there was an interesting comment thread on the subject of defining the Midwest region of the US.  One of the thoughts that occurred to me while reading that was whether it was possible to define regions based on inter-state migration patterns.  The idea grew, I suppose, out of my own experience.  I lived and worked in New Jersey for ten years, but never really felt like I fit in there.  Eventually my wife and I moved to Colorado, to the suburbs of Denver, where we immediately felt right at home.  Most people, I thought, might have been brighter than we were and not moved to someplace so "different."

I've also encountered a variety of nifty data visualization tools that look at inter-state migration in the US, like this one and this one from Forbes.  State-level data for recent years turns out to be readily available from the Census Bureau.  We can define a simple distance measure: two states are close if a relatively large fraction of the population of each moves between them each year.  "Relatively" because states with large population have large absolute migration numbers in both directions.  For example, large numbers of people move between California and Texas -- in both directions -- because those states have lots of people who could move.  From Wyoming, not so many.  Given a distance measurement, it turns into a statistical problem in cluster analysis: partition the states into groups so that states within a group are close to each other.  Since there's only a distance measure, hierarchical clustering seems like a reasonable choice.

The map to the left shows the results of partitioning the 48 contiguous states into seven clusters.  The first thing I noticed about the partition is that states are grouped into contiguous blocks, without exception.  While that might be expected as a tendency [1], I thought there would be at least a couple of exceptions.  The resulting regions are more than a little familiar: there's the Northest, the Mid-Atlantic, the Southeast, the Midwest (in two parts), the West, and "Greater Texas".  There are a couple of other surprises after reading the discussion at Ordinary Times: Kentucky is grouped with the Midwest, and Missouri and Kansas with Greater Texas.  New Mexico clustered with Texas isn't surprising, but New Mexico with Louisiana and Arkansas?  Hierarchical clustering is subject to a chaining effect: New Mexico may be very close to Texas, and Louisiana also close to Texas, and they get put into the same cluster even though New Mexico and Louisiana aren't very close at all.

One way to test that possibility is to remove Texas from the set of states.  The result of doing that is shown to the left. As expected, New Mexico is now clustered with the other Rocky Mountain states and Louisiana with the Southeast.  Perhaps less expected is that the other four states -- Arkansas, Kansas, Missouri, and Oklahoma -- remain grouped together.  None of them is split off to go to other regions; the four are close to one another on the basis of the measure I'm using here.

Answers to random anticipated questions... I used seven clusters because that was the largest number possible before there was some cluster with only a single state in it [2].  The Northeast region has the greatest distance between it and any of the other regions.  If the country is split into two regions, the dividing line runs down the Mississippi River.  If into three, the Northeast gets split off from the rest of the East.  There are undoubtedly states that should be split, ie, western Missouri (dominated by Kansas City) and eastern Missouri (dominated by St. Louis); a future project might be to work with county-level data.

[1]  My implementation of hierarchical clustering works from the bottom up, starting with each state being its own cluster and merging clusters that are close.  Using the particular measure I defined, close pairs of states include Minnesota/North Dakota, California/Nevada, Massachusetts/New Hampshire, and Kansas/Missouri.  These agree with my perception of population flows.

[2]  The singleton when eight clusters are used is New Mexico.  When ten clusters are used, Michigan also becomes a singleton, and Ohio/Kentucky a stand-alone pair.