|
24 | 24 | URL = 'https://re.jrc.ec.europa.eu/api/'
|
25 | 25 |
|
26 | 26 |
|
27 |
| -def get_pvgis_hourly(lat, lon, angle=0, aspect=0, |
| 27 | +def get_pvgis_hourly(lat, lon, angle=0, aspect=0, |
28 | 28 | outputformat='json', usehorizon=True,
|
29 |
| - userhorizon=None, raddatabase=None, |
| 29 | + userhorizon=None, raddatabase=None, |
30 | 30 | startyear=None, endyear=None,
|
31 | 31 | pvcalculation=False, peakpower=None,
|
32 | 32 | pvtechchoice='crystSi', mountingplace='free', loss=None,
|
33 | 33 | trackingtype=0,
|
34 | 34 | optimal_inclination=False, optimalangles=False,
|
35 | 35 | components=True, url=URL, timeout=30):
|
36 | 36 | """
|
37 |
| - Get hourly solar radiation data and optimal modeled PV power output from |
38 |
| - PVGIS. For more information see the PVGIS [1]_ TMY tool |
39 |
| - documentation [2]_. |
| 37 | + Get hourly solar radiation data and modeled PV power output from PVGIS |
| 38 | + [1]_. |
| 39 | +
|
40 | 40 | Parameters
|
41 | 41 | ----------
|
42 |
| - lat : float |
| 42 | + lat: float |
43 | 43 | Latitude in degrees north
|
44 |
| - lon : float |
| 44 | + lon: float |
45 | 45 | Longitude in degrees east
|
46 | 46 | angle: float, default: 0
|
47 | 47 | Tilt angle from horizontal plane. Not relevant for 2-axis tracking.
|
48 | 48 | aspect: float, default: 0
|
49 | 49 | Orientation (azimuth angle) of the (fixed) plane. 0=south, 90=west,
|
50 | 50 | -90: east. Not relevant for tracking systems.
|
51 |
| - outputformat : str, default: 'json' |
52 |
| - Must be in ``['csv', 'basic', 'json']``. See PVGIS TMY tool |
53 |
| - documentation [2]_ for more info. |
54 |
| - usehorizon : bool, default: True |
55 |
| - include effects of horizon |
56 |
| - userhorizon : list of float, default: None |
57 |
| - optional user specified elevation of horizon in degrees, at equally |
| 51 | + outputformat: str, default: 'json' |
| 52 | + Must be in ``['csv', 'json']``. See PVGIS hourly data documentation |
| 53 | + [2]_ for more info. |
| 54 | + usehorizon: bool, default: True |
| 55 | + Include effects of horizon |
| 56 | + userhorizon: list of float, default: None |
| 57 | + Optional user specified elevation of horizon in degrees, at equally |
58 | 58 | spaced azimuth clockwise from north, only valid if `usehorizon` is
|
59 | 59 | true, if `usehorizon` is true but `userhorizon` is `None` then PVGIS
|
60 | 60 | will calculate the horizon [4]_
|
61 |
| - raddatabase : str, default: None |
| 61 | + raddatabase: str, default: None |
62 | 62 | Name of radiation database. Options depend on location, see [3]_.
|
63 |
| - startyear : int, default: None |
64 |
| - first year of the radiation time series. Defaults to first year avaiable. |
65 |
| - endyear : int, default: None |
66 |
| - last year of the radiation time series. Defaults to last year avaiable. |
67 |
| - pvcalculation : bool, default: False |
| 63 | + startyear: int, default: None |
| 64 | + First year of the radiation time series. Defaults to first year |
| 65 | + avaiable. |
| 66 | + endyear: int, default: None |
| 67 | + Last year of the radiation time series. Defaults to last year avaiable. |
| 68 | + pvcalculation: bool, default: False |
68 | 69 | Also return estimate of hourly production.
|
69 |
| - peakpower : float, default: None |
| 70 | + peakpower: float, default: None |
70 | 71 | Nominal power of PV system in kW. Required if pvcalculation=True.
|
71 |
| - pvtechchoice : {'crystSi', 'CIS', 'CdTe', 'Unknown'}, default: 'crystSi' |
| 72 | + pvtechchoice: {'crystSi', 'CIS', 'CdTe', 'Unknown'}, default: 'crystSi' |
72 | 73 | PV technology.
|
73 |
| - mountingplace : {'free', 'building'}, default: free |
| 74 | + mountingplace: {'free', 'building'}, default: free |
74 | 75 | Type of mounting for PV system. Options of 'free' for free-standing
|
75 | 76 | and 'building' for building-integrated.
|
76 |
| - loss : float, default: None |
77 |
| - Sum of PV system losses in percent. Required if pvcalculation=True |
| 77 | + loss: float, default: None |
| 78 | + Sum of PV system losses in percent. Required if pvcalculation=True |
78 | 79 | trackingtype: {0, 1, 2, 3, 4, 5}, default: 0
|
79 | 80 | Type of suntracking. 0=fixed, 1=single horizontal axis aligned
|
80 | 81 | north-south, 2=two-axis tracking, 3=vertical axis tracking, 4=single
|
81 | 82 | horizontal axis aligned east-west, 5=single inclined axis aligned
|
82 | 83 | north-south.
|
83 |
| - optimalinclination : bool, default: False |
| 84 | + optimalinclination: bool, default: False |
84 | 85 | Calculate the optimum tilt angle. Not relevant for 2-axis tracking
|
85 |
| - optimalangles : bool, default: False |
| 86 | + optimalangles: bool, default: False |
86 | 87 | Calculate the optimum tilt and azimuth angles. Not relevant for 2-axis
|
87 | 88 | tracking.
|
88 |
| - components : bool, default: True |
| 89 | + components: bool, default: True |
89 | 90 | Output solar radiation components (beam, diffuse, and reflected).
|
90 | 91 | Otherwise only global irradiance is returned.
|
91 |
| - url : str, default :const:`pvlib.iotools.pvgis.URL` |
92 |
| - base url of PVGIS API, append ``tmy`` to get TMY endpoint |
93 |
| - timeout : int, default: 30 |
94 |
| - time in seconds to wait for server response before timeout |
| 92 | + url: str, default:const:`pvlib.iotools.pvgis.URL` |
| 93 | + Base url of PVGIS API, append ``seriescalc`` to get hourly data |
| 94 | + endpoint |
| 95 | + timeout: int, default: 30 |
| 96 | + Time in seconds to wait for server response before timeout |
| 97 | +
|
95 | 98 | Returns
|
96 | 99 | -------
|
97 | 100 | data : pandas.DataFrame
|
98 |
| - the weather data |
99 |
| - months_selected : list |
100 |
| - TMY year for each month, ``None`` for basic and EPW |
| 101 | + Time-series of hourly data |
101 | 102 | inputs : dict
|
102 |
| - the inputs, ``None`` for basic and EPW |
| 103 | + Dictionary of the request input parameters |
103 | 104 | meta : list or dict
|
104 |
| - meta data, ``None`` for basic |
| 105 | + meta data |
| 106 | +
|
105 | 107 | Raises
|
106 | 108 | ------
|
107 | 109 | requests.HTTPError
|
108 | 110 | if the request response status is ``HTTP/1.1 400 BAD REQUEST``, then
|
109 | 111 | the error message in the response will be raised as an exception,
|
110 | 112 | otherwise raise whatever ``HTTP/1.1`` error occurred
|
| 113 | +
|
111 | 114 | See also
|
112 | 115 | --------
|
113 |
| - read_pvgis_tmy |
| 116 | + pvlib.iotools.read_pvgis_hourly |
| 117 | +
|
114 | 118 | References
|
115 | 119 | ----------
|
116 | 120 | .. [1] `PVGIS <https://ec.europa.eu/jrc/en/pvgis>`_
|
117 |
| - .. [2] `PVGIS hourly radiation data |
118 |
| - <https://re.jrc.ec.europa.eu/pvg_tools/en/#HR>`_ |
| 121 | + .. [2] `PVGIS Hourly Radiation |
| 122 | + <https://ec.europa.eu/jrc/en/PVGIS/tools/hourly-radiation>`_ |
119 | 123 | .. [3] `PVGIS Non-interactive service
|
120 | 124 | <https://ec.europa.eu/jrc/en/PVGIS/docs/noninteractive>`
|
121 | 125 | .. [3] `PVGIS horizon profile tool
|
@@ -170,6 +174,8 @@ def get_pvgis_hourly(lat, lon, angle=0, aspect=0,
|
170 | 174 | if outputformat == 'json':
|
171 | 175 | src = res.json()
|
172 | 176 | return _parse_pvgis_hourly_json(src)
|
| 177 | + elif outputformat == 'csv': |
| 178 | + return _parse_pvgis_hourly_csv(src) |
173 | 179 | else:
|
174 | 180 | # this line is never reached because if outputformat is not valid then
|
175 | 181 | # the response is HTTP/1.1 400 BAD REQUEST which is handled earlier
|
|
0 commit comments