pvlib.solarposition.calc_time#
- pvlib.solarposition.calc_time(lower_bound, upper_bound, latitude, longitude, attribute, value, altitude=0, pressure=101325, temperature=12, horizon='+0:00', xtol=1e-12)[source]#
Calculate the time between lower_bound and upper_bound where the attribute is equal to value. Uses PyEphem for solar position calculations.
- Parameters
lower_bound (
datetime.datetime) –upper_bound (
datetime.datetime) –latitude (
float) – Latitude in decimal degrees. Positive north of equator, negative to south.longitude (
float) – Longitude in decimal degrees. Positive east of prime meridian, negative to west.attribute (
str) – The attribute of a pyephem.Sun object that you want to solve for. Likely options are ‘alt’ and ‘az’ (which must be given in radians).value (
intorfloat) – The value of the attribute to solve foraltitude (
float, default0) – Distance above sea level.pressure (
intorfloat, optional, default101325) – Air pressure in Pascals. Set to 0 for no atmospheric correction.temperature (
intorfloat, optional, default12) – Air temperature in degrees C.horizon (
string, optional, default'+0:00') – arc degrees:arc minutes from geometrical horizon for sunrise and sunset, e.g., horizon=’+0:00’ to use sun center crossing the geometrical horizon to define sunrise and sunset, horizon=’-0:34’ for when the sun’s upper edge crosses the geometrical horizonxtol (
float, optional, default1.0e-12) – The allowed error in the result from value
- Returns
- Raises
ValueError – If the value is not contained between the bounds.
AttributeError – If the given attribute is not an attribute of a PyEphem.Sun object.