Skip to content

Commit

Permalink
fix #294 Printout of ground materials
Browse files Browse the repository at this point in the history
Changed printout for user of how to get list of ground materials.
  • Loading branch information
shirubana committed Jan 8, 2021
1 parent 7ec0fd0 commit afdbec7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions bifacial_radiance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from bifacial_radiance import modelchain
from bifacial_radiance.gui import gui
from bifacial_radiance import mismatch
from bifacial_radiance import spectral_utils
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions
2 changes: 1 addition & 1 deletion bifacial_radiance/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2493,7 +2493,7 @@ def __init__(self, materialOrAlbedo=None, material_file=None):

self.material_file = material_file
if materialOrAlbedo is None: # Case where it's none.
print('\nInput albedo 0-1, or string from GroundObj.printGroundMaterials().'
print('\nInput albedo 0-1, or string from ground.printGroundMaterials().'
'\nAlternatively, run setGround after readWeatherData()'
'and setGround will read metdata.albedo if availalbe')
return
Expand Down
24 changes: 14 additions & 10 deletions bifacial_radiance/spectral_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,17 @@ def spectral_albedo_smarts(zen, azm, material, min_wavelength=300,
return spectral_property(smarts_res['Zonal_ground_reflectance'],
smarts_res['Wvlgth'], interpolation='linear')

def spectral_irradiance_smarts(zen, azm):
def spectral_irradiance_smarts(zen, azm, min_wavelength=300,
max_wavelength=4000):
try:
from pySMARTS.smarts import SMARTSSpectraZenAzm
except:
print("Warning: Could not load pySMARTS module.")
return None

smarts_res = SMARTSSpectraZenAzm('2 3 4', str(zen), str(azm))
smarts_res = SMARTSSpectraZenAzm('2 3 4', str(zen), str(azm),
min_wvl=str(min_wavelength),
max_wvl=str(max_wavelength))

dni_spectrum = spectral_property(smarts_res['Direct_normal_irradiance'],
smarts_res['Wvlgth'], interpolation='linear')
Expand All @@ -174,7 +177,7 @@ def spectral_irradiance_smarts_SRRL(YEAR, MONTH, DAY, HOUR, ZONE,
LATIT, LONGIT, ALTIT,
RH, TAIR, SEASON, TDAY, SPR, W,
TILT, WAZIM, HEIGHT,
ALPHA1, ALPHA2, OMEGL, GG, BETA,
ALPHA1, ALPHA2, OMEGL, GG, BETA, TAU5,
RHOG, material,
IOUT='2 3 4', min_wvl='280', max_wvl='4000'):

Expand All @@ -190,15 +193,16 @@ def spectral_irradiance_smarts_SRRL(YEAR, MONTH, DAY, HOUR, ZONE,
RH=RH, TAIR=TAIR, SEASON=SEASON, TDAY=TDAY, SPR=SPR, W=W,
TILT=TILT, WAZIM=WAZIM, HEIGHT=HEIGHT,
ALPHA1 = ALPHA1, ALPHA2 = ALPHA2, OMEGL = OMEGL,
GG = GG, BETA = BETA,
GG = GG, BETA = BETA, TAU5= TAU5,
RHOG=RHOG, material=material,
min_wvl=min_wvl, max_wvl=max_wvl)

dni_spectrum = spectral_property(smarts_res['Direct_normal_irradiance'],

dni_spectrum = spectral_property(smarts_res[smarts_res.keys()[1]],
smarts_res['Wvlgth'], interpolation='linear')
dhi_spectrum = spectral_property(smarts_res['Difuse_horizn_irradiance'],
dhi_spectrum = spectral_property(smarts_res[smarts_res.keys()[2]],
smarts_res['Wvlgth'], interpolation='linear')
ghi_spectrum = spectral_property(smarts_res['Global_horizn_irradiance'],
ghi_spectrum = spectral_property(smarts_res[smarts_res.keys()[3]],
smarts_res['Wvlgth'], interpolation='linear')

return (dni_spectrum, dhi_spectrum, ghi_spectrum)
Expand All @@ -208,8 +212,8 @@ def spectral_irradiance_smarts_SRRL(YEAR, MONTH, DAY, HOUR, ZONE,
def spectral_albedo_smarts_SRRL(YEAR, MONTH, DAY, HOUR, ZONE,
LATIT, LONGIT, ALTIT,
RH, TAIR, SEASON, TDAY, SPR, W,
TILT, WAZIM, HEIGHT,
ALPHA1, ALPHA2, OMEGL, GG, BETA,
TILT, WAZIM, HEIGHT,
ALPHA1, ALPHA2, OMEGL, GG, BETA, TAU5,
RHOG, material,
IOUT='30 31', min_wvl='280', max_wvl='4000'):

Expand All @@ -224,7 +228,7 @@ def spectral_albedo_smarts_SRRL(YEAR, MONTH, DAY, HOUR, ZONE,
RH=RH, TAIR=TAIR, SEASON=SEASON, TDAY=TDAY, SPR=SPR, W=W,
TILT=TILT, WAZIM=WAZIM, HEIGHT=HEIGHT,
ALPHA1 = ALPHA1, ALPHA2 = ALPHA2, OMEGL = OMEGL,
GG = GG, BETA = BETA,
GG = GG, BETA = BETA, TAU5= TAU5,
RHOG=RHOG, material=material,
min_wvl=min_wvl, max_wvl=max_wvl)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"source": [
"### 1. Run an hourly simulation\n",
"\n",
"This will generate the results over which we will perform the mismatch analysis. Here we are doing only 1 day to make this 'fater'."
"This will generate the results over which we will perform the mismatch analysis. Here we are doing only 1 day to make this faster."
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

# ### 1. Run an hourly simulation
#
# This will generate the results over which we will perform the mismatch analysis. Here we are doing only 1 day to make this 'fater'.
# This will generate the results over which we will perform the mismatch analysis. Here we are doing only 1 day to make this faster.

# In[6]:

Expand Down

0 comments on commit afdbec7

Please sign in to comment.