Ejemplo n.º 1
0
                              dip=0,
                              sample_rate=station_df['sampling_rate'])
                cha.channel_number = station_df['{0}_num'.format(comp)]
                cha.sensor = Equipment(
                    serial_number=station_df['{0}_id'.format(comp)])
            elif 'e' in comp:
                cha = Channel(code=comp.upper(),
                              location_code="",
                              latitude=station_df['lat'],
                              longitude=station_df['lon'],
                              elevation=station_df['nm_elev'],
                              depth=0,
                              azimuth=station_df['{0}_azm'.format(comp)],
                              dip=0,
                              sample_rate=station_df['sampling_rate'])
                cha.extra = {'dipole_length': {'value': 10, 'namespace': 'MT'}}
#                cha.comments = Comment(['Dipole Length (m) = {0:.1f}'.format(station_df['{0}_len'.format(comp)])])

            sta.channels.append(cha)
    # Now tie it all together.
    #cha.response = response

    net.stations.append(sta)

# And finally write it to a StationXML file. We also force a validation against
# the StationXML schema to ensure it produces a valid StationXML file.
#
# Note that it is also possible to serialize to any of the other inventory
# output formats ObsPy supports.
inv.write("station.xml",
          format="STATIONXML",
                cha.channel_number = station_df["{0}_num".format(comp)]
                cha.sensor = Equipment(
                    serial_number=station_df["{0}_id".format(comp)])
            elif "e" in comp:
                cha = Channel(
                    code=comp.upper(),
                    location_code="",
                    latitude=station_df["lat"],
                    longitude=station_df["lon"],
                    elevation=station_df["nm_elev"],
                    depth=0,
                    azimuth=station_df["{0}_azm".format(comp)],
                    dip=0,
                    sample_rate=station_df["sampling_rate"],
                )
                cha.extra = {"dipole_length": {"value": 10, "namespace": "MT"}}
            #                cha.comments = Comment(['Dipole Length (m) = {0:.1f}'.format(station_df['{0}_len'.format(comp)])])

            sta.channels.append(cha)
    # Now tie it all together.
    # cha.response = response

    net.stations.append(sta)

# And finally write it to a StationXML file. We also force a validation against
# the StationXML schema to ensure it produces a valid StationXML file.
#
# Note that it is also possible to serialize to any of the other inventory
# output formats ObsPy supports.
inv.write("station.xml",
          format="STATIONXML",