All pastes #31913 Raw Edit

Stuff

public python v1 · immutable
#31913 ·published 2005-12-01 02:29 UTC
rendered paste body
#!/usr/bin/pythonbath_in = open("gebco_bathy.21601x10801.bin","r")bath_out = open("gebco_bathy.21601x10801x8.bin","w")import array,time,ost = time.time()while 1:    data = bath_in.read(10240)    if not data:        break    a = array.array("H")        a.fromstring(data)        l = array.array("c")        for d in a:        nd = chr(d>>8)        l.append(nd)            bath_out.write(l.tostring())    bath_out.flush()            nt = time.time()    if t + 1 < nt:        t = nt        print len(data), len(data), len(l.tostring()), float(bath_in.tell()) / float(os.fstat(bath_in.fileno())[6])