obspy.sac.sacio.SacIO.GetHvalueFromFile

SacIO.GetHvalueFromFile(thePath, theItem)[source]

Quick access to a specific header item in specified file.

Parameters:
  • f filename (SAC binary)
  • hn (string) header variable name
>>> from obspy.sac import SacIO 
>>> t = SacIO() 
>>> t.GetHvalueFromFile('test.sac','kcmpnm').rstrip() 
'Q'

String header values have a fixed length of 8 or 16 characters. This can lead to errors for example if you concatenate strings and forget to strip off the trailing whitespace.

This Page