Ice Trade, Ice Melt, & Messy Code

Posted on Sep 16, 2013 in Computational Media
Ice Trade, Ice Melt, & Messy Code

INSPIRATION: Edge Ops, Or Logistics in the Woods

So I’ve got a long-term, book-esque project that spatializes the material and logistical array of Thoreau’s Walden Pond.  The conceptual bent, like much writing on Thoreau, is to a) acknowledge the industrial, active nature of these peri-urban territories in contrast/complement to his dialectic idealizations, b) reconsider and re-visualize the forms of economic accounting, material resource cycles, spatial/survey geographies that Thoreau would’ve been familiar with, and thus c) do a project that combines past industrial ecologies, and taps into Thoreau acerbic, crazy, daytum-feltron-esque personal accounting. For me, it’s like the perfect architectural hut + landscape urbanist + Kittler/Foucault cultural criticism project.

Plus, it’s a project of happy convergences or origins in the history of quantitative forms: Thoreau himself was a surveyor; he lived in Concord, the birthplace of U.S. mortality statistics, public health research, and a host of other typically 19th century quantitative tools of governmentality, and Boston’s larger logistical centrality in the Antebellum period mean it’s awash in port tables, capitalist records, and over the top philanthropic ambitions, etc. etc. In that sense, Walden Pond is just the right place to stage an examination of statistical/data history in the vein of Ian Hacking, Peter Galison, and Lorraine Daston. I’m not a great writer nor historian (so much editing, so much narrative, so few asides!), but I would love to be able to create still and interactive ways for people to reflect on our current environmental accounting/sustainability epistemology and our current personal fascination/participation within the big-data moment.

So this week, I wanted to drag in some old data, specifically on Boston’s ice trade, and start to think about interactive options for skimming through it. Below, I’ve tossed on my old gis+illustrator+photoshop combo and highlighted the data that I’m going to focus on visualizing interactively.

composite_slide2markup-01

It’s actually a rather small chuck of the total project, but there’s also about 50% of those boards which are lovely photoshop or cad;  I want to tinker a bit before getting too much stuff in to my messy, messy sketch. (Baby Steps.) Plus, having spent some time is GIS, I know I don’t know the math for projections well enough to be fancy. This was a great opportunity to just use a good ol’ plate carre rectangular map and work with a simple map(long, lat, x, y) function for jumping into geodata.

Basically, the file includes three tables (a)location lat/long & country names, (b)volumes received by country & year, and (c) days in transit & melt remainders by country) which again pulls from Fry’s Table.pde class. There’s a very simple png map mask, a background for texture, and an array of font sizes/modes for header, italics, etc.  Everything is just scrappy loops, conditionals, variables, and residual coordinates. I’ll be more specific once it’s cleaned.

THE SKETCH: ICETRADE.PDE

Which give us: (note- pink dot on button is mouse position)

ice-00207

So below is without any of the mouse-activated areas being activated. (Ops, not true; we’re hovering on Australia.) The Mouse location dot and saveFrame are bundled, but the pink is hard to see against the pink data circles.

Mouse Activation includes: the volume shipped and volume arrived buttons, the mapped latitude and longitude points (consolidated by country), and the three sliders.

ice-00442

 

For the moment- there is a ton of copy & paste in this code- and a ton of random variables.

You can find that code craziness here.

A half-cleaned version is here.

(Copy & paste has become loops, variables are consistent and sliders are coded cleaner (if less visually pleasant), but I’ve not dealt with the overlapping text yet.)

Revised according to the loop scheme below (it works! it’s even better as a very nested series of ‘if’ statements!)

ice-00843

Older thoughts:

Honestly, now that things are working, cleaning should be simple: Each slider should be its own loop with if() from the mouseX/mouseY positions constructed in such a way that particular columns are read as a result of mouseX…

This is just a quick guess (if I run this and it works, I’ll add the cleaned code at the bottom):

for (int x=50; x<=350; x+=50){

if ((mouseX>x+(whatever my width offset was)) && (mouseX<x+50+(whatever my width offset was)){

if ((mouseY>slider top int) && ((mouseY<slider bottom)){ //so this should give us all of the MouseX registration chunks

int column=x/50; // so x dictates the column read (maybe… or maybe, I just have to set that column? Grrr, test, test!)

…. and here we stick the ellipses, their text, etc.

Ideally then we could condense the current mess into 3 slider loops, 2 button loops, and keep the original mouse-on-map effects.

There are also just a bunch of house-cleaning tasks I should take on from Fry’s basic map visualization chp3, like specifying that my labels don’t overlap, controlling the number of decimals shown in my String read-outs… Again, I’ll add the clean file if I get around to that scrubbing.

MORE SAMPLES: RANDOM PNG FRAMES

Just for fun, here’s the current version of things. Labels will be at the top describing what’s being seen:

1) Hover mouse over the British East India’s dot, and it’s pulling up all the years/tonnage radii. The year is indexed by stroke width and when in the transparent layering it lands.

ice-01569

 

2) Hover mouse over the top slider (note dot and bigger, underlying slider circle), and it’s pulling up all the all locations’ tonnage radii for 1856. The ton shipped is shown with the country name. (Clearly, the Caribbean needs some of Fry’s cleaning tips. So much clutter!)

ice-00119

 

3) Hover mouse over the middle slider and it’s pulling up all the all locations’ tonnage of 1854 but with a logarithmic melt equation applied. (Roughly 100 days from Boston, half the load has melted (i.e. half your ballast is gone!)… I just extrapolated back using typical shipping times from Maury’s oceanographic logs of the 1850s. Magic, mystery, math fudging in this round.) The tonnage received at each port is shown with the country name. (Here, I’d want to limit decimal places in the string readout as well as avoid overlaps. So much clutter!)

ice-00143

4) Hover mouse over the bottom slider and it’s pulling up all the original and melt remainders for 1855. Once you realize there were no real improvements in insulation and the percentage is constant based on days at sea, it’s a kinda dull slider. Maybe some other visual combo would make sense here. Or maybe, I could research ship improvements and trip those numbers based on early steamer use. Anyways, something more dynamic would be necessary to justify having this third slider. (Again, so much clutter!)

ice-00175

5) Hover mouse over the bottom button and it’s pulling up all locations melt remainders. And that’s it for now. (Again, so much clutter!)

ice-00221

 

The tweaks reside in code cleaning… both to simplify internal structures and to provide adequate visual read-out.

Next week- a cleaned file (maybe earlier)- and some sort of assignment-appropriate bar graph or scatter plot tapping into NYC open data!  If the pain in historic commercial statistics in finding enough sources, contemporary tables should really test my cleaning abilities, so anticipate some poorly done internal parsing and some very-Frankenstein manual-excel explorations.