Coverage for /opt/obspy/update-docs/src/obspy/obspy/xseed/blockette/blockette060 : 91%

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
# -*- coding: utf-8 -*-
""" """ """ Blockette 060: Response Reference Blockette.
Use this blockette whenever you want to replace blockettes [53] through [58] and [61] with their dictionary counterparts, blockettes [43] through [48] and [41]. We recommend placing responses in stage order, even if this means using more than one Response Reference Blockette [60].
Here is an example: Stage 1: Response (Poles & Zeros) Blockette [53] Channel Sensitivity/Gain Blockette [58] First response reference blockette: Response Reference Blockette [60] Stage 2: [44] [47] [48] Stage 3: [44] [47] [48] Stage 4: [44] [47] Channel Sensitivity/Gain Blockette [58] Stage 5: Response (Coefficients) Blockette [54] (End of first response reference blockette) Second response reference blockette: Response Reference Blockette [60] Stage 5 (continued): [47] [48] Stage 6: [44] [47] [48] (End of second response reference blockette)
Substitute Response Reference Blockette [60] anywhere the original blockette would go, but be sure to place it in the same position as the original would have gone. (Note that this blockette uses a repeating field (response reference) within another repeating field (stage value). This is the only blockette in the current version (2.1) that has this "two dimensional" structure.) """
Integer(3, "Number of stages", 2), #REPEAT field 4, with appropriate fields 5 and 6, for each filter stage Loop("FIR Coefficient", "Number of stages", [ Integer(4, "Stage sequence number", 2), Integer(5, "Number of responses", 2), #REPEAT field 6, one for each response within each stage: Loop("Response lookup key", "Number of responses", [ Integer(6, "Response lookup key", 4)], omit_tag=True), ]), ]
""" Read Blockette 60. """ # convert to stream for test issues # Loop over all stages. # Start inner loop # Append to last list.
""" Writes Blockette 60. """ # Write number of stages. # Loop over all items in self.stages. # Write stage sequence number. # Write number of items. # Add header.
""" Write XML. """ msg = 'The xsd-validation file for XML-SEED version 1.0 does ' + \ 'not support Blockette 60. It will be written but ' + \ 'please be aware that the file cannot be validated.\n' + \ 'If you want to validate your file please use XSEED ' + \ 'version 1.1.\n' sys.stdout.write(msg) # Loop over stages. str(len(self.stages[_i])) setXPath('dictionary', self.stages[_i][_j])
""" Read XML of blockette 60. """ # Loop over ch # for legacy support meaning XSEED without XPaths.: self.stages[-1].append(int(inner_child.text)) else:
""" Returns RESP string. """ # Possible dictionary blockettes. '#\t\t+ +----------------------------------' + \ '----------------+ +\n' + \ '#\t\t+ | Response Reference Information,' + \ '%6s ch %s | +\n' % (station, channel) + \ '#\t\t+ +----------------------------------' + \ '----------------+ +\n' + \ '#\t\t\n' + \ 'B060F03 Number of Stages: %s\n' \ % len(self.stages) + \ 'B060F04 Stage number: %s\n' \ % (_i + 1) + \ 'B060F05 Number of Responses: %s\n' \ % len(self.stages[_i]) + \ '#\t\t\n' # Loop over all keys and print the information in order. # Find the corresponding key in the abbreviations. blockette.response_lookup_key == response_key: blockette.getRESP(station, channel, abbreviations) except AttributeError: msg = 'RESP output not implemented for ' + \ 'blockette %d.' % blockette.id raise AttributeError(msg) msg = 'The reference blockette for response key ' + \ '%d could not be found.' % response_key raise Exception(msg) |