Page MenuHomec4science

check_file.py
No OneTemporary

File Metadata

Created
Wed, Apr 30, 16:01

check_file.py

import xarray as xr
import sys
import os
fileDir = sys.argv[1]
for fp in os.listdir( fileDir ):
if 'pv_potential' not in fp: continue
try:
print(fp)
outfile = xr.open_dataset(os.path.join(fileDir, fp))
except:
print('Cannot open %s' %fp)
continue
if outfile.pv_potential.sum() > 0: continue
print('ERROR in %s' %fp)
outfile.close()
fileID = fp.split('_')[-1]
infile = fileDir + '/tilted_irrad_' + fileID
os.system('python compute_PV_output_batch.py %s %s' %(infile, os.path.join(fileDir, fp)))

Event Timeline