it seems this is a useful change (compress.py)
This commit is contained in:
@ -78,6 +78,7 @@ def treat(action, instrument='', years='past', vars=None):
|
|||||||
logbase = '%slogger/' % instdir(instrument)
|
logbase = '%slogger/' % instdir(instrument)
|
||||||
gzbase = '%sgzlogger/' % instdir(instrument)
|
gzbase = '%sgzlogger/' % instdir(instrument)
|
||||||
os.chdir(logbase)
|
os.chdir(logbase)
|
||||||
|
print('chdir', logbase, gzbase)
|
||||||
if years == 'all':
|
if years == 'all':
|
||||||
yrs = list(glob('20*'))
|
yrs = list(glob('20*'))
|
||||||
elif years == 'past':
|
elif years == 'past':
|
||||||
@ -97,18 +98,19 @@ def treat(action, instrument='', years='past', vars=None):
|
|||||||
else:
|
else:
|
||||||
varlist = vars
|
varlist = vars
|
||||||
for variable in varlist:
|
for variable in varlist:
|
||||||
# print logdir+variable
|
if action == COMPRESS:
|
||||||
if os.path.isdir(logdir+variable):
|
if os.path.isdir(logdir+variable):
|
||||||
if action == COMPRESS:
|
|
||||||
if not os.path.isfile(gzdir + variable + '.gz'):
|
if not os.path.isfile(gzdir + variable + '.gz'):
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
compress(logdir, gzdir, variable)
|
compress(logdir, gzdir, variable)
|
||||||
time.sleep(min(1.0, time.time()-t0)) # be nice
|
time.sleep(min(1.0, time.time()-t0)) # be nice
|
||||||
elif action == EXPAND:
|
elif action == EXPAND:
|
||||||
if os.path.isfile(gzdir + variable + '.gz'):
|
os.makedirs(logdir+variable)
|
||||||
expand(logdir, gzdir, variable)
|
print(gzdir, variable, '.gz')
|
||||||
else:
|
if os.path.isfile(gzdir + variable + '.gz'):
|
||||||
print '%s is missing' % (gzdir + variable + '.gz')
|
expand(logdir, gzdir, variable)
|
||||||
|
else:
|
||||||
|
print '%s is missing' % (gzdir + variable + '.gz')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
action = COMPRESS
|
action = COMPRESS
|
||||||
|
Reference in New Issue
Block a user