|
| 1 | +""" |
| 2 | +The ``albedo`` module contains functions for modeling albedo. |
| 3 | +""" |
| 4 | + |
| 5 | +from pvlib.tools import sind |
| 6 | +import numpy as np |
| 7 | +import pandas as pd |
| 8 | + |
| 9 | + |
| 10 | +WATER_COLOR_COEFFS = { |
| 11 | + 'clear_water_no_waves': 0.13, |
| 12 | + 'clear_water_ripples_up_to_2.5cm': 0.16, |
| 13 | + 'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps': 0.23, |
| 14 | + 'clear_water_frequent_whitecaps': 0.3, |
| 15 | + 'green_water_ripples_up_to_2.5cm': 0.22, |
| 16 | + 'muddy_water_no_waves': 0.19 |
| 17 | +} |
| 18 | + |
| 19 | +WATER_ROUGHNESS_COEFFS = { |
| 20 | + 'clear_water_no_waves': 0.29, |
| 21 | + 'clear_water_ripples_up_to_2.5cm': 0.7, |
| 22 | + 'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps': 1.25, |
| 23 | + 'clear_water_frequent_whitecaps': 2, |
| 24 | + 'green_water_ripples_up_to_2.5cm': 0.7, |
| 25 | + 'muddy_water_no_waves': 0.29 |
| 26 | +} |
| 27 | + |
| 28 | + |
| 29 | +def inland_water_dvoracek(solar_elevation, surface_condition=None, |
| 30 | + color_coeff=None, wave_roughness_coeff=None): |
| 31 | + r""" |
| 32 | + Estimation of albedo for inland water bodies. |
| 33 | +
|
| 34 | + The available surface conditions are for inland water bodies, e.g., lakes |
| 35 | + and ponds. For ocean/open sea, see |
| 36 | + :const:`pvlib.irradiance.SURFACE_ALBEDOS`. |
| 37 | +
|
| 38 | + Parameters |
| 39 | + ---------- |
| 40 | + solar_elevation : numeric |
| 41 | + Sun elevation angle. [degrees] |
| 42 | +
|
| 43 | + surface_condition : string, optional |
| 44 | + If supplied, overrides ``color_coeff`` and ``wave_roughness_coeff``. |
| 45 | + ``surface_condition`` can be one of the following: |
| 46 | +
|
| 47 | + * ``'clear_water_no_waves'`` |
| 48 | + * ``'clear_water_ripples_up_to_2.5cm'`` |
| 49 | + * ``'clear_water_ripples_larger_than_2.5cm_occasional_whitecaps'`` |
| 50 | + * ``'clear_water_frequent_whitecaps'`` |
| 51 | + * ``'green_water_ripples_up_to_2.5cm'`` |
| 52 | + * ``'muddy_water_no_waves'`` |
| 53 | +
|
| 54 | + color_coeff : float, optional |
| 55 | + Water color coefficient. [-] |
| 56 | +
|
| 57 | + wave_roughness_coeff : float, optional |
| 58 | + Water wave roughness coefficient. [-] |
| 59 | +
|
| 60 | + Returns |
| 61 | + ------- |
| 62 | + albedo : numeric |
| 63 | + Albedo for inland water bodies. [-] |
| 64 | +
|
| 65 | + Raises |
| 66 | + ------ |
| 67 | + ValueError |
| 68 | + If neither of ``surface_condition`` nor a combination of |
| 69 | + ``color_coeff`` and ``wave_roughness_coeff`` are given. |
| 70 | + If ``surface_condition`` and any of ``color_coeff`` or |
| 71 | + ``wave_roughness_coeff`` are given. These parameters are |
| 72 | + mutually exclusive. |
| 73 | +
|
| 74 | + KeyError |
| 75 | + If ``surface_condition`` is invalid. |
| 76 | +
|
| 77 | + Notes |
| 78 | + ----- |
| 79 | + The equation for calculating the albedo :math:`\rho` is given by |
| 80 | +
|
| 81 | + .. math:: |
| 82 | + :label: albedo |
| 83 | +
|
| 84 | + \rho = c^{(r \cdot \sin(\alpha) + 1)} |
| 85 | +
|
| 86 | + Inputs to the model are the water color coefficient :math:`c` [-], the |
| 87 | + water wave roughness coefficient :math:`r` [-] and the solar elevation |
| 88 | + :math:`\alpha` [degrees]. Parameters are provided in [1]_ , and are coded |
| 89 | + for convenience in :data:`~pvlib.albedo.WATER_COLOR_COEFFS` and |
| 90 | + :data:`~pvlib.albedo.WATER_ROUGHNESS_COEFFS`. The values of these |
| 91 | + coefficients are experimentally determined. |
| 92 | +
|
| 93 | + +------------------------+-------------------+-------------------------+ |
| 94 | + | Surface and condition | Color coefficient | Wave roughness | |
| 95 | + | | (:math:`c`) | coefficient (:math:`r`) | |
| 96 | + +========================+===================+=========================+ |
| 97 | + | Clear water, no waves | 0.13 | 0.29 | |
| 98 | + +------------------------+-------------------+-------------------------+ |
| 99 | + | Clear water, ripples | 0.16 | 0.70 | |
| 100 | + | up to 2.5 cm | | | |
| 101 | + +------------------------+-------------------+-------------------------+ |
| 102 | + | Clear water, ripples | 0.23 | 1.25 | |
| 103 | + | larger than 2.5 cm | | | |
| 104 | + | (occasional whitecaps) | | | |
| 105 | + +------------------------+-------------------+-------------------------+ |
| 106 | + | Clear water, | 0.30 | 2.00 | |
| 107 | + | frequent whitecaps | | | |
| 108 | + +------------------------+-------------------+-------------------------+ |
| 109 | + | Green water, ripples | 0.22 | 0.70 | |
| 110 | + | up to 2.5cm | | | |
| 111 | + +------------------------+-------------------+-------------------------+ |
| 112 | + | Muddy water, no waves | 0.19 | 0.29 | |
| 113 | + +------------------------+-------------------+-------------------------+ |
| 114 | +
|
| 115 | + References |
| 116 | + ---------- |
| 117 | + .. [1] Dvoracek M.J., Hannabas B. (1990). "Prediction of albedo for use in |
| 118 | + evapotranspiration and irrigation scheduling." IN: Visions of the Future |
| 119 | + American Society of Agricultural Engineers 04-90: 692-699. |
| 120 | + """ |
| 121 | + |
| 122 | + if surface_condition is not None and ( |
| 123 | + color_coeff is None and wave_roughness_coeff is None |
| 124 | + ): |
| 125 | + # use surface_condition |
| 126 | + color_coeff = WATER_COLOR_COEFFS[surface_condition] |
| 127 | + wave_roughness_coeff = WATER_ROUGHNESS_COEFFS[surface_condition] |
| 128 | + |
| 129 | + elif surface_condition is None and not ( |
| 130 | + color_coeff is None or wave_roughness_coeff is None |
| 131 | + ): |
| 132 | + # use provided color_coeff and wave_roughness_coeff |
| 133 | + pass |
| 134 | + else: |
| 135 | + raise ValueError( |
| 136 | + "Either a `surface_condition` has to be chosen or" |
| 137 | + " a combination of `color_coeff` and" |
| 138 | + " `wave_roughness_coeff`.") |
| 139 | + |
| 140 | + solar_elevation_positive = np.where(solar_elevation < 0, 0, |
| 141 | + solar_elevation) |
| 142 | + |
| 143 | + albedo = color_coeff ** (wave_roughness_coeff * |
| 144 | + sind(solar_elevation_positive) + 1) |
| 145 | + |
| 146 | + if isinstance(solar_elevation, pd.Series): |
| 147 | + albedo = pd.Series(albedo, index=solar_elevation.index) |
| 148 | + |
| 149 | + return albedo |
0 commit comments