Skip to content

Commit

Permalink
revert back to %.1f format for saving cumulative .csv file.
Browse files Browse the repository at this point in the history
  • Loading branch information
cdeline committed Oct 10, 2024
1 parent 553b32c commit d2d1428
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def _subhourlydatatoGencumskyformat(gencumskydata, label='right'):
try:
gencumskydata = gencumskydata.resample('60min', closed='right', label='right').mean()
except TypeError: # Pandas 2.0 error
gencumskydata = gencumskydata.resample('60min', closed='right', label='right').mean(numeric_only=True)
gencumskydata = gencumskydata.resample('60min', closed='right', label='right').mean(numeric_only=True)

if label == 'left': #switch from left to right labeled by adding an hour
gencumskydata.index = gencumskydata.index + pd.to_timedelta('1H')
Expand Down Expand Up @@ -1142,8 +1142,7 @@ def _saveTempTMY(self, tmydata, filename=None, starttime=None, endtime=None,
if gencumskydata is not None:
csvfile = os.path.join('EPWs', filename)
print('Saving file {}, # points: {}'.format(csvfile, gencumskydata.__len__()))
gencumskydata.to_csv(csvfile, index=False, header=False, sep=' ',
columns=['GHI','DHI'], float_format='%i')
gencumskydata.to_csv(csvfile, index=False, header=False, sep=' ', columns=['GHI','DHI'])
self.gencumsky_metfile = csvfile

if gencumdict is not None:
Expand All @@ -1153,8 +1152,7 @@ def _saveTempTMY(self, tmydata, filename=None, starttime=None, endtime=None,
newfilename = filename.split('.')[0]+'_year_'+str(ii)+'.csv'
csvfile = os.path.join('EPWs', newfilename)
print('Saving file {}, # points: {}'.format(csvfile, gencumskydata.__len__()))
gencumskydata.to_csv(csvfile, index=False, header=False, sep=' ',
columns=['GHI','DHI'], float_format='%i')
gencumskydata.to_csv(csvfile, index=False, header=False, sep=' ', columns=['GHI','DHI'])
self.gencumsky_metfile.append(csvfile)

return tmydata
Expand Down Expand Up @@ -3602,8 +3600,8 @@ def _makeTrackerCSV(self, theta_list, trackingdata):
else:
# mask out irradiance at this time, since it
# belongs to a different bin
ghi_temp.append(0)
dhi_temp.append(0)
ghi_temp.append(0.0)
dhi_temp.append(0.0)
# save in 2-column GHI,DHI format for gencumulativesky -G
savedata = pd.DataFrame({'GHI':ghi_temp, 'DHI':dhi_temp},
index = self.datetime).tz_localize(None)
Expand All @@ -3617,8 +3615,7 @@ def _makeTrackerCSV(self, theta_list, trackingdata):
index=False,
header=False,
sep=' ',
columns=['GHI','DHI'],
float_format='%i')
columns=['GHI','DHI'])


return trackerdict
Expand Down

0 comments on commit d2d1428

Please sign in to comment.