Changeset 815 for SHX/trunk


Ignore:
Timestamp:
11/06/12 11:47:14 (8 years ago)
Author:
marcus
Message:
  • apply gain factor after loading mseed files
File:
1 edited

Legend:

Unmodified
Added
Removed
  • SHX/trunk/SeismicHandler/modules/traces.py

    r773 r815  
    1111from obspy.core.stream import Stream, Trace 
    1212from SeismicHandler.config import Settings 
    13 from SeismicHandler.basics.error import ShxError 
     13from SeismicHandler.modules.stations import Stations 
    1414 
    1515 
     
    5555 
    5656            if applyGain: 
    57                 # TODO get gain from inventory and apply it to data 
    58                 pass 
     57                # get gain from inventory and apply it to data 
     58                gain = None 
     59                try: 
     60                    gain = float(Stations()[t.id, t.stats.starttime].gain) 
     61                except KeyError: 
     62                    msg = "no meta data for station '%s' at %s" 
     63                    log_message("warning.meta", msg % ('1', '2')) 
     64 
     65                if gain is None: 
     66                    gain = 1. 
     67 
     68                t.data *= gain 
    5969 
    6070        self.traces.visible += stream 
Note: See TracChangeset for help on using the changeset viewer.