예제 #1
0
 def read_extended_header (self) :
     ret = {}
     buf = self.read_buf (60)
     
     e = segy_h.Seg (self.endianess)
     keys = segy_h.Seg ().__keys__
     if self.ext_hdr_type == 'U' :
         e = segy_h.Menlo (self.endianess)
         keys = segy_h.Menlo ().__keys__
     elif self.ext_hdr_type == 'S' :
         e = segy_h.Seg (self.endianess)
         keys = segy_h.Seg ().__keys__
     elif self.ext_hdr_type == 'P' :
         e = segy_h.Passcal (self.endianess)
         keys = segy_h.Passcal ().__keys__
     elif self.ext_hdr_type == 'I' :
         e = segy_h.Sioseis (self.endianess)
         keys = segy_h.Sioseis ().__keys__
     elif self.ext_hdr_type == 'N' :
         e = segy_h.iNova (self.endianess)
         keys = segy_h.iNova ().__keys__
     
     container = e.parse (buf)
     
     for k in keys :
         what = "container.{0}".format (k)
         ret[k] = eval (what)
         
     return ret
예제 #2
0
파일: dumpsgy.py 프로젝트: thecassion/PH5
def print_extended_header(container):
    if TYPE == 'U':
        keys = segy_h.Menlo().__keys__
    elif TYPE == 'S':
        keys = segy_h.Seg().__keys__
    elif TYPE == 'P':
        keys = segy_h.Passcal().__keys__
    elif TYPE == 'I':
        keys = segy_h.Sioseis().__keys__
    elif TYPE == 'N':
        keys = segy_h.iNova().__keys__
    else:
        return None

    tt = 180
    print "---------- Extended Header ----------"
    for k in keys:
        what = "container.{0}".format(k)

        try:
            if tt == 9999: raise
            s = SIZEOF[k] / 8
            if s < 1: raise
            foffset = "{0:<3} - {1:>3}".format(tt, tt + s - 1)
            tt += s
        except:
            tt = 9999
            foffset = "{0:<3} - {1:>3}".format('_', '_')

        print "{2} {0:<20}\t---\t{1}".format(k, eval(what), foffset)
예제 #3
0
    def set_ext_header_seg(self):
        '''   SEG-Y rev 01 extended header   '''
        ext = {}
        self.extended_header = segy_h.Seg()
        #   Same as lino from reel header
        try:
            ext['Inn'] = int(self.sort_t['array_name_s'])
        except (ValueError, TypeError):
            ext['Inn'] = 1
        #   Shot point number
        try:
            ext['Spn'] = int(self.event_t['id_s'])
        except ValueError:
            ext['Spn'] = 0
        #   Spn scaler
        ext['Scal'] = 1
        #   Trace value measurement units
        ext['Tvmu'] = 0
        #   Size of shot
        ext['Smsmant'] = int(self.event_t['size/value_d'])
        ext['Smsexp'] = 1
        ext['Smu'] = 0
        #   Number of samples
        ext['num_samps'] = self.length_points
        #   Sample interval in microseconds
        ext['samp_rate'] = int((1.0 / self.sample_rate) * 1000000.0)

        return ext
예제 #4
0
    def set_ext_header_seg(self):
        '''   SEG-Y rev 01 extended header   '''
        ext = {}
        self.extended_header = segy_h.Seg()
        # Same as lino from reel header
        try:
            ext['Inn'] = int(self.sort_t['array_name_s'])
        except (ValueError, TypeError):
            ext['Inn'] = 1

        try:
            # Shot point number
            ext['Spn'] = int(self.event_t['id_s'])
            # Size of shot
            ext['Smsmant'] = int(self.event_t['size/value_d'])
        except BaseException:
            pass

        # Spn scaler
        ext['Scal'] = 1
        # Trace value measurement units
        ext['Tvmu'] = 0
        ext['Smsexp'] = 1
        ext['Smu'] = 0
        # Start of trace
        cor_low, cor_high, sort_start_time = self._cor()
        corrected_start_time = self.cut_start_epoch + (cor_low / 1000.0)
        u_secs = int(math.modf(corrected_start_time)[0] * 1000000.0)
        # Trace start usecs
        ext['start_usec'] = u_secs
        # Shot usecs
        ext['shot_us'] = self.event_t['time/micro_seconds_i']

        return ext
예제 #5
0
파일: dumpsgy.py 프로젝트: thecassion/PH5
def read_extended_header():
    buf = FH.read(60)

    if TYPE == 'U':
        e = segy_h.Menlo(ENDIAN)
    elif TYPE == 'S':
        e = segy_h.Seg(ENDIAN)
    elif TYPE == 'P':
        e = segy_h.Passcal(ENDIAN)
    elif TYPE == 'I':
        e = segy_h.Sioseis(ENDIAN)
    elif TYPE == 'N':
        e = segy_h.iNova(ENDIAN)
    else:
        return None

    return e.parse(buf)