Meteo Module

The meteo module provides functionality for handling meteorological data and calculations.

tide.meteo.get_oikolab_df(lat, lon, start, end, api_key, param=None, model='era5', freq='H')[source]

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.

Return type:

DataFrame

Parameters:

latfloat

Latitude of the location.

lonfloat

Longitude of the location.

startpd.Timestamp | dt.datetime

Start date and time for the data request.

endpd.Timestamp | dt.datetime

End date and time for the data request.

api_keystr

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).

See Oikolab API doc for further informations : https://docs.oikolab.com/references/

tide.meteo.sun_position(date, lat=46.5, long=6.5)[source]

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.

Parameters:
  • date (datetime) – datetime object

  • lat (float) – latitude in degree

  • long (float) – longitude in degree

Returns:

(elevation, azimuth) in degree

tide.meteo.aoi_projection(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth)[source]

https://pvlib-python.readthedocs.io/en/stable/

Calculates the dot product of the sun position unit vector and the surface normal unit vector; in other words, the cosine of the angle of incidence.

Usage note: When the sun is behind the surface the value returned is negative. For many uses negative values must be set to zero.

Input all angles in degrees.

Parameters:
  • surface_tilt (numeric) – Panel tilt from horizontal.

  • surface_azimuth (numeric) – Panel azimuth from north.

  • solar_zenith (numeric) – Solar zenith angle.

  • solar_azimuth (numeric) – Solar azimuth angle.

Returns:

projection – Dot product of panel normal and solar angle.

Return type:

numeric

tide.meteo.beam_component(surface_tilt, surface_azimuth, solar_zenith, solar_azimuth, dni)[source]

=== Function extracted from pvlib module === https://pvlib-python.readthedocs.io/en/stable/

Calculates the beam component of the plane of array irradiance.

Parameters:
  • surface_tilt (numeric) – Panel tilt from horizontal.

  • surface_azimuth (numericbl) – Panel azimuth from north.

  • solar_zenith (numeric) – Solar zenith angle.

  • solar_azimuth (numeric) – Solar azimuth angle.

  • dni (numeric) – Direct Normal Irradiance

Returns:

beam – Beam component

Return type:

numeric

tide.meteo.sky_diffuse(surface_tilt, dhi)[source]

https://pvlib-python.readthedocs.io/en/stable/

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.

diffusenumeric

The sky diffuse component of the solar radiation.

tide.meteo.ground_diffuse(surface_tilt, ghi, albedo=0.25)[source]

https://pvlib-python.readthedocs.io/en/stable/

Estimate diffuse irradiance on a tilted surface from ground reflections.

Ground diffuse irradiance is calculated as

\[G_{ground} = GHI imes\]

ho imes rac{1 - coseta}{2}

where :math:`

ho` is albedo and \(eta\) is surface_tilt.

surface_tiltnumeric

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.