Page MenuHomec4science

check_files.py
No OneTemporary

File Metadata

Created
Wed, Apr 30, 13:54

check_files.py

import xarray as xr
import sys
import os
fileDir = sys.argv[1]
batches = int(sys.argv[2])
for batch in range(batches):
print(batch)
poa_fp = os.path.join(fileDir, 'poa_irradiance_%d.nc' %batch)
irrad_fp = os.path.join(fileDir, 'tilted_irrad_%d.nc' %batch)
pvPot_fp = os.path.join(fileDir, 'pv_potential_%d.nc' %batch)
try:
irrad = xr.open_dataset(irrad_fp)
poa = xr.open_dataset(poa_fp)
if irrad.yearly_kWh_m2.sum() == 0:
print('ERROR in %s' %irrad_fp)
irrad.close()
poa.close()
os.system('python compute_tilted_irrad_batch.py %s %s' %(poa_fp, irrad_fp))
except:
print('Cannot open %s or %s' %(poa_fp,irrad_fp))
continue
try:
pvPot = xr.open_dataset(pvPot_fp)
except:
print('Cannot open %s' %pvPot_fp)
continue
if pvPot.yearly_PV_kWh.sum() > 0:
continue
print('ERROR in %s' %pvPot_fp)
pvPot.close()
os.system('python compute_PV_output_batch.py %s %s' %(irrad_fp, pvPot_fp))

Event Timeline