model.py 文件源码

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

项目:smrt 作者: smrt-model 项目源码 文件源码
def __init__(self, emmodel, rtsolver, emmodel_kwargs=None, rtsolver_kwargs=None):
        """create a new model. It is not recommanded to instantiate Model class directly. Instead use the :py:meth:`make_model` function.
        """

        # emmodel can be a single value (class or string) or an array with the same size as snowpack layers array
        if isinstance(emmodel, collections.Sequence) and not isinstance(emmodel, six.string_types):
            self.emmodel = [get_emmodel(em) for em in emmodel]
        else:
            self.emmodel = get_emmodel(emmodel)

        if isinstance(rtsolver, six.string_types):
            self.rtsolver = import_class(rtsolver, root='smrt.rtsolver')
        else:
            self.rtsolver = rtsolver

        # The implementation avoid metaclass by supplying an optional list of arguments to the emmodel and rtsolver
        # to alter the behavior the emmodel (or rtsolver)
        # this is not the most general case, but metaclass can still be used for advanced user
        self.emmodel_kwargs = emmodel_kwargs if emmodel_kwargs is not None else dict()
        self.rtsolver_kwargs = rtsolver_kwargs if rtsolver_kwargs is not None else dict()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号