Populate Station Table

This script is responsible for rapidly scanning the data archive and identifying the Networks/Stations and insert them in the stations table in the database.

The data_folder (as defined in the config) is scanned expecting the data_structure and possible values are defined in data_structures.py:

data_structure['BUD'] = "NET/STA/STA.NET.LOC.CHAN.YEAR.DAY"

If one’s data structure is one of those, then the data_structure configuration bit needs to be set to the acronym (SDS, BUD, IDDS or PDF).

More info on the recommended SDS (“SeisComP Data Structure”) can be found here: https://www.seiscomp3.org/wiki/doc/applications/slarchive/SDS For other simple structures, one has to edit the data_structure configuration (see below).

By default, station coordinates are initialized at 0.

To run this script:

$ msnoise populate

Custom data structure & station table population

If one’s data structure is not one of the pre-defined, it can be defined directly in the data_structure configuration bit using forward slashes, e.g.:


MSNoise expects to find a file named custom.py in the current folder. This python file will contain a function called populate wich will accept one argument and return a station dictionary with keys of the format NET_STA , and fields for the stations table in the database: Net,Sta,X,Y,Altitude, Coordinates(UTM/DEG),Instrument.

import os, glob
def populate(data_folder):
    datalist = sorted(glob.glob(os.path.join(data_folder, "*", "*")))
    stationdict = {}
    for di in datalist:
        tmp = os.path.split(di)
        sta = tmp[1]
        net = os.path.split(tmp[0])[1]
    return stationdict

Expert (lazy) mode:

If the DataAvailability has already been filled in by another process, for example using the “scan from path” procedure, the network/station names can be “populated” from the DataAvailability table automatically. To do this, simply run:

msnoise populate --fromDA

and MSNoise will insert the unique NET.STA in the Stations table.