Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F114113598
check_files.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, May 23, 13:30
Size
1 KB
Mime Type
text/x-python
Expires
Sun, May 25, 13:30 (2 d)
Engine
blob
Format
Raw Data
Handle
26348120
Attached To
R8800 solar_potential
check_files.py
View Options
import
xarray
as
xr
import
sys
import
os
fileDir
=
sys
.
argv
[
1
]
batches
=
int
(
sys
.
argv
[
2
])
WORKDIR
=
'/scratch/walch/workdir_solar_MMH_base'
FLATDIR
=
'/scratch/walch/workdir_solar_EW_scenarios'
ROOF_FP
=
os
.
path
.
join
(
FLATDIR
,
'files/flat_roofs_baseline.csv'
)
AREA_FP
=
'/work/hyenergy/output/solar_potential/geographic_potential/available_area/PRED_available_area_unc_filled.csv'
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
)
check_irrad
=
False
try
:
irrad
=
xr
.
open_dataset
(
irrad_fp
)
poa
=
xr
.
open_dataset
(
poa_fp
)
print
(
len
(
irrad
.
DF_UID
))
print
(
len
(
poa
.
DF_UID
))
if
irrad
.
yearly_kWh_m2
.
sum
()
==
0
:
print
(
len
(
irrad
.
DF_UID
))
print
(
'ERROR in
%s
'
%
irrad_fp
)
irrad
.
close
()
poa
.
close
()
os
.
system
(
'
%s
/python compute_tilted_irrad_batch.py
%s
%s
%s
'
%
(
WORKDIR
,
poa_fp
,
ROOF_FP
,
irrad_fp
))
check_irrad
=
True
except
:
print
(
'Cannot open
%s
or
%s
'
%
(
poa_fp
,
irrad_fp
))
continue
try
:
pvPot
=
xr
.
open_dataset
(
pvPot_fp
)
if
pvPot
.
yearly_PV_kWh
.
sum
()
>
0
:
continue
except
:
print
(
'Cannot open
%s
'
%
pvPot_fp
)
if
not
check_irrad
:
continue
print
(
'ERROR in
%s
'
%
pvPot_fp
)
pvPot
.
close
()
os
.
system
(
'python
%s
/compute_PV_output_batch.py
%s
%s
%s
%s
'
%
(
WORKDIR
,
irrad_fp
,
ROOF_FP
,
AREA_FP
,
pvPot_fp
))
Event Timeline
Log In to Comment