Skip to content

Commit

Permalink
updated docstring for farms outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
bnb32 committed Apr 13, 2023
1 parent 51ff401 commit 0d9baf6
Showing 1 changed file with 33 additions and 16 deletions.
49 changes: 33 additions & 16 deletions farms/farms.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,32 @@ def farms(tau, cloud_type, cloud_effective_radius, solar_zenith_angle,
Returns
-------
ghi : np.ndarray
FARMS GHI values (this is the only output if debug is False).
fast_data : collections.namedtuple
Additional debugging variables if debug is True.
Named tuple with irradiance data. Attributes:
ghi : global horizontal irradiance (w/m2)
dni : direct normal irradiance (w/m2)
dhi : diffuse horizontal irradiance (w/m2)
If debug == True:
fast_data : collections.namedtuple
Named tuple with irradiance data with the following attributes:
ghi : np.ndarray
global horizontal irradiance (W/m2)
dni : np.ndarray
direct normal irradiance (W/m2)
dhi : np.ndarray
diffuse horizontal irradiance (W/m2)
Ruucld : np.ndarray
Aerosol reflectance for diffuse fluxes for cloudy
atmosphere.
Tddcld : np.ndarray
Transmittance of the cloudy atmosphere for direct incident
and direct outgoing fluxes (dd).
Tducld : np.ndarray
Transmittance of the cloudy atmosphere for direct incident
and diffuse outgoing fluxes (du).
else:
ghi: np.ndarray
Global horizontal irradiance (W/m2)
dni_farmsdni: np.ndarray
DNI computed by FARMS-DNI (W/m2).
dni0: np.ndarray
DNI computed by the Lambert law (W/m2). It only includes the narrow
beam in the circumsolar region.
"""
# disable divide by zero warnings
np.seterr(divide='ignore')
Expand Down Expand Up @@ -209,9 +227,9 @@ def farms(tau, cloud_type, cloud_effective_radius, solar_zenith_angle,
dni = Fd / solar_zenith_angle # eq 2b from [1]
dhi = ghi - Fd # eq 7 from [1]

Fd, dni_farmsdni, dni0 = \
farms_dni.farms_dni(F0, tau, solar_zenith_angle, De, phase,
phase1, phase2, Tddclr, ghi, F1)
Fd, dni_farmsdni, dni0 = farms_dni.farms_dni(F0, tau, solar_zenith_angle,
De, phase, phase1, phase2,
Tddclr, ghi, F1)

clear_mask = np.in1d(cloud_type, CLEAR_TYPES).reshape(cloud_type.shape)
if debug:
Expand All @@ -228,8 +246,7 @@ def farms(tau, cloud_type, cloud_effective_radius, solar_zenith_angle,

return fast_data
else:
# return only GHI
return np.where(clear_mask, np.nan, ghi),\
np.where(clear_mask, np.nan, dni_farmsdni),\
np.where(clear_mask, np.nan, dni0)
# print( theta00, idx, muomega )
out = (np.where(clear_mask, np.nan, ghi),
np.where(clear_mask, np.nan, dni_farmsdni),
np.where(clear_mask, np.nan, dni0))
return out

0 comments on commit 0d9baf6

Please sign in to comment.