当前位置: 首页>>代码示例>>Python>>正文


Python Waves.deserialize方法代码示例

本文整理汇总了Python中gnome.environment.Waves.deserialize方法的典型用法代码示例。如果您正苦于以下问题:Python Waves.deserialize方法的具体用法?Python Waves.deserialize怎么用?Python Waves.deserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnome.environment.Waves的用法示例。


在下文中一共展示了Waves.deserialize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deserialize

# 需要导入模块: from gnome.environment import Waves [as 别名]
# 或者: from gnome.environment.Waves import deserialize [as 别名]
    def deserialize(cls, json_):
        """
        ChemicalDispersion could include 'waves'.
        """
        schema = cls._schema()
        _to_dict = schema.deserialize(json_)
        if "waves" in json_ and json_["waves"] is not None:
            _to_dict["waves"] = Waves.deserialize(json_["waves"])

        return _to_dict
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:12,代码来源:cleanup.py

示例2: test_serialize_deseriailize

# 需要导入模块: from gnome.environment import Waves [as 别名]
# 或者: from gnome.environment.Waves import deserialize [as 别名]
def test_serialize_deseriailize():
    'test serialize/deserialize for webapi'
    wind = constant_wind(1., 0)
    water = Water()
    w = Waves(wind, water)

    json_ = w.serialize()

    # deserialize and ensure the dict's are correct
    w2 = Waves.deserialize(json_)
    assert w2.wind == Wind.deserialize(json_['wind'])
    assert w2.water == Water.deserialize(json_['water'])
    assert w == w2
开发者ID:NOAA-ORR-ERD,项目名称:PyGnome,代码行数:15,代码来源:test_waves.py

示例3: test_serialize_deseriailize

# 需要导入模块: from gnome.environment import Waves [as 别名]
# 或者: from gnome.environment.Waves import deserialize [as 别名]
def test_serialize_deseriailize():
    "test serialize/deserialize for webapi"
    wind = constant_wind(1.0, 0)
    water = Water()
    w = Waves(wind, water)
    json_ = w.serialize()
    json_["wind"] = wind.serialize()
    json_["water"] = water.serialize()

    # deserialize and ensure the dict's are correct
    d_ = Waves.deserialize(json_)
    print "d_"
    print d_
    assert d_["wind"] == Wind.deserialize(json_["wind"])
    assert d_["water"] == Water.deserialize(json_["water"])
    d_["wind"] = wind
    d_["water"] = water
    w.update_from_dict(d_)
    assert w.wind is wind
    assert w.water is water
开发者ID:satcomlabs,项目名称:PyGnome,代码行数:22,代码来源:test_waves.py


注:本文中的gnome.environment.Waves.deserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。