rtma_source.py 文件源码

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

项目:wrfxpy 作者: openwfm 项目源码 文件源码
def _is_var_ready(self, cycle, var):
        """
        Checks if the variable var is ready for the given forecast hour by comparing its
        filetime to the timestamp given by the forecast hour.  If the filetime is newer
        (later) then the variable is ready.

        :param cycle: which cycle are we working with (UTC)
        :param var: the variable identifier
        :return: true if the variable is ready
        """
        # find last-modified time of file in UTC timezone
        url = self._remote_var_url(cycle.hour, var)
        r = requests.head(url)
        if r.status_code != 200:
            raise ValueError('Cannot find variable %s for hour %d at url %s' % (var, cycle.hour, url))
        last_modif = self._parse_header_timestamp(r.headers['Last-Modified'])

        return last_modif > cycle
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号