Skip to content

Add note concerning startyear/endyear to get_pvgis_tmy #1362

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jan 4, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 33 additions & 23 deletions pvlib/iotools/pvgis.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
Include effects of horizon
userhorizon: list of float, default: None
Optional user specified elevation of horizon in degrees, at equally
spaced azimuth clockwise from north, only valid if `usehorizon` is
true, if `usehorizon` is true but `userhorizon` is `None` then PVGIS
will calculate the horizon [4]_
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
PVGIS will calculate the horizon [4]_
pvcalculation: bool, default: False
Return estimate of hourly PV production.
peakpower: float, default: None
Expand All @@ -110,7 +110,7 @@ def get_pvgis_hourly(latitude, longitude, start=None, end=None,
outputformat: str, default: 'json'
Must be in ``['json', 'csv']``. See PVGIS hourly data
documentation [2]_ for more info.
url: str, default: const:`pvlib.iotools.pvgis.URL`
url: str, default: :const:`pvlib.iotools.pvgis.URL`
Base url of PVGIS API. ``seriescalc`` is appended to get hourly data
endpoint.
map_variables: bool, default: True
Expand Down Expand Up @@ -291,10 +291,10 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
Name, path, or buffer of hourly data file downloaded from PVGIS.
pvgis_format : str, default None
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
parameter in the PVGIS API. If `filename` is a file and
`pvgis_format` is ``None`` then the file extension will be used to
determine the PVGIS format to parse. If `filename` is a buffer, then
`pvgis_format` is required and must be in ``['csv', 'json']``.
parameter in the PVGIS API. If ``filename`` is a file and
``pvgis_format`` is ``None`` then the file extension will be used to
determine the PVGIS format to parse. If ``filename`` is a buffer, then
``pvgis_format`` is required and must be in ``['csv', 'json']``.
map_variables: bool, default True
When true, renames columns of the DataFrame to pvlib variable names
where applicable. See variable PVGIS_VARIABLE_MAP.
Expand All @@ -311,11 +311,11 @@ def read_pvgis_hourly(filename, pvgis_format=None, map_variables=True):
Raises
------
ValueError
if `pvgis_format` is ``None`` and the file extension is neither
``.csv`` nor ``.json`` or if `pvgis_format` is provided as
if ``pvgis_format`` is ``None`` and the file extension is neither
``.csv`` nor ``.json`` or if ``pvgis_format`` is provided as
input but isn't in ``['csv', 'json']``
TypeError
if `pvgis_format` is ``None`` and `filename` is a buffer
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer

See Also
--------
Expand Down Expand Up @@ -385,14 +385,14 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
include effects of horizon
userhorizon : list of float, default None
optional user specified elevation of horizon in degrees, at equally
spaced azimuth clockwise from north, only valid if `usehorizon` is
true, if `usehorizon` is true but `userhorizon` is `None` then PVGIS
will calculate the horizon [3]_
spaced azimuth clockwise from north, only valid if ``usehorizon`` is
true, if ``usehorizon`` is true but ``userhorizon`` is ``None`` then
PVGIS will calculate the horizon [3]_
startyear : int, default None
first year to calculate TMY
endyear : int, default None
last year to calculate TMY, must be at least 10 years from first year
url : str, default :const:`pvlib.iotools.pvgis.URL`
url : str, default: :const:`pvlib.iotools.pvgis.URL`
base url of PVGIS API, append ``tmy`` to get TMY endpoint
map_variables: bool
When true, renames columns of the Dataframe to pvlib variable names
Expand All @@ -411,6 +411,16 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
metadata : list or dict
file metadata, ``None`` for basic

Note
----
The PVGIS website uses 10 years of data to generate the TMY, whereas the
API accessed by this function defaults to using all available years. This
means that the TMY returned by this function may not be identical to the
one generated by the website. To replicate the website requests, specify
the corresponding 10 year period using ``startyear`` and ``endyear``.
Specifying ``endyear`` also avoids the TMY changing when new data becomes
available.

Raises
------
requests.HTTPError
Expand Down Expand Up @@ -548,12 +558,12 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
Name, path, or buffer of file downloaded from PVGIS.
pvgis_format : str, default None
Format of PVGIS file or buffer. Equivalent to the ``outputformat``
parameter in the PVGIS TMY API. If `filename` is a file and
`pvgis_format` is ``None`` then the file extension will be used to
parameter in the PVGIS TMY API. If ``filename`` is a file and
``pvgis_format`` is ``None`` then the file extension will be used to
determine the PVGIS format to parse. For PVGIS files from the API with
``outputformat='basic'``, please set `pvgis_format` to ``'basic'``. If
`filename` is a buffer, then `pvgis_format` is required and must be in
``['csv', 'epw', 'json', 'basic']``.
``outputformat='basic'``, please set ``pvgis_format`` to ``'basic'``.
If ``filename`` is a buffer, then ``pvgis_format`` is required and must
be in ``['csv', 'epw', 'json', 'basic']``.
map_variables: bool
When true, renames columns of the Dataframe to pvlib variable names
where applicable. See variable PVGIS_VARIABLE_MAP.
Expand All @@ -573,11 +583,11 @@ def read_pvgis_tmy(filename, pvgis_format=None, map_variables=None):
Raises
------
ValueError
if `pvgis_format` is ``None`` and the file extension is neither
``.csv``, ``.json``, nor ``.epw``, or if `pvgis_format` is provided as
if ``pvgis_format`` is ``None`` and the file extension is neither
``.csv``, ``.json``, nor ``.epw``, or if ``pvgis_format`` is provided as
input but isn't in ``['csv', 'epw', 'json', 'basic']``
TypeError
if `pvgis_format` is ``None`` and `filename` is a buffer
if ``pvgis_format`` is ``None`` and ``filename`` is a buffer

See also
--------
Expand Down