19
19
'dew_point_temperature' : 'temp_dew' ,
20
20
}
21
21
22
- time_step_map = {
22
+ TIME_STEP_MAP = {
23
23
'1h' : '1_hour' ,
24
24
'h' : '1_hour' ,
25
25
'15min' : '15_minutes' ,
@@ -38,20 +38,21 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
38
38
The Meteonorm data options are described in [1]_ and the API is described
39
39
in [2]_. A detailed list of API options can be found in [3]_.
40
40
41
- This function supports historical and forecast data, but not TMY.
41
+ This function supports retrieval of historical and forecast data, but not
42
+ TMY.
42
43
43
44
Parameters
44
45
----------
45
46
latitude: float
46
47
In decimal degrees, north is positive (ISO 19115).
47
48
longitude: float
48
49
In decimal degrees, east is positive (ISO 19115).
49
- start: datetime like, optional
50
+ start: datetime like
50
51
First timestamp of the requested period. If a timezone is not
51
- specified, UTC is assumed. A relative datetime string is also allowed .
52
- end: datetime like, optional
52
+ specified, UTC is assumed. Relative datetime strings are supported .
53
+ end: datetime like
53
54
Last timestamp of the requested period. If a timezone is not
54
- specified, UTC is assumed. A relative datetime string is also allowed .
55
+ specified, UTC is assumed. Relative datetime strings are supported .
55
56
api_key: str
56
57
Meteonorm API key.
57
58
endpoint : str
@@ -62,28 +63,26 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
62
63
* ``'/forecast/basic'`` - forcast with hourly resolution
63
64
* ``'/forecast/precision'`` - forecast with 15-min resolution
64
65
65
- parameters : list, optional
66
- List of parameters to request or 'all' to get all parameters. The
67
- default is 'all'.
68
- surface_tilt: float, optional
69
- Tilt angle from horizontal plane. The default is 0.
70
- surface_azimuth: float, optional
66
+ parameters: list or 'all', default 'all'
67
+ List of parameters to request or `'all'` to get all parameters.
68
+ surface_tilt: float, default : 0
69
+ Tilt angle from horizontal plane.
70
+ surface_azimuth: float, default : 180
71
71
Orientation (azimuth angle) of the (fixed) plane. Clockwise from north
72
- (north=0, east=90, south=180, west=270). The default is 180.
73
- time_step : {'1min', '15min', '1h'}, optional
72
+ (north=0, east=90, south=180, west=270).
73
+ time_step : {'1min', '15min', '1h'}, default : '15min'
74
74
Frequency of the time series. The parameter is ignored when requesting
75
- forcasting data. The default is '15min'.
76
- horizon : str, optional
75
+ forcasting data.
76
+ horizon : str or list, default : 'auto'
77
77
Specification of the horizon line. Can be either a 'flat', 'auto', or
78
- a list of 360 horizon elevation angles. The default is 'auto'.
79
- interval_index: bool, optional
78
+ a list of 360 horizon elevation angles.
79
+ interval_index: bool, default : False
80
80
Whether the index of the returned data object is of the type
81
81
pd.DatetimeIndex or pd.IntervalIndex. This is an experimental feature
82
- which may be removed without warning. The default is False.
83
- map_variables: bool, optional
82
+ which may be removed without warning.
83
+ map_variables: bool, default : True
84
84
When true, renames columns of the Dataframe to pvlib variable names
85
- where applicable. The default is True. See variable
86
- :const:`VARIABLE_MAP`.
85
+ where applicable. See variable :const:`VARIABLE_MAP`.
87
86
url: str, optional
88
87
Base URL of the Meteonorm API. The ``endpoint`` parameter is
89
88
appended to the url. The default is
@@ -142,13 +141,12 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
142
141
params ['horizon' ] = ',' .join (horizon )
143
142
144
143
if 'forecast' not in endpoint .lower ():
145
- params ['frequency' ] = time_step_map .get (time_step , time_step )
144
+ params ['frequency' ] = TIME_STEP_MAP .get (time_step , time_step )
146
145
147
146
headers = {"Authorization" : f"Bearer { api_key } " }
148
147
149
148
response = requests .get (
150
149
urljoin (url , endpoint ), headers = headers , params = params )
151
- print (response )
152
150
if not response .ok :
153
151
# response.raise_for_status() does not give a useful error message
154
152
raise requests .HTTPError (response .json ())
@@ -183,50 +181,46 @@ def get_meteonorm_tmy(latitude, longitude, api_key,
183
181
In decimal degrees, east is positive (ISO 19115).
184
182
api_key: str
185
183
Meteonorm API key.
186
- parameters: list, optional
187
- List of parameters to request or 'all' to get all parameters. The
188
- default is 'all'.
189
- surface_tilt: float, optional
190
- Tilt angle from horizontal plane. The default is 0.
191
- surface_azimuth : float, optional
184
+ parameters: list or 'all', default 'all'
185
+ List of parameters to request or `'all'` to get all parameters.
186
+ surface_tilt: float, default : 0
187
+ Tilt angle from horizontal plane.
188
+ surface_azimuth : float, default : 180
192
189
Orientation (azimuth angle) of the (fixed) plane. Clockwise from north
193
- (north=0, east=90, south=180, west=270). The default is 180.
194
- time_step: {'1min', '1h'}, optional
195
- Frequency of the time series. The default is '1h'.
190
+ (north=0, east=90, south=180, west=270).
191
+ time_step: {'1min', '1h'}, default : '1h'
192
+ Frequency of the time series.
196
193
horizon: str, optional
197
194
Specification of the hoirzon line. Can be either 'flat' or 'auto', or
198
- specified as a list of 360 horizon elevation angles. The default is
195
+ specified as a list of 360 horizon elevation angles.
199
196
'auto'.
200
- terrain: str, optional
197
+ terrain: str, default : 'open'
201
198
Local terrain situation. Must be one of: ['open', 'depression',
202
199
'cold_air_lake', 'sea_lake', 'city', 'slope_south',
203
- 'slope_west_east']. The default is 'open'.
204
- albedo: float, optional
205
- Ground albedo. Albedo changes due to snow fall are modelled. The
206
- default is 0.2.
200
+ 'slope_west_east'].
201
+ albedo: float, default : 0.2
202
+ Ground albedo. Albedo changes due to snow fall are modelled.
207
203
turbidity: list or 'auto', optional
208
204
List of 12 monthly mean atmospheric Linke turbidity values. The default
209
205
is 'auto'.
210
206
random_seed: int, optional
211
207
Random seed to be used for stochastic processes. Two identical requests
212
208
with the same random seed will yield identical results.
213
- clear_sky_radiation_model : {'esra', 'solis'}
214
- Which clearsky model to use. The default is 'esra'.
215
- data_version : str, optional
216
- Version of Meteonorm climatological data to be used. The default is
217
- 'latest'.
209
+ clear_sky_radiation_model : str, default : 'esra'
210
+ Which clearsky model to use. Must be either `'esra'` or `'solis'`.
211
+ data_version : str, default : 'latest'
212
+ Version of Meteonorm climatological data to be used.
218
213
future_scenario: str, optional
219
214
Future climate scenario.
220
215
future_year : int, optional
221
216
Central year for a 20-year reference period in the future.
222
- interval_index: bool, optional
217
+ interval_index: bool, default : False
223
218
Whether the index of the returned data object is of the type
224
219
pd.DatetimeIndex or pd.IntervalIndex. This is an experimental feature
225
- which may be removed without warning. The default is False.
226
- map_variables: bool, optional
220
+ which may be removed without warning.
221
+ map_variables: bool, default : True
227
222
When true, renames columns of the Dataframe to pvlib variable names
228
- where applicable. See variable :const:`VARIABLE_MAP`. The default is
229
- True.
223
+ where applicable. See variable :const:`VARIABLE_MAP`.
230
224
url: str, optional.
231
225
Base URL of the Meteonorm API. `'climate/tmy'` is
232
226
appended to the URL. The default is:
0 commit comments