[Python-modules-commits] [python-pysolar] 02/11: Added code contributed by Simeon Obinna Nwaogaidu and Holger Zebner of Lahmeyer International. Added contributors file.

Wolfgang Borgert debacle at moszumanska.debian.org
Fri Oct 3 23:36:16 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to annotated tag 0.4.0
in repository python-pysolar.

commit 8903b9a8edfda60b7a97cdb237fa58fe710b17b6
Author: Brandon Stafford <brandon at pingswept.org>
Date:   Tue Feb 24 22:05:09 2009 -0500

    Added code contributed by Simeon Obinna Nwaogaidu and Holger Zebner of
    Lahmeyer International. Added contributors file.
---
 CONTRIBUTORS.markdown |   8 +
 util.py               | 757 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 765 insertions(+)

diff --git a/CONTRIBUTORS.markdown b/CONTRIBUTORS.markdown
new file mode 100644
index 0000000..85f4942
--- /dev/null
+++ b/CONTRIBUTORS.markdown
@@ -0,0 +1,8 @@
+Contributions
+-------------
+
+Many people have contributed to Pysolar since its inception.
+
+Thanks to Holger Zebner, Pietro Zambelli, Sean Taylor, Simeon Obinna 
+Nwaogaidu, Timmie Chelsen, and Lahmeyer International for their 
+contributions of code, bugfixes, documentation, and general encouragement.
diff --git a/util.py b/util.py
new file mode 100644
index 0000000..17edaeb
--- /dev/null
+++ b/util.py
@@ -0,0 +1,757 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+#    Library for calculating location of the sun
+
+#    Copyright 2009 Brandon Stafford
+#
+#    This file is part of Pysolar.
+#
+#    Pysolar is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation; either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    Pysolar is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License along
+#    with Pysolar. If not, see <http://www.gnu.org/licenses/>.
+
+"""This module forms the basics for solar tool calculations. 
+
+:Author: Simeon Nwaogaidu
+:contact: SimeonObinna.Nwaogaidu at lahmeyer.de
+
+:Co author: Holger Zebner
+:contact: holger.zebner at lahmeyer.de
+
+"""
+#Importing necessary modules
+import pytz
+import math
+import pysolar
+from pytz import all_timezones
+from pysolar import radiation
+from pysolar import solar
+import datetime
+import decimaldegrees.decimaldegrees as dg
+import os
+import sys
+import calendar
+
+import conversions_time as ct
+#import conversions_time 
+## some default constants
+AM_default = 2.0             #Air Mass of 2.0 will used
+TL_default = 1.0             #Linke Turbidity factor of 1.0 will be used 
+SC_default = 1367            #Solar constant in W/m^2, not that this value could vary by +/- 4 W/m2 
+TY_default = 365             #Total Year number from 1 to 365 days)
+elevation_default = 0        # Elevation 
+#timezone = 2.0       # timezone of the country
+######## Useful Equations for the analysis
+
+def date_with_decimal_hour(datetime, hour_decimal):    
+    """This convers dates with decimal hour to datetime_hour.
+    An improved version :mod:`conversions_time`
+    
+    Parameters
+    ----------
+    datetime : datetime.datetime
+        A datetime object is a single object containing all the information from a 
+        date object and a time object.              
+    hour_decimal : datetime.datetime
+        An hour is a unit of time 60 minutes, or 3,600 seconds in length.
+    
+    Returns
+    -------.
+    datetime_hour : datetime.datetime
+        datetime_hour
+    
+    """
+    hour_dms = dg.decimal2dms(hour_decimal)
+    
+    datetime_hour = dt.datetime(datetime.year, 
+                                date_utc.month, date_utc.day, hour_dms[0], hour_dms[1],int(hour_dms[2]))
+
+    return datetime_hour
+
+## The new Sunrise and Sunset times from shadowrings 
+def GetSunriseSunset(latitude_deg, longitude_deg, utc_datetime, timezone):
+    """This function calculates the astronomical Sunrise and Sunset times in *local time*.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting 
+        the north/south angular location of a place on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location 
+        in an east-west direction,relative to the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )        
+    timezone : float
+        timezone as numerical value: GMT offset in hours. A time zone is a region of 
+        the earth that has uniform standard time, usually referred to as the local time.
+               
+    Returns
+    -------
+    sunrise_time_dt : datetime.datetime
+        Sunrise time in local time as datetime_obj.
+    sunset_time_dt : datetime.datetime
+        Sunset time in local time as datetime_obj.
+            
+    References
+    ----------
+    .. [1] http://www.skypowerinternational.com/pdf/Radiation/7.1415.01.121_cm121_bed-anleitung_engl.pdf
+    .. [2] http://pysolar.org/
+        
+    Examples
+    --------
+    >>> gmt_offset = 1
+    >>> lat = 50.111512
+    >>> lon = 8.680506
+    >>> timezone_local = 'Europe/Berlin'
+    >>> utct = dt.datetime.utcnow()
+    >>> sr, ss = sb.GetSunriseSunset(lat, lon, utct, gmt_offset)
+    >>> print 'sunrise: ', sr
+    >>> print 'sunset:', ss
+   
+    """    
+#    timezone = timezone_default   
+    #Day of the year
+    day = solar.GetDayOfYear(utc_datetime)
+    #print 'day', day  
+    # Solar Hour Angle
+    SHA = ((timezone)* 15.0 - longitude_deg)
+    #print 'SHA', SHA    
+    ## Time adjustment
+    #time_adst angle
+    TT = (279.134+0.985647*day)*math.pi/180
+    # Time adjustment in Hours
+    time_adst = ((5.0323 - 100.976*math.sin(TT)+595.275*math.sin(2*TT)+
+                  3.6858*math.sin(3*TT) - 12.47*math.sin(4*TT) - 430.847*math.cos(TT)+
+                  12.5024*math.cos(2*TT) + 18.25*math.cos(3*TT))/3600)
+    #print 'time_adst', time_adst    
+    # Time of Noon
+    TON = (12 + (SHA/15.0) - time_adst)
+    #print 'TON', TON    
+    # represent variable sunn
+    sunn = (math.pi/2-(23.45*math.pi/180)*math.tan(latitude_deg*math.pi/180)*
+            math.cos(2*math.pi*day/365.25))*(180/(math.pi*15))
+    #print 'sunn', sunn    
+    #sunrise_time in Hours
+    sunrise_time = (TON - sunn + time_adst)
+    #print 'sunrise_time', sunrise_time    
+    #sunset_time in Hours
+    sunset_time = (TON + sunn - time_adst) 
+    #print 'sunset_time', sunset_time    
+    sunrise_time_dms = dg.decimal2dms(sunrise_time)
+    #print 'sunrise_time_dms', sunrise_time_dms    
+    sunset_time_dms = dg.decimal2dms(sunset_time)
+    #print 'sunset_time_dms', sunset_time_dms    
+    
+    sunrise_time_dt = ct.hour_decimal2datetime(utc_datetime, sunrise_time)
+    
+    sunset_time_dt = ct.hour_decimal2datetime(utc_datetime, sunset_time)    
+#    return sunrise_time_dms, sunset_time_dms
+    return sunrise_time_dt, sunset_time_dt
+
+
+
+
+def GetSunriseTime(latitude_deg, longitude_deg, utc_datetime, timezone):
+    """This function uses uses the :func:`GetSunriseSunset` function to calculates the astronomical 
+    Sunrise times
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location 
+        of a place on a sphere.
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,
+        relative to the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )        
+    timezone : float
+        timezone as numerical value: GMT offset in hours. A time zone is a region of 
+        the earth that has uniform standard time, usually referred to as the local time.
+           
+    Returns
+    -------
+    sr : datetime.datetime
+        Sunrise time
+    
+    References
+    ----------
+    .. [1] http://www.skypowerinternational.com/pdf/Radiation/7.1415.01.121_cm121_bed-anleitung_engl.pdf
+    .. [2] http://pysolar.org/
+            
+    """ 
+    sr, ss = GetSunriseSunset(latitude_deg, longitude_deg, utc_datetime, timezone)
+    
+    return sr
+
+def GetSunsetTime(latitude_deg, longitude_deg, utc_datetime, timezone):
+    """This function uses uses the GetSunriseSunset function to calculates the astronomical 
+    Sunset times
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting 
+        the north/south angular location of a place on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location 
+        in an east-west direction,relative to the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )         
+    timezone : float
+        timezone as numerical value: GMT offset in hours. A time zone is a region of the earth 
+        that has uniform standard time, usually referred to as the local time.
+           
+    Returns
+    -------
+    ss : datetime.datetime
+        Sunset time
+           
+    References
+    ----------
+    .. [1] http://www.skypowerinternational.com/pdf/Radiation/7.1415.01.121_cm121_bed-anleitung_engl.pdf
+    .. [2] http://pysolar.org/
+        
+    """ 
+    sr, ss = GetSunriseSunset(latitude_deg, longitude_deg, utc_datetime, timezone)    
+    return ss
+
+def mean_earth_sun_distance(utc_datetime):
+    """Mean Earth-Sun distance is the arithmetical mean of the maximum and minimum distances
+    between a planet (Earth) and the object about which it revolves (Sun). However, 
+    the function is used to  calculate the Mean earth sun distance.
+    
+    Parameters
+    ----------
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 ) 
+                         
+    Returns
+    -------
+    KD : float
+        Mean earth sun distance
+    
+    References
+    ----------
+    .. [1] http://sunbird.jrc.it/pvgis/solres/solmod3.htm#clear-sky%20radiation
+    .. [2] R. aguiar and et al, "The ESRA user guidebook, vol. 2. database", models and exploitation software-Solar 
+            radiation models, p.113
+    """   
+    KD = (1 -(0.0335*math.sin(360*((solar.GetDayOfYear(utc_datetime)) - 94))/(365)))
+         
+    return KD
+
+def extraterrestrial_irrad(utc_datetime, latitude_deg, longitude_deg,SC=SC_default):
+    """Equation calculates Extratrestrial radiation. Solar radiation incident outside the earth's
+    atmosphere is called extraterrestrial radiation. On average the extraterrestrial irradiance
+    is 1367 Watts/meter2 (W/m2). This value varies by + or - 3 percent as the earth orbits the sun. 
+    The earth's closest approach to the sun occurs around January 4th and it is furthest
+    from the sun around July 5th.
+    
+    Parameters
+    ----------
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )                   
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location 
+        of a place on a sphere.    
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative
+        to the Greenwich meridian.    
+    SC : float
+        The solar constant is the amount of incoming solar electromagnetic radiation per unit area, measured 
+        on the outer surface of Earth's atmosphere in a plane perpendicular to the rays.It is measured by 
+        satellite to be roughly 1366 watts per square meter (W/m^2)
+    
+    Returns
+    -------
+    EXTR1 : float
+        Extraterrestrial irradiation
+    
+    References
+    ----------
+    .. [1] http://solardat.uoregon.edu/SolarRadiationBasics.html
+    .. [2] Dr. J. Schumacher and et al,"INSEL LE(Integrated Simulation Environment Language)Block reference",p.68
+        
+    """
+    day = solar.GetDayOfYear(utc_datetime)
+    ab = math.cos(2*math.pi*(solar.GetDayOfYear(utc_datetime)- 1.0)/(365))
+    bc = math.sin(2*math.pi*(solar.GetDayOfYear(utc_datetime)- 1.0)/(365.0))
+    cd = math.cos(2*(2*math.pi*(solar.GetDayOfYear(utc_datetime)- 1.0)/(365.0)))
+    df = math.sin(2*(2*math.pi*(solar.GetDayOfYear(utc_datetime)- 1.0)/(365.0)))
+    decl = solar.GetDeclination(day)
+    ha = solar.GetHourAngle(utc_datetime, longitude_deg)
+    ZA = math.sin(latitude_deg)*math.sin(decl) + math.cos(latitude_deg)*math.cos(decl)*math.cos(ha)
+    
+    EXTR1 = (SC*(1.00010 + 0.034221*(ab) + 0.001280*(bc) + 0.000719*(cd) + 0.000077*(df))*(ZA))
+    
+    return EXTR1
+
+
+def declination_degree(utc_datetime, TY = TY_default ):
+    """The declination of the sun is the angle between Earth's equatorial plane and a line 
+    between the Earth and the sun. It varies between 23.45 degrees and -23.45 degrees,
+    hitting zero on the equinoxes and peaking on the solstices.
+    
+    Parameters
+    ----------
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )        
+    TY : float
+        Total number of days in a year. eg. 365 days per year,(no leap days)
+    
+    Returns
+    -------
+    DEC : float
+        The declination of the Sun 
+    
+    References
+    ----------
+    .. [1] http://pysolar.org/
+             
+    """    
+    DEC = 23.45 * math.sin((2*math.pi / (TY))*((solar.GetDayOfYear(utc_datetime)) - 81))
+    
+    return DEC
+
+
+def solarelevation_function_clear(latitude_deg, longitude_deg, utc_datetime,temperature_celsius = 25,
+                                  pressure_millibars = 1013.25,  elevation = elevation_default):
+    """Equation calculates Solar elevation function for clear sky type.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting 
+        the north/south angular location of a place on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location 
+        in an east-west direction,relative to the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )         
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and cold.    
+    pressure_millibars : float
+        pressure_millibars    
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the mean
+        sea level.
+    
+    Returns
+    -------
+    SOLALTC : float
+        Solar elevation function clear sky 
+        
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status 
+            and proposed new approaches", energy 30 (2005), pp 1533 - 1549.
+    
+    """        
+    SOLALTC=(0.038175+(1.5458*(
+                               math.sin(solar.GetAltitude(
+                                                          latitude_deg,
+                                                          longitude_deg,utc_datetime,
+                                                          elevation,temperature_celsius,
+                                                          pressure_millibars)))
+    )+((-0.59980)*(0.5*(1 - math.cos(2*(
+                                        solar.GetAltitude(
+                                                          latitude_deg,longitude_deg, utc_datetime,
+                                                          elevation, temperature_celsius,
+                                                          pressure_millibars)))))))
+    
+    return SOLALTC
+
+
+def solarelevation_function_overcast(latitude_deg, longitude_deg, utc_datetime,
+                                     elevation = elevation_default, temperature_celsius = 25,
+                                     pressure_millibars = 1013.25):
+    """ The function calculates solar elevation function for overcast sky type. 
+    This associated hourly overcast radiation model is based on the estimation of the 
+    overcast sky transmittance with the sun directly overhead combined with the application 
+    of an over sky elavation function to estimate the overcast day global irradiation 
+    value at any solar elevation.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a place on a 
+        sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to the 
+        Greenwich meridian.        
+    utc_datetime : date_object 
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 ) 
+    elevation : float 
+        The elevation of a geographic location is its height above a fixed reference point, often the mean sea level.        
+    temperature_celsius : float 
+        Temperature is a physical property of a system that underlies the common notions of hot and cold.    
+    pressure_millibars : float
+        pressure_millibars  
+                               
+    Returns
+    -------
+    SOLALTO : float
+        Solar elevation function overcast
+    
+    References
+    ----------
+    .. [1] Prof. Peter Tregenza,"Solar radiation and daylight models", p.89.
+    
+    .. [2] Also accessible through Google Books: http://tinyurl.com/5kdbwu
+        Tariq Muneer, "Solar Radiation and Daylight Models, Second Edition: For the Energy Efficient 
+        Design of Buildings"  
+            
+    """    
+    SOLALTO=((-0.0067133)+(0.78600*(math.sin(solar.GetAltitude(latitude_deg,longitude_deg,utc_datetime,
+                                                               elevation,temperature_celsius,
+                                                               pressure_millibars)))
+    )+((0.22401)*(0.5*(1 - math.cos(2*(solar.GetAltitude(latitude_deg,
+                                                         longitude_deg,utc_datetime,elevation,
+                                                         temperature_celsius,pressure_millibars)))))))
+    
+    return SOLALTO
+
+
+def diffuse_transmittance(TL = TL_default):
+    """Equation calculates the Diffuse_transmittance and the is the Theoretical Diffuse Irradiance on a horizontal 
+    surface when the sun is at the zenith.
+    
+    Parameters
+    ----------
+    TL : float
+        Linke turbidity factor 
+        
+    Returns
+    -------
+    DT : float
+        diffuse_transmittance
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+    
+    """
+    DT = ((-21.657) + (41.752*(TL)) + (0.51905*(TL)*(TL)))
+    
+    return DT
+
+def diffuse_underclear(latitude_deg, longitude_deg, utc_datetime, elevation = elevation_default, 
+                       temperature_celsius = 25, pressure_millibars = 1013.25, TL=TL_default):    
+    """Equation calculates the Diffuse under the clear sky conditions.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a place on 
+        a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to the 
+        Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the mean sea level.         
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and cold.    
+    pressure_millibars : float
+        pressure_millibars
+    TL : float
+        Linke turbidity factor     
+    
+    Returns
+    -------
+    DIFFC : float
+        Diffuse Irradiation under clear sky
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+    
+    """    
+    DT = ((-21.657) + (41.752*(TL)) + (0.51905*(TL)*(TL)))
+        
+    DIFFC = ((mean_earth_sun_distance(utc_datetime)
+              )*(DT)*(solar.GetAltitude(latitude_deg,longitude_deg, utc_datetime, elevation,
+                                        temperature_celsius , pressure_millibars )))
+    
+    return DIFFC
+
+def diffuse_underovercast(latitude_deg, longitude_deg, utc_datetime, elevation = elevation_default,
+                          temperature_celsius = 25, pressure_millibars = 1013.25,TL=TL_default):    
+    """Function calculates the diffuse under the overcast conditions.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a place on a 
+        sphere.            
+    longitude_deg : float 
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to the 
+        Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the mean sea level.         
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and cold.    
+    pressure_millibars : float
+        pressure_millibars
+    TL : float
+        Linke turbidity factor       
+    
+    Returns
+    -------
+    DIFOC : float
+        Diffuse Irradiation under overcast
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+    
+    """    
+    DT = ((-21.657) + (41.752*(TL)) + (0.51905*(TL)*(TL)))
+        
+    DIFOC = ((mean_earth_sun_distance(utc_datetime)
+              )*(DT)*(solar.GetAltitude(latitude_deg,longitude_deg, utc_datetime, elevation, 
+                                        temperature_celsius, pressure_millibars)))    
+    return DIFOC
+
+def direct_underclear(latitude_deg, longitude_deg, utc_datetime, 
+                      temperature_celsius = 25, pressure_millibars = 1013.25, TY = TY_default, 
+                      AM = AM_default, TL = TL_default,elevation = elevation_default):    
+    """Equation calculates the Direct(Beam) under the clear sky conditions.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a 
+        place on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to the 
+        Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )           
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and cold.    
+    pressure_millibars : float
+        pressure_millibars
+    TY : float
+        Total number of days in a year. eg. 365 days per year,(no leap days)
+    AM : float
+        Air mass. An Air Mass is a measure of how far light travels through the Earth's atmosphere. One air mass,
+        or AM1, is the thickness of the Earth's atmosphere. Air mass zero (AM0) describes solar irradiance in space,
+        where it is unaffected by the atmosphere. The power density of AM1 light is about 1,000 :math:`W/m^2`
+    TL : float
+        Linke turbidity factor 
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the mean 
+        sea level.        
+    
+    Returns
+    -------
+    DIRC : float
+        Direct Irradiation under clear
+        
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+           new approaches", energy 30 (2005), pp 1533 - 1549.
+    
+    """
+    KD = mean_earth_sun_distance(utc_datetime)
+    
+    DEC = declination_degree(utc_datetime,TY)
+    
+    DIRC = (1367*KD*math.exp(-0.8662*(AM)*(TL)*(DEC)
+                             )*math.sin(solar.GetAltitude(latitude_deg,longitude_deg, 
+                                                          utc_datetime,elevation , 
+                                                          temperature_celsius , pressure_millibars )))
+    
+    return DIRC
+
+def global_irradiance_clear(DIRC, DIFFC, latitude_deg, longitude_deg, utc_datetime, 
+                            temperature_celsius = 25, pressure_millibars = 1013.25, TY = TY_default, 
+                            AM = AM_default, TL = TL_default, elevation = elevation_default):
+    
+    """Equation calculates the Global Irradiance under the clear sky conditions.
+    
+    Parameters
+    ----------
+    DIRC : float
+        Direct Irradiation under clear        
+    DIFFC : float
+        Diffuse Irradiation under clear sky
+    
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a place
+        on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to 
+        the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and cold. 
+    pressure_millibars : float
+        pressure_millibars
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the 
+        mean sea level.
+    TY : float
+        Total number of days in a year. eg. 365 days per year,(no leap days)
+    AM : float
+        Air mass. An Air Mass is a measure of how far light travels through the Earth's atmosphere. One air mass, 
+        or AM1, is the thickness of the Earth's atmosphere. Air mass zero (AM0) describes solar irradiance in 
+        space, where it is unaffected by the atmosphere. The power density of AM1 light is about 1,000 W/m.
+        
+    TL : float
+        Linke turbidity factor 
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the mean sea 
+        level.     
+    
+    Returns
+    -------
+    ghic : float
+        Global Irradiation under clear sky
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+            
+    """
+    DIRC =  direct_underclear(latitude_deg, longitude_deg, utc_datetime, 
+                              TY, AM, TL, elevation, temperature_celsius = 25, 
+                              pressure_millibars = 1013.25)
+    
+    DIFFC = diffuse_underclear(latitude_deg, longitude_deg, utc_datetime, 
+                               elevation, temperature_celsius = 25, pressure_millibars= 1013.25)
+    
+    ghic = (DIRC + DIFFC)
+    
+    return ghic
+    
+
+def global_irradiance_overcast(latitude_deg, longitude_deg, utc_datetime, 
+                               elevation = elevation_default, temperature_celsius = 25, 
+                               pressure_millibars = 1013.25):
+    """Calculated Global is used to compare to the Diffuse under overcast conditions.
+    Under overcast skies, global and diffuse are expected to be equal due to the absence of the beam 
+    component.
+    
+    Parameters
+    ----------
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a 
+        place on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative 
+        to the Greenwich meridian.        
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )
+    elevation : float
+        The elevation of a geographic location is its height above a fixed reference point, often the 
+        mean sea level.         
+    temperature_celsius : float
+        Temperature is a physical property of a system that underlies the common notions of hot and 
+        cold.    
+    pressure_millibars : float
+        pressure_millibars    
+    
+    Returns
+    -------
+    ghioc : float
+        Global Irradiation under overcast sky
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al, "Quality
+            control of solar radiation data: present status
+            and proposed new approaches", energy 30
+            (2005), pp 1533 - 1549.
+
+    """    
+    ghioc = (572*(solar.GetAltitude(latitude_deg, longitude_deg, utc_datetime, 
+                                    elevation , temperature_celsius , pressure_millibars )))
+    
+    return ghioc
+    
+
+def diffuse_ratio(DIFF_data,ghi_data):
+    """Function calculates the Diffuse ratio.
+    
+    Parameters
+    ----------
+    DIFF_data : array_like
+        Diffuse horizontal irradiation data 
+    ghi_data : array_like
+        global horizontal irradiation data array    
+    
+    Returns
+    -------
+    K : float
+        diffuse_ratio
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+           
+    """    
+    #EXTR1 = extraterrestrial_irrad(utc_datetime, latitude_deg, longitude_deg, SC)    
+    K = DIFF_data/ghi_data
+    
+    return K 
+    
+
+def clear_index(ghi_data, utc_datetime, latitude_deg, longitude_deg):
+   
+    """This calculates the Clear index ratio.
+    
+    Parameters
+    ----------
+    ghi_data : array_like
+        global horizontal irradiation data array    
+    utc_datetime : date_object
+        utc_datetime. UTC DateTime is for Universal Time ( i.e. like a GMT+0 )        
+    latitude_deg : float
+        latitude in decimal degree. A geographical term denoting the north/south angular location of a place 
+        on a sphere.            
+    longitude_deg : float
+        longitude in decimal degree. Longitude shows your location in an east-west direction,relative to the 
+        Greenwich meridian.        
+        
+    Returns
+    -------
+    KT : float
+        Clear index ratio
+    
+    References
+    ----------
+    .. [1] S. Younes, R.Claywell and el al,"Quality control of solar radiation data: present status and proposed 
+            new approaches", energy 30 (2005), pp 1533 - 1549.
+            
+    """    
+    EXTR1 = extraterrestrial_irrad(utc_datetime, latitude_deg, longitude_deg)
+    
+    KT = (ghi_data/EXTR1)
+    
+    return KT
+  
+

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-pysolar.git



More information about the Python-modules-commits mailing list