當前位置: 首頁>>代碼示例>>Python>>正文


Python ShakeData.fetch_event方法代碼示例

本文整理匯總了Python中realtime.shake_data.ShakeData.fetch_event方法的典型用法代碼示例。如果您正苦於以下問題:Python ShakeData.fetch_event方法的具體用法?Python ShakeData.fetch_event怎麽用?Python ShakeData.fetch_event使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在realtime.shake_data.ShakeData的用法示例。


在下文中一共展示了ShakeData.fetch_event方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_remote_shake_map

# 需要導入模塊: from realtime.shake_data import ShakeData [as 別名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 別名]
    def test_get_remote_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once.
        """
        shake_data = ShakeData(SHAKE_ID)

        expected_input_file = os.path.join(
            shakemap_zip_dir(), SHAKE_ID + '.inp.zip')
        expected_output_file = os.path.join(
            shakemap_zip_dir(), SHAKE_ID + '.out.zip')

        if os.path.exists(expected_input_file):
            os.remove(expected_input_file)
        if os.path.exists(expected_output_file):
            os.remove(expected_output_file)

        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)

        self.assertTrue(os.path.exists(expected_input_file))
        self.assertTrue(os.path.exists(expected_output_file))
開發者ID:SamudraYe,項目名稱:inasafe,代碼行數:29,代碼來源:test_shake_data.py

示例2: test_get_latest_shake_map

# 需要導入模塊: from realtime.shake_data import ShakeData [as 別名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 別名]
 def test_get_latest_shake_map(self):
     """Check that we can retrieve the latest shake event."""
     # Simply dont set the event id in the ctor to get the latest
     shake_data = ShakeData()
     input_file, output_file = shake_data.fetch_event()
     event_id = shake_data.event_id
     expected_input_file = os.path.join(shakemap_zip_dir(),
                                        event_id + '.inp.zip')
     expected_output_file = os.path.join(shakemap_zip_dir(),
                                         event_id + '.out.zip')
     message = ('Expected path for downloaded shakemap INP not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(input_file, expected_input_file, message)
     message = ('Expected path for downloaded shakemap OUT not received'
                '\nExpected: %s\nGot: %s' %
                (expected_output_file, output_file))
     self.assertEqual(output_file, expected_output_file, message)
開發者ID:SamudraYe,項目名稱:inasafe,代碼行數:20,代碼來源:test_shake_data.py

示例3: test_get_cached_shake_map

# 需要導入模塊: from realtime.shake_data import ShakeData [as 別名]
# 或者: from realtime.shake_data.ShakeData import fetch_event [as 別名]
    def test_get_cached_shake_map(self):
        """Check that we can retrieve both input and output from ftp at once"""
        shake_event = '20120726022003'

        expected_input_file = os.path.join(shakemap_zip_dir(),
                                           shake_event + '.inp.zip')
        expected_output_file = os.path.join(shakemap_zip_dir(),
                                            shake_event + '.out.zip')
        shake_data = ShakeData(shake_event)
        input_file, output_file = shake_data.fetch_event()
        message = ('Expected path for downloaded shakemap INP not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(input_file, expected_input_file, message)
        message = ('Expected path for downloaded shakemap OUT not received'
                   '\nExpected: %s\nGot: %s' %
                   (expected_output_file, output_file))
        self.assertEqual(output_file, expected_output_file, message)
開發者ID:opengeogroep,項目名稱:inasafe,代碼行數:20,代碼來源:test_shake_data.py


注:本文中的realtime.shake_data.ShakeData.fetch_event方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。