looping through the years

I’m starting a new data visualisation project. It uses some eight years of data from the numuseum website. In 2005 I started with a micro diary (255 characters per day) using custom software to update it every two hours. In 2006 followed my energy level and in 2008 inner peace and stress were added. All could be updated every two hours using the custom software. There are almost 900 pictures and around 60 haiku’s.

All this data will be integrated in an off-line visualisation: reversed calendar. This will take the form of an enormous tear-off calendar, where every leaf represents a day. There will be 2865 leafs in the calendar.

So I first have to get my head around the data sets. Luckily statistics wizard Marco Altini is helping to sort things out. He uses the very powerful program called R. Which can give you quick insight into data correlations. It was a bit embarrassing to discover how sloppy my data is. Notations have changed over the years and errors cause my program to halt.

At the moment I’m designing the leafs and doing some initial data accessing. I started out with the micro diary. I use Processing and Java to read in the data and at a later stage create pdfs for every day which can then be printed and made into a real tear-off calendar.

My idea is to make a big loop going through all the days from 27-4-2005 till 01-03-2013. I use the Java GreogorianCalendar class for that. The diary is in csv format consisting of a date and text string. I then compare every date with the date text string in the loaded data. It took some time to get the formatting right so the data can be compared as strings. I now have the first data ready to be incorporated into the pages. The printed output looks like this:

maandag 25-02-2013 // date of the page
Things are looking clear today.<br />Why does everything go more slow then you hoped? // diary text
p. 2861 // page of the calendar
dinsdag 26-02-2013
I hope I will learn the art of not worrying.<br />A nice conversation, new perspectives.
p. 2862

I want to share a little bit of code with you that I’m not using in the application but which might come in handy sometime. It lets you compare a date string to the incremented date (calStart):

Date d = new Date();
// make date
try{
String myDate = “30-11-2005”;
DateFormat sdf = new SimpleDateFormat(“dd-MM-yyyy”);
d = sdf.parse(myDate);
}
catch(ParseException e){
println(e);
}
Calendar tmpCal = new GregorianCalendar();
tmpCal.setTime(d);

if(tmpCal.compareTo(calStart)== 0){
println(“found”);
}

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.