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