projection.py 文件源码

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

项目:wrf-python 作者: NCAR 项目源码 文件源码
def _context_equal(x, y, ctx):
        """Return True if both objects are equal based on the provided context.

        Args:

            x (numeric): A numeric value.

            y (numeric): A numeric value.

            ctx (:class:`decimal.Context`): A decimal Context object.

        Returns:

            :obj:`bool`: True if the values are equal based on the provided 
            context, False otherwise.

        """
        if x is not None:
            if y is None:
                return False

            # Note:  The float conversion is because these may come in as 
            # numpy.float32 or numpy.float64, which Decimal does not know
            # how to handle.
            if (Decimal(float(x)).normalize(ctx) != 
                Decimal(float(y)).normalize(ctx)):
                return False
        else:
            if y is not None:
                return False

        return True
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号