solrad.climate package#
Submodules#
solrad.climate.pvgis_tmy module#
This module contains all functions, methods and classes related to the computation and manipulation of Typical-Metheorological-Year (TMY) data obtained from PVGIS.
- solrad.climate.pvgis_tmy.climate_data_from_pvgis_tmy_dataframe(time_data, tmy_data, interp_method='linear')#
Generate climate data from PVGIS TMY (Time Meteorological Year) DataFrame, using an interpolation method of user choice.
- Parameters:
time_data (dict) – A dictionary containing the time series for simulation, separated by date. Its strucure is as follows. Each key must be a 3-tuple of (year : int, month : int, day :int) and each corresponding value has to be a pandas.DatetimeIndex object containing the time series of the date for which the climate data is to be calculated.
tmy_data (pandas.DataFrame) – A DataFrame containing pvgis’ TMY (Time Meteorological Year) data.
interp_method ({'linear', 'quadratic', 'cubic'}, optional) – The interpolation method to be used. Defaults is ‘linear’.
- Returns:
climate_data – A dictionary containing climate data for each specific year, month, and day. The keys are the same as for time_data. The corresponding values are pandas.DataFrames whose index are the pandas.DatetimeIndex objects contained in time_data and whose columns contain the climate variables from tmy_data, interpolated and evaluated at each time step.
- Return type:
dict
See also
Examples
>>> import solrad.geotime as tm >>> from solrad.climate.pvgis_tmy import get_pvgis_tmy_dataframe >>> from solard.climate.pvgis_tmy import climate_data_from_pvgis_tmy_dataframe >>> >>> time_data = tm.geo_date_range(latitude = 6.2518, >>> longitude = -75.5636, >>> tz = "-05:00", >>> start_time = "2023-01-01 00:00:00", >>> end_time = "2023-02-01 23:59:59.999", >>> freq = "5min", >>> min_hms = "sunrise", >>> max_hms = "sunset") >>> >>> pvgis_tmy_data = get_pvgis_tmy_dataframe(latitude = 6.2518, >>> longitude = -75.5636, >>> tz = "-05:00", >>> startyear = 2005, >>> endyear = 2015) >>> >>> climate_data = climate_data_from_pvgis_tmy_dataframe(time_data = time_data, >>> tmy_data = pvgis_tmy_data)
- solrad.climate.pvgis_tmy.get_pvgis_tmy_dataframe(latitude, longitude, tz, startyear, endyear, usehorizon=False, userhorizon=None)#
Get Typical Meteorological Year (TMY) data from PVGIS.
- Parameters:
latitude (float) – Site’s latitude in degrees. Must be a number between -90 and 90.
longitude (float) – Site’s longitude in degrees. Must be a number between -180 and 180.
tz (str) – Time zone string accepted by pandas.
startyear (int or None) – First year to calculate TMY.
endyear (int or None) – Last year to calculate TMY, must be at least 10 years from first year.
usehorizon (bool, optional) – Wether to include effects of horizon. Default is False.
userhorizon (list of float or None, optional) – Optional user specified elevation of horizon in degrees, at equally spaced azimuth values, clockwise from north. It is only valid if usehorizon is true. If usehorizon is true but userhorizon is None then PVGIS will calculate the horizon.
- Returns:
tmy_data – DataFrame contining the PVGIS TMY data for the whole year. Its index is a multiindex of (month, day, hour). Its columns, along with their descriptions, are as follows:
”T2m”: 2-m air temperature (degree Celsius)
”RH”: relative humidity (%)
”G(h)”: Global irradiance on the horizontal plane (W/m2)
”Gb(n)”: Beam/direct irradiance on a plane always normal to sun rays (W/m2)
”Gd(h)”: Diffuse irradiance on the horizontal plane (W/m2)
”IR(h)”: Surface infrared (thermal) irradiance on a horizontal plane (W/m2)
”WS10m”: 10-m total wind speed (m/s)
”WD10m”: 10-m wind direction (0 = N, 90 = E) (degree)
”SP”: Surface (air) pressure (Pa)
- Return type:
pandas.DataFrame obj of floats
Notes
1) Latitude of -90° corresponds to the geographic South pole, while a latitude of 90° corresponds to the geographic North Pole.
2) A negative longitude correspondes to a point west of the greenwhich meridian, while a positive longitude means it is east of the greenwhich meridian.
3) 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.
Examples
>>> from solrad.climate.pvgis_tmy import get_pvgis_tmy_dataframe >>> pvgis_tmy_data = get_pvgis_tmy_dataframe(latitude = 6.2518, >>> longitude = -75.5636, >>> tz = "-05:00", >>> startyear = 2005, >>> endyear = 2015)