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=1990)[source]#

Get TMY data from PVGIS.

For more information see the PVGIS [1] TMY tool documentation [2].

Changed in version 0.13.0: The function now returns two items (data,meta). Previous versions of this function returned four elements (data,months_selected,inputs,meta). The inputs dictionary and months_selected are now included in meta, which has changed structure to accommodate it.

Parameters:
  • latitude (float) – Latitude in degrees north

  • longitude (float) – Longitude in degrees east

  • outputformat (str, default 'json') – Must be in ['csv', '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, append tmy to get TMY endpoint

  • timeout (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 if None, otherwise will force year to coerce_year.

  • coerce_year (int, default 1990) – Use to force indices to desired year. Defaults to 1990. Specify None to return the actual indices used for the TMY. If coerce_year is None, but roll_utc_offset is specified, then coerce_year will be set to the default.

Returns:

  • data (pandas.DataFrame) – the weather data

  • metadata (list or dict) – file metadata

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 whatever HTTP/1.1 error occurred

See also

read_pvgis_tmy

References