Skip to content

Commit 10618a2

Browse files
committed
Improve docstring
1 parent 4a0e1b3 commit 10618a2

File tree

1 file changed

+43
-49
lines changed

1 file changed

+43
-49
lines changed

pvlib/iotools/meteonorm.py

Lines changed: 43 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
'dew_point_temperature': 'temp_dew',
2020
}
2121

22-
time_step_map = {
22+
TIME_STEP_MAP = {
2323
'1h': '1_hour',
2424
'h': '1_hour',
2525
'15min': '15_minutes',
@@ -38,20 +38,21 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
3838
The Meteonorm data options are described in [1]_ and the API is described
3939
in [2]_. A detailed list of API options can be found in [3]_.
4040
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.
4243
4344
Parameters
4445
----------
4546
latitude: float
4647
In decimal degrees, north is positive (ISO 19115).
4748
longitude: float
4849
In decimal degrees, east is positive (ISO 19115).
49-
start: datetime like, optional
50+
start: datetime like
5051
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
5354
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.
5556
api_key: str
5657
Meteonorm API key.
5758
endpoint : str
@@ -62,28 +63,26 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
6263
* ``'/forecast/basic'`` - forcast with hourly resolution
6364
* ``'/forecast/precision'`` - forecast with 15-min resolution
6465
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
7171
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'
7474
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'
7777
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
8080
Whether the index of the returned data object is of the type
8181
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
8484
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`.
8786
url: str, optional
8887
Base URL of the Meteonorm API. The ``endpoint`` parameter is
8988
appended to the url. The default is
@@ -142,13 +141,12 @@ def get_meteonorm(latitude, longitude, start, end, api_key, endpoint,
142141
params['horizon'] = ','.join(horizon)
143142

144143
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)
146145

147146
headers = {"Authorization": f"Bearer {api_key}"}
148147

149148
response = requests.get(
150149
urljoin(url, endpoint), headers=headers, params=params)
151-
print(response)
152150
if not response.ok:
153151
# response.raise_for_status() does not give a useful error message
154152
raise requests.HTTPError(response.json())
@@ -183,50 +181,46 @@ def get_meteonorm_tmy(latitude, longitude, api_key,
183181
In decimal degrees, east is positive (ISO 19115).
184182
api_key: str
185183
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
192189
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.
196193
horizon: str, optional
197194
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.
199196
'auto'.
200-
terrain: str, optional
197+
terrain: str, default : 'open'
201198
Local terrain situation. Must be one of: ['open', 'depression',
202199
'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.
207203
turbidity: list or 'auto', optional
208204
List of 12 monthly mean atmospheric Linke turbidity values. The default
209205
is 'auto'.
210206
random_seed: int, optional
211207
Random seed to be used for stochastic processes. Two identical requests
212208
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.
218213
future_scenario: str, optional
219214
Future climate scenario.
220215
future_year : int, optional
221216
Central year for a 20-year reference period in the future.
222-
interval_index: bool, optional
217+
interval_index: bool, default : False
223218
Whether the index of the returned data object is of the type
224219
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
227222
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`.
230224
url: str, optional.
231225
Base URL of the Meteonorm API. `'climate/tmy'` is
232226
appended to the URL. The default is:

0 commit comments

Comments
 (0)