Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F111052902
check_files_flat_EW.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
Tue, Apr 29, 09:19
Size
3 KB
Mime Type
text/x-python
Expires
Thu, May 1, 09:19 (1 d, 18 h)
Engine
blob
Format
Raw Data
Handle
25874287
Attached To
R8800 solar_potential
check_files_flat_EW.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_EW_scenarios'
ROOF_FP
=
os
.
path
.
join
(
WORKDIR
,
'files/flat_roofs.csv'
)
AREA_FP
=
os
.
path
.
join
(
WORKDIR
,
'files/PRED_avail_area_flat.csv'
)
for
batch
in
range
(
batches
):
print
(
batch
)
poa_E_fp
=
os
.
path
.
join
(
fileDir
,
'east'
,
'poa_irradiance_
%d
.nc'
%
batch
)
poa_W_fp
=
os
.
path
.
join
(
fileDir
,
'west'
,
'poa_irradiance_
%d
.nc'
%
batch
)
irrad_E_fp
=
os
.
path
.
join
(
fileDir
,
'east'
,
'tilted_irrad_
%d
.nc'
%
batch
)
irrad_W_fp
=
os
.
path
.
join
(
fileDir
,
'west'
,
'tilted_irrad_
%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
)
BREAK_E
=
False
BREAK_W
=
False
try
:
poa_E
=
xr
.
open_dataset
(
poa_E_fp
)
except
:
print
(
'Cannot open
%s
'
%
(
poa_E_fp
))
BREAK_E
=
True
if
BREAK_E
is
False
:
if
poa_E
.
poa_direct
.
sum
()
==
0
:
print
(
'ERROR in
%s
\n
DELETED FILE AND RE-RUN POA COMPUTATION'
%
poa_E_fp
)
poa_E
.
close
()
os
.
remove
(
poa_E_fp
)
BREAK_E
=
True
try
:
poa_W
=
xr
.
open_dataset
(
poa_W_fp
)
except
:
print
(
'Cannot open
%s
'
%
(
poa_W_fp
))
BREAK_W
=
True
if
BREAK_W
is
False
:
if
poa_W
.
poa_direct
.
sum
()
==
0
:
print
(
'ERROR in
%s
\n
DELETED FILE AND RE-RUN POA COMPUTATION'
%
poa_W_fp
)
poa_W
.
close
()
os
.
remove
(
poa_W_fp
)
BREAK_W
=
True
if
BREAK_E
is
False
:
try
:
irrad
=
xr
.
open_dataset
(
irrad_E_fp
)
except
:
print
(
'Cannot open
%s
'
%
(
irrad_E_fp
))
BREAK_E
=
True
if
BREAK_E
is
False
:
if
irrad
.
yearly_kWh_m2
.
sum
()
==
0
:
print
(
'ERROR in
%s
'
%
irrad_E_fp
)
irrad
.
close
()
os
.
system
(
'python
%s
/compute_tilted_irrad_batch_flat_EW.py
%s
%s
%s
'
%
(
WORKDIR
,
poa_E_fp
,
ROOF_FP
,
irrad_E_fp
))
if
BREAK_W
is
False
:
try
:
irrad
=
xr
.
open_dataset
(
irrad_W_fp
)
except
:
print
(
'Cannot open
%s
'
%
(
irrad_W_fp
))
BREAK_W
=
True
if
BREAK_W
is
False
:
if
irrad
.
yearly_kWh_m2
.
sum
()
==
0
:
print
(
'ERROR in
%s
'
%
irrad_W_fp
)
irrad
.
close
()
os
.
system
(
'python
%s
/compute_tilted_irrad_batch_flat_EW.py
%s
%s
%s
'
%
(
WORKDIR
,
poa_W_fp
,
ROOF_FP
,
irrad_W_fp
))
if
BREAK_W
or
BREAK_E
:
continue
try
:
pvPot
=
xr
.
open_dataset
(
pvPot_fp
)
except
:
print
(
'Cannot open
%s
'
%
pvPot_fp
)
os
.
system
(
'python
%s
/compute_PV_output_batch_flat_EW.py
%s
%s
%s
%s
%s
%s
'
%
(
WORKDIR
,
irrad_E_fp
,
irrad_W_fp
,
ROOF_FP
,
AREA_FP
,
irrad_fp
,
pvPot_fp
))
continue
if
pvPot
.
yearly_PV_kWh
.
sum
()
>
0
:
continue
print
(
'ERROR in
%s
'
%
pvPot_fp
)
pvPot
.
close
()
os
.
system
(
'python
%s
/compute_PV_output_batch_flat_EW.py
%s
%s
%s
%s
%s
%s
'
%
(
WORKDIR
,
irrad_E_fp
,
irrad_W_fp
,
ROOF_FP
,
AREA_FP
,
irrad_fp
,
pvPot_fp
))
Event Timeline
Log In to Comment