sun, 30-jan-2011, 09:52

Location map

Location map

A couple years ago we got iPhones, and one of my favorite apps is the RunKeeper app, which tracks your outdoor activities using the phone’s built-in GPS. When I first started using it I compared the results of the tracks from the phone to a Garmin eTrex, and they were so close that I’ve given up carrying the Garmin. The fact that the phone is always with me, makes keeping track of all my walks with Nika, and trips to work on my bicycle or skis pretty easy. Just like having a camera with you all the time means you capture a lot more images of daily life, having a GPS with you means you have the opportunity to keep much better track of where you go.

RunKeeper records locations on your phone and transfers the data to the RunKeeper web site when you get home (or during your trip if you’ve got a good enough cell signal). Once on the web site, you can look at the tracks on a Google map, and RunKeeper generates all kinds of statistics on your travels. You can also download the data as GPX files, which is what I’m working with here.

The GPX files are processed by a Python script that inserts each point into a spatially-enabled PostgreSQL database (PostGIS), and ties it to a track.

Summary views allow me to generate statistics like this, a summary of all my travels in 2010:


Another cool thing I can do is use R to generate a map showing where I’ve spent the most time. That’s what’s shown in the image on the right. If you’re familiar at all with the west side of the Goldstream Valley, you’ll be able to identify the roads, Creek, and trails I’ve been on in the last two years. The scale bar is the number of GPS coordinates fell within that grid, and you can get a sense of where I’ve travelled most. I’m just starting to learn what R can do with spatial data, so this is a pretty crude “analysis,” but here’s how I did it (in R):

drv <- dbDriver("PostgreSQL")
con <- dbConnect(drv, dbname="new_gps", host="nsyn")
points <- dbGetQuery(con,
    "SELECT type,
        ST_X(ST_Transform(the_geom, 32606)) AS x,
        ST_Y(ST_Transform(the_geom, 32606)) AS y
     FROM points
        INNER JOIN tracks USING (track_id)
        INNER JOIN types USING (type_id)
     WHERE ST_Y(the_geom) > 60 AND ST_X(the_geom) > -148;"
points_ppp <- ppp(points$x, points$y, c(min(points$x), max(points$x)), c(min(points$y), max(points$y)))
Lab.palette <- colorRampPalette(c("blue", "magenta", "red", "yellow", "white"), bias=2, space="Lab")
spatstat.options(npixel = c(500, 500))
map <- pixellate(points_ppp)
png("loc_map.png", width = 700, height = 600)
image(map, col = Lab.palette(256), main = "Gridded location counts")

Here’s a similar map showing just my walks with Nika and Piper:

Hiking trips

Walks with Nika and Piper

And here's something similar using ggplot2:

m <- ggplot(data = points, aes(x = x, y = y)) + stat_density2d(geom = "tile", aes(fill = ..density..), contour = FALSE)
m + scale_fill_gradient2(low = "white", mid = "blue", high = "red", midpoint = 5e-07)

I trimmed off the legend and axis labels:

ggplot2 density map

ggplot2, geom_density2d

tags: GPS  gpx  iPhone  R  statistics 
sat, 29-jan-2011, 21:53

Deuce, On Chesil Beach

Deuce, On Chesil Beach

I’ve read a lot of Ian McEwan over the years, and it’s impressive how different his stories are, and how precise and well written they are. On Chesil Beach is a horror of a story where a single moment is fully visualized and expertly drawn, and when it, ahem, comes, you know that things will never be the same for the characters. I guess this is McEwan’s expertise: visualizing characters suddenly drawn into situations so far from their expectation that you never quite know how they will react.

In this case, one wonders if the outcome of the story would be different if the time or place were different? I should hope that a more modern sensibility, more open dialog about intimacy, perhaps even premarital sexual investigation, would prevent the sort of misunderstanding that’s at the center of this book.

Anyway, I enjoyed it, but I wasn’t as blown away as many of the reviewers were. I do like, oddly enough, what People magazine wrote about the book:

No one can unpack a single frozen moment better than McEwan.

Very true.

tags: books  Deuce 
sat, 29-jan-2011, 17:47

Genesee Beer

Genesee Beer

Most Fridays we get take out from our local Thai restaurant, Lemongrass, and sometimes we stop at a convenience store on the way to see if there are any interesting or new beers (and sometimes wine) available. Yesterday I saw one of these, a 24-ounce can of Genesee Beer. A couple years ago I found a six-pack of Genesee Cream Ale at Goldhill Liquor, but I haven’t seen straight-up Genesee since I left Rochester a couple decades ago. Needless to say, I bought it, and am now very much enjoying the refreshing, light taste, with just a bit more than a hint of corn in the flavor.

My favorite homebrew, Piper’s Irish-American Red Ale also has this subtle corn flavor. Corn (and later, rice) have a distinct place in American brewing history because it was a way to reduce the excess protein found in the 6-row barley that grew well in North America. By contrast, the traditional European brewing grain, 2-row barley, only has enough enzymes (protein) to convert it’s own starches to sugars, so there wasn’t a problem with excess protein in the final beer. With 6-row grain, there are enough enzymes to convert additional brewing adjuncts like corn, reducing the protein content in the final beer (and also, incidentally, making the beer cheaper to produce).

Genesee Brewing has been in continuous operation (except for during Prohibition, of course) in Rochester, New York since 1878, and is still an independently owned brewery that’s part of the North American Breweries name (along with Labatts, Pyramid, MacTarnahan’s and a few other small breweries). If you’re going to drink an American light lager, it might as well be a good one like Genesee instead of the mega-industry, foreign-owned, over-commercialized swill like Budweiser, Coors, Miller, etc.

tags: beer  Genesee  Rochester 
sat, 29-jan-2011, 14:27

Cold cabin

Cold cabin

Ever since I finished renovating the new cabin, we’ve been keeping it warm in the hope that we’ll find a renter for it. But once we passed the start of the semester at UAF, we essentially gave up looking and have been waiting out the winter to try renting it again. The place is heated by a oil-burning Toyotomi direct vent heater that was only a few months old when we bought the place because the previous heater had been stolen. In our house and the red cabin, we use a similar heater called a Monitor. In Fairbanks, “monitor” is the word people use to describe this style of direct vent heater. Unfortunately, MPI was purchased by Toyotomi and the line has been discontinued.

I’ve been trying to check on the new cabin every day, but I didn’t go over there on Thursday and when Nika and I went over there yesterday, the Toyo had quit working (WTF!?). I’d previously checked it around 4 PM on Wednesday, and finally got the heat back on at around 5 PM on Friday. It was 16°F in the cabin at that point. Over the course of those two days and one hour, the average outside temperature was -3.9°F. The cabin was 60°F when I left it on Wednesday, so it lost just under one degree per hour (although the heat loss is a function of the difference between internal and external temperature, so the heat loss isn’t linear). At that rate, it probably would have been above freezing if I’d checked on it on Thursday.

So mistake number one was not checking it every day. The heater had been so reliable thus far this winter that I got complacent.

Crawlspace icicle

Crawlspace icicle

Guess what mistake number two was? Thankfully I’d shut off the pump before closing the place up in fall, but there’s still at least 100 gallons of water in the tank in the bathroom, and water sitting in the pipes, pump and on-demand water heater. I went over there this morning to see if any of the pipes were cracked and if there was any water anywhere.

Initially there was no sign of damage except for a little water underneath the pump. After looking under the house (see the photo on the right), it’s clear that there’s a leak somewhere near the pump, and all the pressure left in the pressure tank pumped a few gallons of water onto the floor, where it found a way to get through the vinyl floor, the new subfloor I installed this summer, and down into the structure and eventually out the bottom of the cabin.

After fiddling with opening faucets, I eventually hit on some combination of open valves that released a vacuum near the hot water heater, and water started pouring out, so there’s a leak somewhere in the hot water heater as well as near or inside the pump. Later in the day I went back with an air compressor and forced air into the hot and cold water lines, opening and closing different faucets until I forced all the water out of the pipes.

Lessons learned: check on the heat every day, and if there won’t be anyone in there, make sure to blow out all the water lines. In spring I’ll be replacing the hot water heater and probably the pump. Hopefully the pressure tank and the washing machine weren’t damaged, but at least I don’t need to replace the water lines or the water tank.

tags: heat  new cabin  Toyo  water 
sat, 29-jan-2011, 13:37

Caslon and Montana 1948

Caslon and Montana 1948

Montana 1948 is a book published by Milkweed Editions, a non-profit press that attempts to “nurture and publish transformative literature.” I’m not sure what that means, but this is the second Milkweed National Fiction Award winner that I’ve read (The Farther Shore by Matthew Eck is the other). It’s a short little book told from the first person perspective of an adult recounting events that happened when he was twelve. It’s a simple story about family, small towns, and how each of the characters react to acts of violence against Native Americans in their community.

The main character maintains some distance from the events that take place—“I felt a contentment outside human society that I couldn't feel within it.”—and so he allows the reader to draw their own conclusions about what drives the other characters to do what they do. The author is very good at evoking the feel of the time and place of the story. An enjoyable read.

It’s a good looking book too, with a slightly shorter and wider page size than is typical, and a nice thick shiny cover. It’s typeset in Perpetua, which is a font I like, but I felt like the italics were too small for the body text (see the image below). I’m not sure how this would happen unless it’s an intentional feature of the font set. It looked funny to me.

Perpetua, small italics

tags: books  Caslon 

Meta Photolog Archives