Beispiel #1
0
    def dump_responses(self, path):
        from pyrocko.io import stationxml

        logger.debug('Writing out StationXML...')

        path_responses = op.join(path, 'meta')
        util.ensuredir(path_responses)
        fn_stationxml = op.join(path_responses, 'stations.xml')

        stations = self.station_generator.get_stations()
        sxml = stationxml.FDSNStationXML.from_pyrocko_stations(stations)

        sunit = {
            'displacement': 'M',
            'velocity': 'M/S',
            'acceleration': 'M/S**2',
            'counts': 'COUNTS'
        }[self.seismogram_quantity]

        response = stationxml.Response(
            instrument_sensitivity=stationxml.Sensitivity(
                value=1.,
                frequency=1.,
                input_units=stationxml.Units(sunit),
                output_units=stationxml.Units('COUNTS')),
            stage_list=[])

        for net, station, channel in sxml.iter_network_station_channels():
            channel.response = response

        sxml.dump_xml(filename=fn_stationxml)

        return [path_responses]
Beispiel #2
0
def pblock_041(content):
    stage_number = -1

    fir = sxml.FIR(name=get1(content, b'04', optional=True),
                   input_units=sxml.Units(name=punit(get1(content, b'06'))),
                   output_units=sxml.Units(name=punit(get1(content, b'07'))),
                   symmetry=psymmetry(get1(content, b'05')),
                   numerator_coefficient_list=list(
                       map(pnc, getn(content, b'09'))))

    return stage_number, fir
Beispiel #3
0
def pblock_044(content):
    stage_number = -1

    cfs = sxml.Coefficients(
        cf_transfer_function_type=pcftype(get1(content, b'05')),
        input_units=sxml.Units(name=punit(get1(content, b'06'))),
        output_units=sxml.Units(name=punit(get1(content, b'07'))),
        numerator_list=list(map(pcfu, getn(content, b'09-10'))),
        denominator_list=list(map(pcfu, getn(content, b'12-13'))))

    return stage_number, cfs
Beispiel #4
0
def pblock_054(content):
    stage_number = int(get1(content, b'04'))

    cfs = sxml.Coefficients(
        cf_transfer_function_type=pcftype(get1(content, b'03')),
        input_units=sxml.Units(name=punit(get1(content, b'05'))),
        output_units=sxml.Units(name=punit(get1(content, b'06'))),
        numerator_list=list(map(pcfu, getn(content, b'08-09'))),
        denominator_list=list(map(pcfu, getn(content, b'11-12'))))

    return stage_number, cfs
Beispiel #5
0
def pblock_053(content):
    stage_number = int(get1(content, b'04'))

    pzs = sxml.PolesZeros(
        pz_transfer_function_type=ptftype(get1(content, b'03')),
        input_units=sxml.Units(name=punit(get1(content, b'05'))),
        output_units=sxml.Units(name=punit(get1(content, b'06'))),
        normalization_factor=float(get1(content, b'07')),
        normalization_frequency=sxml.Frequency(
            value=float(get1(content, b'08'))),
        zero_list=list(map(ppolezero, getn(content, b'10-13'))),
        pole_list=list(map(ppolezero, getn(content, b'15-18'))))

    for i, x in enumerate(pzs.zero_list):
        x.number = i

    for i, x in enumerate(pzs.pole_list):
        x.number = i

    return stage_number, pzs
Beispiel #6
0
from pyrocko.io import stationxml as fdsn
from pyrocko import model
from pyrocko.example import get_example_data

get_example_data('stations.txt')

stations = model.load_stations('stations.txt')

station_xml = fdsn.FDSNStationXML.from_pyrocko_stations(stations)
for network in station_xml.network_list:
    for station in network.station_list:
        for channel in station.channel_list:
            channel.response = fdsn.Response(
                instrument_sensitivity=fdsn.Sensitivity(
                    value=1.0,
                    frequency=1.0,
                    input_units=fdsn.Units('M'),
                    output_units=fdsn.Units('COUNTS')))

station_xml.validate()
# print(station_xml.dump_xml())
station_xml.dump_xml(filename='stations_flat_displacement.xml')