Skip to content

Commit 2516c96

Browse files
authored
Add note concerning startyear/endyear to get_pvgis_tmy (#1362)
1 parent b3c1b5e commit 2516c96

File tree

1 file changed

+33
-23
lines changed

1 file changed

+33
-23
lines changed

pvlib/iotools/pvgis.py

Lines changed: 33 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
8383
Include effects of horizon
8484
userhorizon: list of float, default: None
8585
Optional user specified elevation of horizon in degrees, at equally
86-
spaced azimuth clockwise from north, only valid if `usehorizon` is
87-
true, if `usehorizon` is true but `userhorizon` is `None` then PVGIS
88-
will calculate the horizon [4]_
86+
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
87+
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
88+
PVGIS will calculate the horizon [4]_
8989
pvcalculation: bool, default: False
9090
Return estimate of hourly PV production.
9191
peakpower: float, default: None
@@ -110,7 +110,7 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
110110
outputformat: str, default: 'json'
111111
Must be in ``['json', 'csv']``. See PVGIS hourly data
112112
documentation [2]_ for more info.
113-
url: str, default: const:`pvlib.iotools.pvgis.URL`
113+
url: str, default: :const:`pvlib.iotools.pvgis.URL`
114114
Base url of PVGIS API. ``seriescalc`` is appended to get hourly data
115115
endpoint.
116116
map_variables: bool, default: True
@@ -291,10 +291,10 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
291291
Name, path, or buffer of hourly data file downloaded from PVGIS.
292292
pvgis_format : str, default None
293293
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
294-
parameter in the PVGIS API. If `filename` is a file and
295-
`pvgis_format` is ``None`` then the file extension will be used to
296-
determine the PVGIS format to parse. If `filename` is a buffer, then
297-
`pvgis_format` is required and must be in ``['csv', 'json']``.
294+
parameter in the PVGIS API. If ``filename`` is a file and
295+
``pvgis_format`` is ``None`` then the file extension will be used to
296+
determine the PVGIS format to parse. If ``filename`` is a buffer, then
297+
``pvgis_format`` is required and must be in ``['csv', 'json']``.
298298
map_variables: bool, default True
299299
When true, renames columns of the DataFrame to pvlib variable names
300300
where applicable. See variable PVGIS_VARIABLE_MAP.
@@ -311,11 +311,11 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
311311
Raises
312312
------
313313
ValueError
314-
if `pvgis_format` is ``None`` and the file extension is neither
315-
``.csv`` nor ``.json`` or if `pvgis_format` is provided as
314+
if ``pvgis_format`` is ``None`` and the file extension is neither
315+
``.csv`` nor ``.json`` or if ``pvgis_format`` is provided as
316316
input but isn't in ``['csv', 'json']``
317317
TypeError
318-
if `pvgis_format` is ``None`` and `filename` is a buffer
318+
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer
319319
320320
See Also
321321
--------
@@ -385,14 +385,14 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
385385
include effects of horizon
386386
userhorizon : list of float, default None
387387
optional user specified elevation of horizon in degrees, at equally
388-
spaced azimuth clockwise from north, only valid if `usehorizon` is
389-
true, if `usehorizon` is true but `userhorizon` is `None` then PVGIS
390-
will calculate the horizon [3]_
388+
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
389+
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
390+
PVGIS will calculate the horizon [3]_
391391
startyear : int, default None
392392
first year to calculate TMY
393393
endyear : int, default None
394394
last year to calculate TMY, must be at least 10 years from first year
395-
url : str, default :const:`pvlib.iotools.pvgis.URL`
395+
url : str, default: :const:`pvlib.iotools.pvgis.URL`
396396
base url of PVGIS API, append ``tmy`` to get TMY endpoint
397397
map_variables: bool
398398
When true, renames columns of the Dataframe to pvlib variable names
@@ -411,6 +411,16 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
411411
metadata : list or dict
412412
file metadata, ``None`` for basic
413413
414+
Note
415+
----
416+
The PVGIS website uses 10 years of data to generate the TMY, whereas the
417+
API accessed by this function defaults to using all available years. This
418+
means that the TMY returned by this function may not be identical to the
419+
one generated by the website. To replicate the website requests, specify
420+
the corresponding 10 year period using ``startyear`` and ``endyear``.
421+
Specifying ``endyear`` also avoids the TMY changing when new data becomes
422+
available.
423+
414424
Raises
415425
------
416426
requests.HTTPError
@@ -548,12 +558,12 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
548558
Name, path, or buffer of file downloaded from PVGIS.
549559
pvgis_format : str, default None
550560
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
551-
parameter in the PVGIS TMY API. If `filename` is a file and
552-
`pvgis_format` is ``None`` then the file extension will be used to
561+
parameter in the PVGIS TMY API. If ``filename`` is a file and
562+
``pvgis_format`` is ``None`` then the file extension will be used to
553563
determine the PVGIS format to parse. For PVGIS files from the API with
554-
``outputformat='basic'``, please set `pvgis_format` to ``'basic'``. If
555-
`filename` is a buffer, then `pvgis_format` is required and must be in
556-
``['csv', 'epw', 'json', 'basic']``.
564+
``outputformat='basic'``, please set ``pvgis_format`` to ``'basic'``.
565+
If ``filename`` is a buffer, then ``pvgis_format`` is required and must
566+
be in ``['csv', 'epw', 'json', 'basic']``.
557567
map_variables: bool
558568
When true, renames columns of the Dataframe to pvlib variable names
559569
where applicable. See variable PVGIS_VARIABLE_MAP.
@@ -573,11 +583,11 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
573583
Raises
574584
------
575585
ValueError
576-
if `pvgis_format` is ``None`` and the file extension is neither
577-
``.csv``, ``.json``, nor ``.epw``, or if `pvgis_format` is provided as
586+
if ``pvgis_format`` is ``None`` and the file extension is neither
587+
``.csv``, ``.json``, nor ``.epw``, or if ``pvgis_format`` is provided as
578588
input but isn't in ``['csv', 'epw', 'json', 'basic']``
579589
TypeError
580-
if `pvgis_format` is ``None`` and `filename` is a buffer
590+
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer
581591
582592
See also
583593
--------

0 commit comments

Comments
 (0)