#!/usr/bin/env python # onetopo: use data files from Topo! CD to assemble one USGS 7.5-minute # map and one 15-minute map from the specified coordinates. # Copyright 2005 by Akkana Peck. # You may use, distribute or modify this program under the terms of the GPL. import sys, os mapdir = os.environ["HOME"] + "/Topo/" def ohstring(num) : if (num < 10) : return "0" + repr(num) return repr(num) def CombineMaps(dirname) : if dirname[-1] == "/" : dirname = dirname[0:-1] # # First, make the 7.5-minute series # cmdstr = "montage -geometry 262x328 -tile 10x10" for y in range(1,11) : for x in range(1,11) : filename = dirname + "/012t" + ohstring(x) + ohstring(y) + ".gif" #print filename cmdstr += " " + filename cmdstr += " " + mapdir + dirname + "-7.gif" os.system(cmdstr) # # Now, make the 15-minute series # cmdstr = "montage -geometry 262x328 -tile 5x5" for y in range(1,6) : for x in range(1,6) : filename = dirname + "/024t" + ohstring(x) + ohstring(y) + ".gif" cmdstr += " " + filename cmdstr += " " + mapdir + dirname + "-15.gif" os.system(cmdstr) print "Created: " + mapdir + dirname + "-7.gif " + \ mapdir + dirname + "-15.gif" # main() if len(sys.argv) < 2 : print "Usage: onetopo dirname" print "Run from inside the Topo! data directory (e.g. foo_data on the CD)." exit(1) for arg in sys.argv[1:] : CombineMaps(arg)