Archive for May, 2010

Inca Trail Flyover using Google Earth

Topic: Uncategorized| 1 Comment »

Isn’t Google wonderful? Except for all the secret things they know about you, that is. Anyway, no website IN THE FREAKIN’ WORLD seems to know where any of the stuff on the Inca Trail is actually located, so I put together a flyover of the four-day Inca Trail trip from Enigma Tours. I feel like they should be paying me for this.
Anyway, here is the tour description from the site:

Day 1: Cusco to Wayllabamba

Between 04.00-04.30am our private transport and staff will pick you up from your hotel. We drive to Piskacuchu (2700m/8856ft), a community located on the 82nd kilometer of the Cusco –Machupicchu railroad, which is the starting point of the Inca Trail. We begin our hike by crossing the bridge over the Urubamba River and walking along its left shore as it flows northwest along the Sacred Valley. Following the trail along a flat terrain, we arrive in Miskay (2800m/9184ft), to then ascend and finally see, from the tallest part of an overlook, the impressive Inca city of Llactapata (2650m/8692ft). We continue trekking along the valley created by the Kusichaca River, gradually climbing for about five hours until we reach the community of Wayllabamba (3000m/9840ft), where we set our first camp. All along the way we enjoy spectacular views of the Vilcanota ridge on the opposite side of the Urubamba River, where the impressive Veronica peak reigns at 5832 meters above sea level. Not to mention the diversity of wild flora and fauna that can be found all along the valley.
Meals: B, L, D
Total distance:     12 km (7,47 miles)
Estimated walking time:      5-6 hours
Maximum altitude point:     3,000 m (9,840 ft)
Campsite altitude:     3,000 m (9,840 ft)

Day 2: Wayllabamba to Pacaymayo

We wake up at around 6:00 am and after breakfast, we begin the most difficult part of the trek, which consists of an abrupt and steep ascent that stretches for 9 km. Along this climb, the landscape changes from sierra to puna (a dry and high area with little vegetation). On the way to the first mountain pass, the Abra Warmihuañusca (Dead Woman´s Pass – 4200m/13776ft), we may see domesticated llamas and alpacas grazing on ichu, one of the few plants that grow at high altitude. We also cross an area of the so called cloud forest, which is the habitat for many different kinds of birds like hummingbirds and sparrows, and the Andean bear, which is also called the Spectacled Bear (Tremarctus Ornatus). We advise that on this day specially, your daypack is well stocked with candies, chocolates and coca leaves that will keep your sugar level high, and help with altitude sickness. Immediately after the pass, we descend into the Pacaymayo valley (3600m/11808ft), where we camp after approximately 7h of hiking.
Meals: B, L, D
Total distance:     11 km (6,84 miles)
Estimated walking time:      6-7 hours
Maximum altitude point:     4,200 m (13,776 ft)
Campsite altitude:     3,500 m (11,480 ft)

Day 3: Pacaymayo to Wiñaywayna

This day is the longest but also the most impressive and the most interesting, due the number of archaeological sites and the lush cloud forest area that we cross, so rich in Andean flora and fauna. From Pacaymayo we climb to the second pass, the Abra Runkurakay (3970m/13022ft). Halfway up, we stop to visit the archaeological complex with the same name. This site, located at 3800m/12464ft, consists of a small oval structure that is believed to have served the purpose of a watchtower. After going over the pass, we descend towards Yanacocha (Black Lagoon) and enter the cloud forest to finally arrive at Sayacmarca (3624m/11887ft). This is a beautiful complex made up of a semicircular construction, enclosures at different levels, narrow streets, liturgical fountains, patios and irrigation canals. Continuing up an easy climb, we arrive at the third pass, the Abra Phuyupatamarca (3700m/12136ft). Along this climb we can appreciate the magnitude of the Incas´ ancient craft, by walking along paths semi-detached from the mountain, and seeing rocks that fill up ravines in perfect order, saving the trail from the multileveled Andean geography. We go through an Inca tunnel to later arrive at the aforementioned pass and down to the complex of the same name. This is one of the most complete and best-preserved archaeological complexes along the Inca Trail to Machupicchu, and is located on the highest point of a mountain. Curiously, Phuyupatamarca means ¨town over the clouds¨. From above, one can observe a sophisticated sacred complex made up of water fountains with solid foundations, and also impressive views of the Urubamba River valley. We continue our trek down the long descending stone steps that lead us to Wiñaywayna (2650m/8692ft), an impressive Inca complex made up of an agricultural center with numerous terraces, a religious sector and an urban sector, close to which our camp is located. This campsite hosts a trekker lodge, a bar and bathrooms with hot shower facilities. After visiting the impressive archaeological site, we enjoy our farewell dinner at our camp.
Meals: B, L, D
Total distance:     16 km (9,94 miles)
Estimated walking time:      8 hours
Maximum altitude point:     3,900 m (12,792 ft)
Campsite altitude:     2,650 m (8,692 ft)

Day 4: Wiñaywayna to Machupicchu

On this fourth and last day we get up at 4.00 am to leave Wiñaywayna an hour later and climb to the Intipunku, or The Sun Gate. This will take an hour of hiking along a trail of flat stones on the edges of cliffs in highland jungle. From this fabulous spot, we may see the sunrise over the sacred citadel of Machupicchu. From Intipunku we descend into Machupicchu, and 40 minutes later we enter the citadel from the highest point through the ¨House of the Guardians¨. We then descend to the control point where we register ourselves and leave our backpacks. We immediately begin a complete guided tour of the Inca citadel that will take approximately two hours. You will then have free time to walk around, climb the Huaynapicchu Mountain, where one can experience spectacular views of all of Machupicchu, the valleys and mountains that surround it, or visit the Temple of the Moon or the impressive Inca Bridge. In the afternoon, we meet in the town of Aguas Calientes where, if you like, you can visit and relax in its hot springs. From here we take the train back to the city of Cusco, where we arrive after nightfall.
Meals: B
Total distance:     4 km (2,49 miles)
Estimated walking time:      2 hours
Maximum altitude point:     2,700 m (8,829 ft)
Machupicchu altitude:     2,400 m (7,872 ft)

Also, here are the .kmz files I used to create this:

Inca Trail Locations and Views

Inca Trail Canned Tour

Python and EXIF Metadata: There’s more than one way to do it!

Topic: Technology| 2 Comments »

So, at the persistent urging of my friend Stephen, I decided to dip my toe once more into the snake-infested waters of the Pythonian Amazon instead of reaching into my back pocket and hacking the problem to pieces with my Perl. But later, I found out after having reached a couple of IT professional experts at Blue Whale Media Ltd that I did the right thing.

The problem:

I love Windows Live Photo Gallery.  It has changed my photo-organizing life.  However, someone at Microsoft  decided to be briliant and make the import wizard (a jewel that groups your pictures by time so you can import groups of pictures taken at approximately the same time), groups picture by DATE MODIFIED instead of date taken.  Which is brilliant.  Especially if you are on a trip and want to “prematurely” edit or tag any picture while it is still on the memory card.

So essentially, I just get back from a trip with my in-laws and I have about 300 pictures suffering from this “date modified” sickness.

The solution:

This time, instead of Perlifying up a solution, I turn to the “There should be one– and preferably only one –obvious way to do it” Python way to do it, and discover that “There are 10, or more, non-obvious ways to do it, but only some of them do everything you want and most of them do part of what you want.”

Eventually, I grabbed PIL (Python Imaging Library) from comment on a similar rant against Python EXIF handling and called it good:

from PIL import Image
from PIL.ExifTags import TAGS

def get_exif(fn):
ret = {}
i =
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret

My quick and dirty script to change “date modified” on all pictures in a directory (recursively!) turned out to look like this:

from PIL import Image
from PIL.ExifTags import TAGS
import pprint
import time
import datetime
import os
import sys

def get_exif(fn):
ret = {}
i =
info = i._getexif()
for tag, value in info.items():
decoded = TAGS.get(tag, tag)
ret[decoded] = value
return ret

def set_modify_time(_filename):
exif_info = get_exif(_filename);
pp = pprint.PrettyPrinter(indent=4)
print exif_info[‘DateTime’]

#Get EXIF Creation Date
exif_date,exif_time  = exif_info[‘DateTime’].split(‘ ‘)
print exif_date,exif_time
(y,mm,d) = exif_date.split(‘:’)
(h,min,s) = exif_time.split(‘:’)
date_list = (y,mm,d,h,min,s)
print date_list
#       int_date_list = [map(int, i) for i in date_list]
#WTF< why the H is that this:
#(’2006′, ’18′, ’12′, ’17′, ’18′, ’26′)
#[[2, 0, 0, 6], [1, 8], [1, 2], [1, 7], [1, 8], [2, 6]]
int_date_list = map(int, date_list)
print "int_date_list:", int_date_list
(y,mm,d,h,min,s) = int_date_list
print y,mm,d,h,min,s
#create unix timestamp object from EXIF date
exif_dateTaken = datetime.datetime(y,mm,d,h,min,s)
print str(exif_dateTaken)
unix_timestamp = time.mktime(exif_dateTaken.timetuple())

#set modify,access times on file
os.utime(_filename, (unix_timestamp, unix_timestamp))

return 1

def dir_files(_dir):
fileList = []
rootdir = _dir
for root, subFolders, files in os.walk(rootdir):
for file in files:
print ‘fileList’, fileList
return fileList

def listFiles(dir):
basedir = dir
print "Files in ", os.path.abspath(dir), ": "
subdirlist = []
for item in os.listdir(dir):
if os.path.isfile(item):
print item
subdirlist.append(os.path.join(basedir, item))
for subdir in subdirlist:

if __name__ == "__main__":
file = ‘C:\\tmp\\DSCN1229.JPG’
files = dir_files(‘E:\\Raw’)
print files
for file in files:
print file
if(file.find(‘JPG’) != -1):

Of course Python sucks and uses stupid whitespace, so I had to wrap the above in a <pre> tag.  Ugh. I’m sorry I spared you the fun game of “guess where the indentation goes!”, but I digress.

Anyway, that only gets me halfway there, because what I really want is a way to be able to both READ and WRITE EXIF metadata in Python. Because my camera decided it was 2037 for a few dozen pictures. And now we come to the title of my post. Apparently, there are several hundred ways to do that in Python, and not all of them will do what I want (read and write EXIF stuff) or are supported anymore (which is kind-of important).

So here, there’s more than one way to do it.

I’ll let you do the research and decide:

Meanwhile, I’ll be doing some old-fashioned date math and changing some metadata. One hundred and five times. Thanks.

P.S. I know that the “there should be one way to do it” probably applies to the Python language syntax and structure, but that still doesn’t make me any less irritated that there isn’t an “anointed” way to read metadata on files. For the love, this is the BIGGEST problem facing our information society over the next hundred years, we need to get a grip on it. Which Microsoft, of all people, seems to have done by integrating Metadata editing into every aspect of the Windows Vista and Windows 7 file manager. Linux needs to catch up. But that deserves another rantpost.

My sister thinks that I don’t update my blog enough.

Topic: Travel| No Comments »

So I will. Updated! Going to the South, Peru, and England! Tada!