示例#1
0
文件: core.py 项目: Ciack404/obspy
def isGSE2(filename):
    """
    Checks whether a file is GSE2 or not.

    :type filename: string
    :param filename: GSE2 file to be checked.
    :rtype: bool
    :return: ``True`` if a GSE2 file.
    """
    # Open file.
    try:
        with open(filename) as f:
            libgse2.isGse2(f)
    except:
        return False
    return True
示例#2
0
文件: core.py 项目: shineusn/obspy
def isGSE2(filename):
    """
    Checks whether a file is GSE2 or not.

    :type filename: string
    :param filename: GSE2 file to be checked.
    :rtype: bool
    :return: ``True`` if a GSE2 file.
    """
    # Open file.
    try:
        with open(filename, 'rb') as f:
            libgse2.isGse2(f)
    except:
        return False
    return True
示例#3
0
 def test_isWidi2(self):
     """
     See if first 4 characters are WID2, if not raise type error.
     """
     f = open(os.path.join(self.path, 'loc_RNON20040609200559.z'), 'rb')
     pos = f.tell()
     self.assertEqual(None, libgse2.isGse2(f))
     self.assertEqual(pos, f.tell())
     f.seek(10)
     self.assertRaises(TypeError, libgse2.isGse2, f)
     self.assertEqual(10, f.tell())
示例#4
0
 def test_isWidi2(self):
     """
     See if first 4 characters are WID2, if not raise type error.
     """
     f = open(os.path.join(self.path, 'loc_RNON20040609200559.z'), 'rb')
     pos = f.tell()
     self.assertEqual(None, libgse2.isGse2(f))
     self.assertEqual(pos, f.tell())
     f.seek(10)
     self.assertRaises(TypeError, libgse2.isGse2, f)
     self.assertEqual(10, f.tell())