當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。