Retrieve weather data from the Oikolab API and return it as a pandas DataFrame.
This function sends a request to the Oikolab weather API, fetches the specified
weather parameters for a given location and time range, and returns the data
in a pandas DataFRame.
API key for authentication with the Oikolab service.
paramlist[str], optional
List of weather parameters to retrieve. If None, the following parameters
will be fetched. Default is None.
[‘temperature’, ‘dewpoint_temperature’, ‘mean_sea_level_pressure’,
‘wind_speed’, ‘100m_wind_speed’, ‘relative_humidity’,
‘surface_solar_radiation’, ‘direct_normal_solar_radiation’,
‘surface_diffuse_solar_radiation’, ‘surface_thermal_radiation’,
‘total_cloud_cover’, ‘total_precipitation’]
modelstr, optional
Weather model to use for data retrieval. Default is “era5”.
freqstr, optional
Frequency of the data points. Default is “H” (hourly).
Returns sun elevation and azimuth angle (Degree) based on latitude and longitude.
based on Jérôme’s python code interpretation of stackoverflow answer to :
https://stackoverflow.com/questions/8708048/
position-of-the-sun-given-time-of-day-latitude-and-longitude
references :
Michalsky, J.J. 1988. The Astronomical Almanac’s algorithm for approximate solar
position (1950-2050). Solar Energy. 40(3):227-235.
Michalsky, J.J. 1989. Errata. Solar Energy. 43(5):323.
Spencer, J.W. 1989. Comments on “The Astronomical Almanac’s Algorithm for
Approximate Solar Position (1950-2050)”. Solar Energy. 42(4):353.
Walraven, R. 1978. Calculating the position of the sun. Solar Energy. 20:393-397.
Determine diffuse irradiance from the sky on a tilted surface using
the isotropic sky model.
\[I_{d} = DHI\]
rac{1 + coseta}{2}
Hottel and Woertz’s model treats the sky as a uniform source of
diffuse irradiance. Thus, the diffuse irradiance from the sky (ground
reflected irradiance is not included in this algorithm) on a tilted
surface can be found from the diffuse horizontal irradiance and the
tilt angle of the surface. A discussion of the origin of the
isotropic model can be found in [2]_.
surface_tiltnumeric
Surface tilt angle in decimal degrees. Tilt must be >=0 and
<=180. The tilt angle is defined as degrees from horizontal
(e.g. surface facing up = 0, surface facing horizon = 90)
dhinumeric
Diffuse horizontal irradiance in W/m^2. DHI must be >=0.
Surface tilt angles in decimal degrees. Tilt must be >=0 and
<=180. The tilt angle is defined as degrees from horizontal
(e.g. surface facing up = 0, surface facing horizon = 90).
ghinumeric
Global horizontal irradiance. \(W/m^2\)
albedonumeric, default 0.25
Ground reflectance, typically 0.1-0.4 for surfaces on Earth
(land), may increase over snow, ice, etc. May also be known as
the reflection coefficient. Must be >=0 and <=1.
grounddiffusenumeric
Ground reflected irradiance. \(W/m^2\)
Table of albedo values by surface_type are from [2]_, [3], [4];
see SURFACE_ALBEDOS.