Reference guide#

openalea.astk.sky_irradiance module#

Equation for determining global horizontal irradiance (GHI), PPFD, direct normal irradiance (DNI) and diffuse horizontal irradiance (DHI) under clearsky condition or estimate them from meteorological data

This module is mainly a collection of syntactic sugar to pvlib clearsky and irradiances packages.

openalea.astk.sky_irradiance.actual_sky_irradiances(dates=None, daydate='2000-06-21', ghi=None, attenuation=None, pressure=101325, temp_dew=None, longitude=3.52, latitude=43.36, altitude=56, timezone='Europe/Paris', with_pvlib=True)[source]#

Estimate component of sky irradiances from measured actual global horizontal irradiance or attenuated clearsky conditions.

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range). If None, daydate is used.

  • daydate – (str) yyyy-mm-dd (not used if dates is not None).

  • ghi – (array_like) : global horizontal irradiance (W. m-2).If None (default) clear_sky irradiance are used

  • attenuation – (float) a attenuation factor for ghi (actual_ghi = attenuation * ghi). If None (default), no attenuation is applied

  • pressure – the site pressure (Pa) (for dirint model)

  • temp_dew – the dew point temperature (dirint model)

  • longitude – (float) in degrees

  • latitude – (float) in degrees

  • altitude – (float) in meter

  • timezone – (str) the time zone (not used if dates are already localised)

  • with_pvlib – Should we use pvlib library to estimate sky irradiances ?

Returns:

a pandas dataframe with global horizontal irradiance, direct normal irradiance and diffuse horizontal irradiance.

Details:

if with_pvlib is True, the ‘dirint’ model of Perez (1992) is used, otherwise the model of Spitters (1986) is used

Perez, R., P. Ineichen, E. Maxwell, R. Seals and A. Zelenka, (1992). “Dynamic Global-to-Direct Irradiance

Conversion Models”, ASHRAE Transactions-Research Series, pp. 354-369

Spitters CJT, Toussaint HAJM, Goudriaan J (1986) “Separating the diffuse and direct component of global

radiation and its implications for modeling canopy photosynthesis.Part I.Components of incoming radiation”, Agricultural and Forest Meteorology 38: 217-229.

openalea.astk.sky_irradiance.air_mass(zenith, altitude=0, with_pvlib=True)[source]#

Estimate the pressure-corrected air mass (optical path length relative to zenital path at a location)

Parameters:
  • zenith – an array-like object of zenital directions (degrees)

  • altitude – (float)

  • with_pvlib – Should we use pvlib library to estimate air mass ?

openalea.astk.sky_irradiance.all_weather_sky_brightness(dates, dhi, sun_zenith, altitude=0, with_pvlib=True)[source]#

Sky brightness as defined in all_weather sky model (Perez et al. 1993)

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range)

  • dhi – diffuse horizontal irradiance

  • sun_zenith – zenith angle of the sun (deg)

  • altitude – altitude of the location

  • with_pvlib – Should we use pvlib library to estimate air mass ?

Returns:

sky brightness

Details:

R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245.

openalea.astk.sky_irradiance.all_weather_sky_clearness(dni, dhi, sun_zenith)[source]#

Sky clearness as defined in all_weather sky model (Perez et al. 1993)

Parameters:
  • dni – direct normal irradiance

  • dhi – diffuse horizontal irradiance

  • sun_zenith – zenith angle of the sun (deg)

Returns:

sky clearness

Details:

R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245,

openalea.astk.sky_irradiance.clear_sky_irradiances(dates=None, daydate='2000-06-21', longitude=3.52, latitude=43.36, altitude=56, timezone='Europe/Paris', with_pvlib=True)[source]#

Estimate component of sky irradiance for clear sky conditions

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range). If None, daydate is used.

  • daydate – (str) yyyy-mm-dd (not used if dates is not None).

  • longitude – (float) in degrees

  • latitude – (float) in degrees

  • altitude – (float) in meter

  • timezone – (str) the time zone (not used if dates are already localised)

  • with_pvlib – Should we use pvlib library to estimate clearsky ?

Returns:

a pandas dataframe with global horizontal irradiance, direct normal irradiance and diffuse horizontal irradiance.

Details:

if with_pvlib is True, the Ineichen (2002) model is used, otherwise GHI is computed after Haurwitz (1945) and DNI after Meinel (1976).

  1. Ineichen and R. Perez, “A New airmass independent formulation for the Linke turbidity coefficient”,

Solar Energy, vol 73, pp. 151-157, 2002

  1. Haurwitz, “Insolation in Relation to Cloudiness and Cloud Density”, Journal of Meteorology, vol. 2,

pp. 154-166, 1945.

    1. Meinel and M. P. Meinel, Applied solar energy. Reading, MA: Addison-Wesley Publishing Co., 1976

openalea.astk.sky_irradiance.clearness_index(dates, ghi)[source]#

Clearness index (Liu and Jordan 1960)

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range)

  • ghi – global horizontal irradiance

Returns:

clearness index

Details:

Benjamin Y.H. Liu, Richard C. Jordan, “The interrelationship and characteristic distribution of direct, diffuse and total solar radiation”, Solar Energy, Volume 4, Issue 3, 1960, Pages 1-19.

openalea.astk.sky_irradiance.directional_luminance(h_irradiance, elevation)[source]#

directional luminance of a source producing a given horizontal irradiance

openalea.astk.sky_irradiance.f_clear_sky(epsilon)[source]#

Clear-sky / overcast mixing fractions for blended sky irradiance model

ref : J. Mardaljevic. Daylight Simulation: Validation, Sky Models and Daylight Coefficients. PhD thesis, De Montfort University, Leicester, UK, 2000. p193,eq. 5-10

Parameters:

epsilon – all weather sky clearness

openalea.astk.sky_irradiance.horizontal_irradiance(d_luminance, elevation)[source]#

horizontal irradiance of a source emitting a given directional luminance

openalea.astk.sky_irradiance.micromol_per_joule(dates, ghi, sun_elevation, temp_dew=None)[source]#

Conversion factor between micromol of PAR and Joule of broadband shortwave solar radiation (Alados et al. 1996)

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range)

  • ghi – global horizontal irradiance (W.m-2)

  • sun_elevation – the elevation angle of the sun (deg)

  • temp_dew – the dew point temperature (°C) (optional, yields better estimates)

Details:

I. Alados, I. Foyo-Moreno, L. Alados-Arboledas, “Photosynthetically active radiation: measurements and modelling”, Agricultural and Forest Meteorology, Volume 78, Issues 1–2, 1996, Pages 121-131,

openalea.astk.sky_irradiance.sky_irradiance(dates=None, ghi=None, dhi=None, ppfd=None, daydate='2000-06-21', day_ghi=None, attenuation=None, pressure=101325, temp_dew=None, longitude=3.52, latitude=43.36, altitude=56, timezone='Europe/Paris', with_pvlib=True)[source]#

Estimate variables related to sky irradiance.

Parameters:
  • dates – A pandas datetime index (as generated by pandas.date_range). If None, daydate is used.

  • ghi – (array_like) : global horizontal irradiance (W. m-2).If None (default) clear_sky irradiance are used

  • dhi – (array-like): diffuse horizontal irradiance

  • ppfd – (array-like) photosynthetically active photon flux density (micromol.m-2.s-1) component of ghi. If None (default), ppfd will be estimated as a function of meteoroligcal conditions and ghi

  • daydate – (str) yyyy-mm-dd (only used if dates is None).

  • day_ghi (float) – Daily global horizontal irradiance (MJ). Only used if dates is None. If None (default), clear sky irradiance are used

  • attenuation – (float) a attenuation factor for ghi or daily_global (actual_ghi = attenuation * ghi). If None (default), no attenuation is applied. If dhi is not None, this parameter is not taken into account.

  • pressure – the site pressure (Pa) (for dirint model)

  • temp_dew – the dew point temperature (dirint model)

  • longitude – (float) in degrees

  • latitude – (float) in degrees

  • altitude – (float) in meter

  • timezone – (str) the time zone (not used if dates are already localised)

  • with_pvlib – Should we use pvlib library to estimate sky irradiances ?

Returns:

a pandas dataframe with azimuth, zenital and elevation angle of the sun, global horizontal irradiance, direct normal irradiance and diffuse horizontal irradiance of the sky.

openalea.astk.sky_irradiance.spitters_daily_diffuse_fraction(ghi, daydate='2000-06-21')[source]#

estimate the diffuse fraction using daily averages of global horizontal irradiance

openalea.astk.sky_luminance module#

A collection of equation for modelling distribution of sky luminance

openalea.astk.sky_luminance.all_weather_abcde(sun_zenith, clearness, brightness)[source]#

Parameters of the all weather sky model (Perez et al. 1993)

Parameters:
  • sun_zenith – zenith angle of the sun (deg)

  • clearness – sky clearness as defined in Perez et al. (1993

  • brightness – sky brightness as defined in Perez et al. (1993)

Returns:

a tuple of 5 parameters to be used by CIE sky luminance functions

Details:

R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245,

openalea.astk.sky_luminance.all_weather_relative_luminance(grid, sun_zenith, sun_azimuth, clearness, brightness)[source]#

All weather relative luminance of a sky element relative to the luminance at zenith

Parameters:
  • grid – a (azimuth, zenith, az_c, z_c) tuple, such as returned by astk.sky_grid

  • sun_zenith – zenith angle of the sun (deg)

  • sun_azimuth – azimuth angle of the sun (deg)

  • clearness – sky clearness as defined in Perez et al. (1993

  • brightness – sky brightness as defined in Perez et al. (1993)

  • Details – R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245,

openalea.astk.sky_luminance.cie_luminance_gradation(z, a=4, b=-0.7)[source]#

function giving the dependence of the luminance of a sky element to its zenith angle

CIE, 2002, Spatial distribution of daylight CIE standard general sky, CIE standard, CIE Central Bureau, Vienna

z : zenith angle of the sky element (deg) a, b : coefficient for the type of sky

openalea.astk.sky_luminance.cie_relative_luminance(sky_zenith=None, grid=None, sun_zenith=None, sun_azimuth=None, type='soc')[source]#

cie relative luminance of a sky element relative to the luminance at zenith

sky_zenith : zenith angle of the sky element (deg) sky_azimuth: azimuth angle of the sky element (deg) sun_zenith : zenith angle of the sun (deg) sun_azimuth: azimuth angle of the sun (deg) type is one of ‘soc’ (standard overcast sky), ‘uoc’ (uniform radiance) or ‘clear_sky’ (standard clear sky low turbidity)

openalea.astk.sky_luminance.cie_scattering_indicatrix(ksi, ksi_sun=0, c=10, d=-3, e=-0.45)[source]#

function giving the dependence of the luminance to its angular distance to the sun

CIE, 2002, Spatial distribution of daylight CIE standard general sky, CIE standard, CIE Central Bureau, Vienna

ksi: angular distance to the sun (deg) ksi_sun: angular distance of zenith to the sun, ie zenith angle of the sun (deg) c, d, e : coefficient for the type of sky

openalea.astk.sky_luminance.sky_luminance(grid, sky_type='soc', sky_irradiance=None, scale=None, sun_in_sky=False)[source]#

Sun and sky luminance as a function of sky type and sky_irradiance

Parameters:
  • grid – a (azimuth, zenith, az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid

  • sky_type (str) – sky type (see details below), one of (‘soc’, ‘uoc’, ‘clear_sky’, ‘sun_soc’, ‘blended’, ‘all_weather’).

  • sky_irradiance – a datetime indexed dataframe specifying sky irradiances for the period , such as returned by astk.meteorology.sky_irradiance.sky_irradiance. Needed for all sky_types except ‘uoc’ and ‘soc’

  • scale (str) – How should sun/sky luminance be scaled ? If None (default) luminance are scaled so that sun+sky horizontal irradiance equals one. Other options are: - ‘ghi’: sun+sky horizontal flux equals mean ghi (W.m-2.s-1) - ‘ppfd’ : sun+sky horizontal flux equals mean PPFD (micromolPAR.m-2.s-1) - ‘global’: sun+sky horizontal flux equals time-integrated global irradiance (MJ.m-2) - ‘par’: sun+sky horizontal flux equals time-integrated PPFD (molPAR.m-2)

  • sun_in_sky – Should the sun be added to the sky ? If True, sky luminance is set to sun luminance in the sun region, and sun luminance list is emptied. Ignored for sky types ‘uoc’ and ‘soc’.

Returns:

a (sun_elevation, sun_azimuth, sun_luminance), sky_luminance tuple defining sun luminance

over the period and a sky luminance gridded array

Return type:

sun, sky

Details:
sky_type refer to different sky models:
  • ‘clear_sky’, ‘uoc’ and ‘soc’ are CIE sky types defined in [1]. For all these types, only relative sky luminance

    are returned (sun source list is empty), and total sky horizontal irradiance equals one.

  • ‘sun_soc’ refers to the approach defined in [2] where direct normal irradiance comes from the sun, and

    diffuse horizontal irradiance comes from an CIE soc sky luminance distribution

  • ‘blended’ refers to the sky blending approach defined in [3], where direct normal irradiance comes from

    the sun, and diffuse horizontal irradiance comes from a blending of CIE clear-sky and CIE soc sky luminance distribution, that depends on sky clearness index

  • ‘all_weather’ refers to the approach defined in [4], where direct normal irradiance comes from

    the sun, and diffuse horizontal irradiance comes from a luminance distribution that depends on sky clearness and sky brightness

[1] CIE, 2002, Spatial distribution of daylight CIE standard general sky,

CIE standard, CIE Central Bureau, Vienna

[2] Sinoquet H. & Bonhomme R. (1992) Modeling radiative transfer in mixed and row intercropping

systems. Agricultural and Forest Meteorology 62, 219–240

[3] J. Mardaljevic. Daylight Simulation: Validation, Sky Models and Daylight Coefficients. PhD thesis, De Montfort University,

Leicester, UK, 2000. p193,eq. 5-10

[4] R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and

validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245

openalea.astk.sky_sources module#

A collection of equation for modelling sun position, sun irradiance and sky irradiance

openalea.astk.sky_sources.caribu_light_sources(sun, sky, north=90)[source]#
openalea.astk.sky_sources.hierarchical_turtle(sectors=46)[source]#
openalea.astk.sky_sources.icospherical_turtle(sectors=46)[source]#
openalea.astk.sky_sources.polar_angle(azimuth, north=90)[source]#

Convert azimuth (from north, positive clockwise) to polar angle (from X+, positive counter-clockwise)

Parameters:
  • azimuth (array-like) – the azimuth angle (deg), from north, positive clockwise

  • north – the angle between X+ and North (deg, positive counter-clockwise)

openalea.astk.sky_sources.regular_sky(d_az=10, d_z=10, n_az=None, n_z=None)[source]#
openalea.astk.sky_sources.sky_sources(sky_type='soc', sky_irradiance=None, sky_dirs=None, scale=None, sun_in_sky=False, force_hi=True)[source]#

Light sources representing the sun and the sky in a scene

Parameters:
  • sky_type (str) – sky type (see details below), one of (‘soc’, ‘uoc’, ‘clear_sky’, ‘sun_soc’, ‘blended’, ‘all_weather’).

  • sky_irradiance – a datetime indexed dataframe specifying sky irradiances for the period, such as returned by astk.meteorology.sky_irradiance.sky_irradiance. Needed for all sky_types except ‘uoc’ and ‘soc’

  • sky_dirs (list) – a [(elevation,azimuth),…] list of directions sampling the sky hemisphere. If None (default) a hierarchical turtle discretisation of 46 directions is used. Azimuths are relative to North, positive clockwise

  • scale (str) – How should sun/sky luminance be scaled ? If None (default) luminance are scaled so that sun+sky horizontal irradiance equals one. Other options are: - ‘ghi’: sun+sky horizontal flux equals mean ghi (W.m-2.s-1) - ‘ppfd’ : sun+sky horizontal flux equals mean PPFD (micromolPAR.m-2.s-1) - ‘global’: sun+sky horizontal flux equals time-integrated global irradiance (MJ.m-2) - ‘par’: sun+sky horizontal flux equals time-integrated PPFD (molPAR.m-2)

  • sun_in_sky – Should the sun be added to the sky ? If True, sky luminance is set to sun luminance in the sun region, and sun luminance list is emptied. Ignored for sky types ‘uoc’ and ‘soc’.

  • force_hi – if True (default), sky sources are rescaled to ensure that global horizontal irradiance of discretised sources is the same as the original sky luminance distribution. If False , no rescaling append, ensuring that global direct irradiance of sky is preserved

Returns:

sun, sky tuple sun and sky are lists of (elevation (degrees), azimuth (degrees, from North positive clockwise), horizontal_irradiance) tuples of sources representing the sun or the sky

Details:
sky_type refer to different sky models:
  • ‘clear_sky’, ‘uoc’ and ‘soc’ are CIE sky types defined in [1]. For all these types, only relative sky luminance

    are returned (sun source list is empty), and total sky horizontal irradiance equals one.

  • ‘sun_soc’ refers to the approach defined in [2] where direct normal irradiance comes from the sun, and

    diffuse horizontal irradiance comes from an CIE soc sky luminance distribution

  • ‘blended’ refers to the sky blending approach defined in [3], where direct normal irradiance comes from

    the sun, and diffuse horizontal irradiance comes from a blending of CIE clear-sky and CIE soc sky luminance distribution, that depends on sky clearness index

  • ‘all_weather’ refers to the approach defined in [4], where direct normal irradiance comes from

    the sun, and diffuse horizontal irradiance comes from a luminance distribution that depends on sky clearness and sky brightness

[1] CIE, 2002, Spatial distribution of daylight CIE standard general sky,

CIE standard, CIE Central Bureau, Vienna

[2] Sinoquet H. & Bonhomme R. (1992) Modeling radiative transfer in mixed and row intercropping

systems. Agricultural and Forest Meteorology 62, 219–240

[3] J. Mardaljevic. Daylight Simulation: Validation, Sky Models and Daylight Coefficients. PhD thesis, De Montfort University,

Leicester, UK, 2000. p193,eq. 5-10

[4] R. Perez, R. Seals, J. Michalsky, “All-weather model for sky luminance distribution—Preliminary configuration and

validation”, Solar Energy, Volume 50, Issue 3, 1993, Pages 235-245

openalea.astk.sky_sources.sky_turtle(sectors=46)[source]#
openalea.astk.sky_sources.source_hi(src_ni)[source]#
openalea.astk.sky_sources.source_ni(src_hi)[source]#

openalea.astk.sky_map module#

Creation, aggregation and plotting of sky maps

openalea.astk.sky_map.cell_boundaries(grid)[source]#

Azimuth and zenith boundaries of cells of a grid

openalea.astk.sky_map.closest_dir(grid, new_directions)[source]#

Compute the index of the closest direction in new_directions for a sky-grid :param grid: a (az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid :param new_directions: a [(elevation, azimuth),..] list of tuples defining directions

openalea.astk.sky_map.closest_point(point_grid, point_list)[source]#

Compute the index of the closest point in point list for a grid of points

openalea.astk.sky_map.ksi_grid(grid, sun_zenith=0, sun_azimuth=0)[source]#

acute angle between vector pointing to sky cells and sun vector

openalea.astk.sky_map.scale_sky(grid, luminance, irradiance=1)[source]#

Rescale sky luminance to force producing a given sky irradiance

Parameters:
  • grid – a (az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid

  • luminance – unscaled relative luminance of cells covering sky vault

  • irradiance – global horizontal sky irradiance

openalea.astk.sky_map.show_sky(grid, sky, cmap='jet', shading='flat')[source]#

Display sky luminance polar image

Parameters:
  • grid – a (azimuth, zenith, az_c, z_c) tuple, such as returned by sky_grid

  • sky – a 2-D array of values to be plotted on the grid

openalea.astk.sky_map.sky_grid(d_az=1, d_z=1, n_az=None, n_z=None)[source]#

Sky grid creation

Parameters:
  • d_az – delta azimuth of grid cells

  • d_z – delta zenith of grid cells

  • n_az – number of cells in azimutal directions

  • n_z – number of cells in zenital directions

Returns:

coordinate matrix of azimuth of grid cells center z_c: coordinate matrix of zenith of grid cells center sr_c: coordinate matrix of sky vault steradians covered by grid cells

Return type:

az_c

openalea.astk.sky_map.sky_hi(grid, luminance)[source]#

Horizontal irradiance of sky cells

Parameters:
  • grid – a (az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid

  • luminance – sky luminance gridded array describing distribution of luminance over the sky hemisphere

openalea.astk.sky_map.sky_lum(grid, ni)[source]#
openalea.astk.sky_map.sky_map(grid, luminance, new_directions, closest_dirs=None, force_hi=False)[source]#

Aggregate luminance for a given new set of directions

Parameters:
  • grid – a (az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid

  • luminance – sky luminance gridded array describing distribution of luminance over the sky hemisphere

  • new_directions – a [(elevation, azimuth),..] list of tuples defining directions of the aggregated sky

  • closest_dirs – (optional) the gridded-index of the closest direction in new_direction, such as returned by closest_dir. Allows saving time recomputing closest_dir in the case of multiple call to sky_map with same grid/new_directions. Default is None

  • force_hi – if True, aggregated luminance are rescaled to force conservation of global horizontal irradiance. If False (default), no rescaled is applied

Returns:

luminance aggregated along new directions grid_agg: a (azimuth, zenith, sr) tuple describing the aggregated directions and the associated steradians luminance_agg_sky: sky aggregated luminance projected on the original sky grid

Return type:

luminance_agg

openalea.astk.sky_map.sky_ni(grid, luminance)[source]#

Direct normal irradiance of sky cells

Parameters:
  • grid – a (az_c, z_c, sr_c) tuple of sky coordinates, such as returned by astk.sky_map.sky_grid

  • luminance – sky luminance gridded array describing distribution of luminance over the sky hemisphere

openalea.astk.sky_map.surfacic_irradiance(grid, luminance, zenith=0, azimuth=0)[source]#

Surfacic light flux traversing a bi-face surfaces whose normals are given by surface orientation

openalea.astk.sky_map.uniform_sky()[source]#

openalea.astk.TimeControl module#

Provides utilities for scheduling models in simulation

class openalea.astk.TimeControl.DegreeDayModel(Tbase=0)[source]#

Bases: object

Classical degreeday model equation

class openalea.astk.TimeControl.EvalValue(eval, value, dt)[source]#

Bases: object

class openalea.astk.TimeControl.IterWithDelays(values=[None], delays=[1])[source]#

Bases: object

class openalea.astk.TimeControl.IterWithDelaysNode[source]#

Bases: object

Iteration Node

eval()[source]#

Return True if the node need a reevaluation

class openalea.astk.TimeControl.TimeControl(delay=None, steps=None, model=None, weather=None, start_date=None)[source]#

Bases: object

class openalea.astk.TimeControl.TimeControlSet(**kwd)[source]#

Bases: object

check(attname, defaultvalue)[source]#

Check if an attribute exists. If not create it with default value

class openalea.astk.TimeControl.TimeControler(**kwd)[source]#

Bases: object

openalea.astk.TimeControl.date_filter(time_sequence, time_data)[source]#

Return evaluation filter being True at date in time_data

  • time_data : a datetimle indexed panda dataframe

openalea.astk.TimeControl.date_filter_node(time_sequence, time_data)[source]#
openalea.astk.TimeControl.degree_day_model(Tbase=0)[source]#
openalea.astk.TimeControl.evaluation_sequence(delays)[source]#

retrieve evaluation filter from sequence of delays

openalea.astk.TimeControl.filter_and(filters)[source]#
openalea.astk.TimeControl.filter_or(filters)[source]#
openalea.astk.TimeControl.grow_canopy(g, plant_model, time_control)[source]#
openalea.astk.TimeControl.new_canopy(plant_model, age=0)[source]#
openalea.astk.TimeControl.plot_canopy(g, plant_model)[source]#
openalea.astk.TimeControl.rain_filter(time_sequence, weather, rain_min=0.2)[source]#

return an evaluation filter iterating every rain event and every between-rain event

Parameters:

  • weather (weather instance)

    weather database (should contain rain column)

openalea.astk.TimeControl.rain_filter_node(time_sequence, weather)[source]#
openalea.astk.TimeControl.simple_delay_timing(delay=1, steps=1)[source]#
openalea.astk.TimeControl.thermal_time(time_sequence, weather_data, model=<openalea.astk.TimeControl.DegreeDayModel object>)[source]#
openalea.astk.TimeControl.thermal_time_filter(time_sequence, weather, model=<openalea.astk.TimeControl.DegreeDayModel object>, delay=10)[source]#

return an evaluation filter being True at regular thermal time period

Parameters:

  • weather (openalea.astk.Weather instance)

    A Weather database

  • model a model returning Thermal Time accumulation as a function of time_sequence and weather

  • delay (int)

    The duration of each period

openalea.astk.TimeControl.thermal_time_filter_node(time_sequence, weather, model, delay)[source]#
openalea.astk.TimeControl.time_control(time_sequence, eval_filter, data=None)[source]#

Produces controls for multi-delay or weather dependant models return splited weather data (if given) and delays

Parameters:

  • eval_filter a list (same length as time_sequence) of bools indicating the steps at which an evaluation is needed

  • data (panda dataframe indexed by date)

    data for the model

openalea.astk.TimeControl.time_filter(time_sequence, delay=1)[source]#

return an evaluation filter being True at regular period

Parameters:

  • delay (int)

    The duration of each period

openalea.astk.TimeControl.time_filter_node(time_sequence, delay=1)[source]#

openalea.astk.Weather module#

Created on Wed Apr 24 14:29:15 2013

@author: lepse

openalea.astk.Weather.PPFD_to_global(data)[source]#

Convert the PAR (ppfd in micromol.m-2.sec-1) in global radiation (J.m-2.s-1, ie W/m2) 1 WattsPAR.m-2 = 4.6 ppfd, 1 Wglobal = 0.48 WattsPAR)

openalea.astk.Weather.Psat(T)[source]#

Saturating water vapor pressure (kPa) at temperature T (Celcius) with Tetens formula

class openalea.astk.Weather.Weather(data=None, wind_screen=2, temperature_screen=2, localisation={'city': 'Montpellier', 'latitude': 43.61, 'longitude': 3.87}, timezone='UTC')[source]#

Bases: object

Class compliying echap local_microclimate model protocol (meteo_reader). expected variables of the data_file are: - ‘An’ - ‘Jour’ - ‘hhmm’ : hour and minutes (universal time, UTC) - ‘PAR’ : Quantum PAR (ppfd) in micromol.m-2.sec-1 - ‘Pluie’ : Precipitation (mm) - ‘Tair’ : Temperature of air (Celcius) - ‘HR’: Humidity of air (%) - ‘Vent’ : Wind speed (m.s-1) - localisation is a {‘name’:city, ‘lontitude’:lont, ‘latitude’:lat} dict - timezone indicates the standard timezone name (see pytz infos) to be used for interpreting the date (default ‘UTC’)

check(varnames=[], models={}, args={})[source]#

Check if varnames are in data and try to create them if absent using defaults models or models provided in arg. Return a bool list with True if the variable is present or has been succesfully created, False otherwise.

Parameters:

  • varnames : a list of name of variable to check

  • models a dict (name: model) of models to use to generate the data. models receive data as argument

date_range_index(start, end=None, by=24)[source]#

return a (list of) time sequence that allow indexing one or several time intervals between start and end every ‘by’ hours if end is None, only one time interval of ‘by’ hours is returned

start and end are expected in local time

daylength(seq)[source]#
get_variable(what, time_sequence)[source]#

return values of what at date specified in time sequence

get_weather(time_sequence)[source]#

Return weather data for a given time sequence

get_weather_start(time_sequence)[source]#

Return weather data at start of timesequence

light_sources(seq, what='global_radiation')[source]#

return direct and diffuse ligh sources representing the sky and the sun for a given time period indicated by seq Irradiance are accumulated over the whole time period and multiplied by the duration of the period (second) and by scale

split_weather(time_step, t_deb, n_steps)[source]#

return a list of sub-part of the meteo data, each corresponding to one time-step

sun_path(seq)[source]#

Return position of the sun corresponing to a sequence of date

openalea.astk.Weather.climate_todict(x)[source]#
openalea.astk.Weather.date_range_node(start, end, periods, freq, tz, normalize, name)[source]#
openalea.astk.Weather.global_to_PPFD(data)[source]#

Convert the global radiation (J.m-2.s-1, ie W/m2) in PAR (ppfd in micromol.m-2.sec-1) 1 WattsPAR.m-2 = 4.6 ppfd, 1 Wglobal = 0.48 WattsPAR)

openalea.astk.Weather.humidity_to_vapor_pressure(data)[source]#

Convert the relative humidity (%) in water vapor pressure (kPa)

openalea.astk.Weather.linear_degree_days(data, start_date=None, base_temp=0.0, max_temp=35.0)[source]#
openalea.astk.Weather.sample_weather(periods=24)[source]#

provides a sample weather instance for testing other modules

openalea.astk.Weather.sample_weather_with_rain()[source]#
openalea.astk.Weather.weather_check_node(weather, vars, models)[source]#
openalea.astk.Weather.weather_data_node(weather)[source]#
openalea.astk.Weather.weather_node(weather_path)[source]#
openalea.astk.Weather.weather_start_node(timesequence, weather)[source]#