Skip to content

Commit e4a6f60

Browse files
committed
Merge branch 'mjprilliman-spectral-fixes' into development
2 parents f5dd200 + 384a745 commit e4a6f60

4 files changed

Lines changed: 9870 additions & 6 deletions

File tree

bifacial_radiance/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3961,7 +3961,7 @@ def __init__(self, tmydata, metadata, label = 'right'):
39613961
self.ghi = np.array(tmydata.GHI)
39623962
self.dhi = np.array(tmydata.DHI)
39633963
self.dni = np.array(tmydata.DNI)
3964-
self.albedo = np.array(_firstlist([tmydata.get('Alb'), tmydata.get('albedo'),
3964+
self.albedo = np.array(_firstlist([tmydata.get('Alb'), tmydata.get('ALB'), tmydata.get('albedo'),
39653965
tmydata.get('Albedo')]) )
39663966
if pd.isnull(self.albedo).all(): self.albedo = None
39673967

bifacial_radiance/spectral_utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -449,21 +449,20 @@ def generate_spectral_tmys(wavelengths, spectra_folder, weather_file, location_n
449449

450450
# -- fill with irradiance data
451451
for file in spectra_files:
452-
a = pd.to_datetime(file[4:-4],format='%y_%m_%d_%H')
452+
a = pd.to_datetime(file[4:-4],format='%y_%m_%d_%H').tz_localize(dtindex.tz)
453453
b = file[:3].upper()
454454
spectra_df[a,b] = pd.read_csv(os.path.join(spectra_folder,file),header=1, index_col=0)
455455

456456
# -- reorder the columns to match TMYs
457-
spectra_df.columns.set_levels(['Alb','DHI','DNI','GHI'],level=1, inplace=True)
458-
457+
spectra_df.columns.set_levels(['Alb','DHI','DNI','GHI'],level=1)
459458
# -- create arrays of zeros for data outside the array
460459
zeros = np.zeros(len(dtindex))
461460

462461
# -- build the blank tmy-like data frame
463462
blank_df = pd.DataFrame(index=dtindex, data={'Date (MM/DD/YYYY)':dtindex.strftime('%#m/%#d/%Y'),
464463
'Time (HH:MM)':dtindex.strftime('%H:%M'),
465464
'Wspd':tmydata['Wspd'],'Dry-bulb':tmydata['DryBulb'],
466-
'DHI':zeros,'DNI':zeros,'GHI':zeros,'Alb':zeros})
465+
'DHI':zeros,'DNI':zeros,'GHI':zeros,'ALB':zeros})
467466

468467
# column names for transfer
469468
irrs = ['DNI','DHI','GHI','ALB']
@@ -474,9 +473,11 @@ def generate_spectral_tmys(wavelengths, spectra_folder, weather_file, location_n
474473
fileName = os.path.join(output_folder,fileName)
475474
wave_df = blank_df.copy()
476475
for col in spectra_df.columns:
477-
wave_df[col[1]].loc[col[0]] = spectra_df[col].loc[wave]
476+
wave_df.loc[col[0],col[1]] = spectra_df[col].loc[wave]
478477

479478
with open(fileName, 'w', newline='') as ict:
480479
for line in header:
481480
ict.write(line)
482481
wave_df.to_csv(ict, index=False)
482+
483+

0 commit comments

Comments
 (0)