pvlib.iotools.get_pvgis_tmy#
- pvlib.iotools.get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True, userhorizon=None, startyear=None, endyear=None, map_variables=True, url='https://re.jrc.ec.europa.eu/api/', timeout=30, roll_utc_offset=None, coerce_year=None)[source]#
Get TMY data from PVGIS.
For more information see the PVGIS [1] TMY tool documentation [2].
- Parameters:
latitude (float) – Latitude in degrees north
longitude (float) – Longitude in degrees east
outputformat (str, default 'json') – Must be in
['csv', 'basic', 'epw', 'json']
. See PVGIS TMY tool documentation [2] for more info.usehorizon (bool, default True) – include effects of horizon
userhorizon (list of float, optional) – Optional user-specified elevation of horizon in degrees, at equally spaced azimuth clockwise from north. If not specified, PVGIS will calculate the horizon [3]. If specified, requires
usehorizon=True
.startyear (int, optional) – first year to calculate TMY
endyear (int, optional) – last year to calculate TMY, must be at least 10 years from first year
map_variables (bool, default True) – When true, renames columns of the Dataframe to pvlib variable names where applicable. See variable
VARIABLE_MAP
.url (str, default:
pvlib.iotools.pvgis.URL
) – base url of PVGIS API, appendtmy
to get TMY endpointtimeout (int, default 30) – time in seconds to wait for server response before timeout
roll_utc_offset (int, optional) – Use to specify a time zone other than the default UTC zero and roll dataframe by
roll_utc_offset
so it starts at midnight on January 1st. Ignored ifNone
, otherwise will force year tocoerce_year
.coerce_year (int, optional) – Use to force indices to desired year. Will default to 1990 if
coerce_year
is not specified, butroll_utc_offset
is specified.
- Returns:
data (pandas.DataFrame) – the weather data
months_selected (list) – TMY year for each month,
None
for basic and EPWinputs (dict) – the inputs,
None
for basic and EPWmetadata (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
andendyear
. Specifyingendyear
also avoids the TMY changing when new data becomes available.- Raises:
requests.HTTPError – if the request response status is
HTTP/1.1 400 BAD REQUEST
, then the error message in the response will be raised as an exception, otherwise raise whateverHTTP/1.1
error occurred
See also
References