TimeControl.py 文件源码

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

项目:astk 作者: openalea-incubator 项目源码 文件源码
def __call__(self, time_sequence, weather_data):
        """ Compute thermal time accumulation over time_sequence

        :Parameters:
        ----------
        - `time_sequence` (panda dateTime index)
            A sequence of TimeStamps indicating the dates of all elementary time steps of the simulation
        - weather (alinea.astk.Weather instance)
            A Weather database

        """    
        try:
            Tair = weather_data.temperature_air[time_sequence]
        except:
            #strange extract needed on visualea 1.0 (to test again with ipython in visualea)
            T_data = weather_data[['temperature_air']]
            Tair = numpy.array([float(T_data.loc[d]) for d in time_sequence])
        Tcut = numpy.maximum(numpy.zeros_like(Tair), Tair - self.Tbase)
        days = [0] + [((t - time_sequence[0]).total_seconds()+ 3600) / 3600 / 24 for t in time_sequence]
        dt = numpy.diff(days).tolist()
        return numpy.cumsum(Tcut * dt)

# functional call for nodes
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号