sun.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:my-weather-indicator 作者: atareao 项目源码 文件源码
def equation_of_time(self, year, month, day, latitude):
        """
        Description: Subroutine computing the part of the equation of time
                     needed in the computing of the theoritical solar flux
                     Correction originating of the CMC GEM model.

        Parameters:  int nTime : cTime for the correction of the time.

        Returns: tuple (double fEot, double fR0r, tuple tDeclsc)
                 dEot: Correction for the equation of time
                 dR0r: Corrected solar constant for the equation of time
                 tDeclsc: Declinaison
        """
        # Julian date
        nJulianDate = self.Julian(year, month, day)
        # Check if it is a leap year
        if(calendar.isleap(year)):
            fDivide = 366.0
        else:
            fDivide = 365.0
        # Correction for "equation of time"
        fA = nJulianDate / fDivide * 2 * pi
        fR0r = self.__Solcons(fA) * 0.1367e4
        fRdecl = 0.412 * math.cos((nJulianDate + 10.0) * 2.0 * pi / fDivide - pi)
        fDeclsc1 = self.sind(latitude) * math.sin(fRdecl)
        fDeclsc2 = self.cosd(latitude) * math.cos(fRdecl)
        tDeclsc = (fDeclsc1, fDeclsc2)
        # in minutes
        fEot = 0.002733 - 7.343 * math.sin(fA) + .5519 * math.cos(fA) \
            - 9.47 * math.sin(2.0 * fA) - 3.02 * math.cos(2.0 * fA) \
            - 0.3289 * math.sin(3. * fA) - 0.07581 * math.cos(3.0 * fA) \
            - 0.1935 * math.sin(4.0 * fA) - 0.1245 * math.cos(4.0 * fA)
        # Express in fraction of hour
        fEot = fEot / 60.0
        # Express in radians
        fEot = fEot * 15 * pi / 180.0

        return (fEot, fR0r, tDeclsc)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号