Coverage for /opt/obspy/update-docs/src/obspy/obspy/gse2/libgse1 : 97%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python #------------------------------------------------------------------- # Filename: libgse1.py # Purpose: Python wrapper for reading GSE1 files # Author: Moritz Beyreuther # Email: moritz.beyreuther@geophysik.uni-muenchen.de # # Copyright (C) 2008-2012 Moritz Beyreuther #--------------------------------------------------------------------- Low-level module internally used for handling GSE1 files
:copyright: The ObsPy Development Team (devs@obspy.org) :license: GNU Lesser General Public License, Version 3 (http://www.gnu.org/copyleft/lesser.html) """
""" Read GSE1 file and return header and data.
Currently supports only CM6 compressed and plain integer GSE1 files, this should be sufficient for most cases. Data are in circular frequency counts, for correction of calper multiply by 2PI and calper: data * 2 * pi * header['calper'].
:type fh: File Pointer :param fh: Open file pointer of GSE1 file to read, opened in binary mode, e.g. fh = open('myfile','rb') :type verify_chksum: Bool :param verify_chksum: If True verify Checksum and raise Exception if not correct :rtype: Dictionary, Numpy.ndarray int32 :return: Header entries and data as numpy.ndarray of type int32. """ else: raise Exception("Unsupported data type %s in GSE1 file" % dtype) # test checksum only if enabled
""" Reads npts points of uncompressed integers from given file handler. """ # find next DAT1 section within file buf = fh.readline()
""" Reads GSE1 header from file pointer and returns it as dictionary.
The method searches for the next available WID1 field beginning from the current file position. """ # search for WID1 field # valid GSE1 header # fetch header # first line hour=hour, minute=minute, second=second, microsecond=millisec * 1000) # second line
if __name__ == '__main__': doctest.testmod(exclude_empty=True) |