Skip to content

Commit

Permalink
spectra tests
Browse files Browse the repository at this point in the history
updated to better capture scaling options
  • Loading branch information
mcbrown042 committed Jun 27, 2023
1 parent c8d9ad7 commit c4e332b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 5 additions & 2 deletions bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3057,8 +3057,11 @@ def generate_spectra(self, metdata=None, simulation_path=None, ground_material=N
os.mkdir(spectra_path)

(spectral_alb, spectral_dni, spectral_dhi, weighted_alb) = su.generate_spectra(metdata=metdata,
simulation_path=simulation_path, ground_material=ground_material, spectra_folder=spectra_path,
scale_spectra=scale_spectra, scale_albedo=scale_albedo,
simulation_path=simulation_path,
ground_material=ground_material,
spectra_folder=spectra_path,
scale_spectra=scale_spectra,
scale_albedo=scale_albedo,
scale_albedo_nonspectral_sim=scale_albedo_nonspectral_sim,
scale_upper_bound=scale_upper_bound)

Expand Down
1 change: 0 additions & 1 deletion bifacial_radiance/spectral_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def generate_spectra(metdata, simulation_path, ground_material='Gravel', spectra
continue

# limit dataframes for calculations by scaling upper bound
scale_upper_bound=1200
tdni = spectral_dni.data[spectral_dni.data.index <= scale_upper_bound]
tdhi = spectral_dhi.data[spectral_dhi.data.index <= scale_upper_bound]
tghi = spectral_ghi.data[spectral_ghi.data.index <= scale_upper_bound]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_generate_spectra():
coerce_year=2001)

(spectral_alb, spectral_dni, spectral_dhi, weighted_alb) = rad_obj.generate_spectra(ground_material='Grass')

assert spectral_alb.data.__len__() == 2002
assert spectral_dhi.data.index[2001] == 4000.0
assert spectral_dni.data.iloc[400,0] == 0.8669
Expand All @@ -67,7 +67,7 @@ def test_scale_spectra():
scale_albedo=True)
assert spectral_alb.data.__len__() == 2002
assert spectral_dhi.data.index[2001] == 4000.0
assert (0.5074 <= spectral_dni.data.iloc[400][0] <= 0.5075)
assert (0.5074 <= spectral_dni.data.iloc[400][0] <= 0.40682)
assert spectral_dni.data.iloc[400].name == 560.0
assert weighted_alb == None

Expand Down

0 comments on commit c4e332b

Please sign in to comment.