Ignore:
Timestamp:
02/02/2012 03:50:14 PM (11 years ago)
Author:
marcus
Message:
  • accept tailing comment within command line
  • access to trace info entries
File:
1 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/patches/ObsPy.py

    r469 r529  
    3131from obspy.core import Stream, Trace 
    3232from obspy.core.util import AttribDict 
    33 from SeismicHandler.basics.messages import logMessage 
     33from obspy.sh.core import fromUTCDateTime 
     34from SeismicHandler.basics.messages import logMessage, setStatus 
    3435 
    3536__all__ = [] 
     
    211212    self.shx = AttribDict() 
    212213 
     214def traceGetStatusInfo(self, name): 
     215    """ 
     216    Mapping of Seismic Handler trace information entries to ObsPy status info. 
     217    """ 
     218    name = name.lower() 
     219 
     220    # identical name 
     221    if name in self.stats: 
     222        return self.stats[name] 
     223 
     224    # mapping 
     225    if name == "length": 
     226        return self.stats.npts 
     227 
     228    if name == "chan1": 
     229        return self.stats.channel[0] 
     230 
     231    if name == "chan2": 
     232        return self.stats.channel[1] 
     233 
     234    if name == "comp": 
     235        return self.stats.channel[2] 
     236 
     237    if name == "start": 
     238        return fromUTCDateTime(self.stats.starttime) 
     239 
     240    # finally look into self defined entries 
     241    if name in self.shx: 
     242        return self.shx[name] 
     243 
     244    raise NameError 
     245 
    213246# monkey patching obspy stream class: traces are merge automatically if stream 
    214247# get's altered. 
     
    223256Trace.__shx_init__, Trace.__init__ = Trace.__init__, traceAddShxInit 
    224257Trace._shxPrepareImageData = tracePrepareDataForImage 
     258Trace._shxInfo = traceGetStatusInfo 
Note: See TracChangeset for help on using the changeset viewer.