simplemseed.fdsnsourceid

Philip Crotwell University of South Carolina, 2022 http://www.seis.sc.edu

Module Contents

Classes

FDSNSourceId

A FDSN Source Id.

LocationSourceId

An abbreviated source id representing a station-location, like FDSN:CO_BIRD_00

NetworkSourceId

An abbreviated source id representing a network, like FDSN:CO or FDSN:XD1994

NslcId

Older style NSLC SEED Id. Consists of 2 char network, 5 char station, 2 char location and 3 char channel.

StationSourceId

An abbreviated source id representing a station, like FDSN:CO_BIRD

Functions

bandCodeDescribe

Describe the band code.

bandCodeForRate

Calculates the band code for the given sample rate/period.

bandCodeInfo

Type, rate and response lower bound describing the band code.

loadBandCodes

Loads band code definitions.

loadSourceCodes

Loads source code definitions.

main

sourceCodeDescribe

Describe the source code.

sourceCodeInfo

Type, describing the source code.

Data

BAND_CODE_JSON

Band codes, description, and rates.

FDSN_PREFIX

const for fdsn prefix for extra headers, ‘FDSN:’. Note includes colon.

LOCATION_VALID

Regular expression for location code

NET_VALID

Regular expression for network code

SEP

const default separator.

SINGLE_STATION_NETCODE

The SS, single station network code.

SOURCE_CODE_JSON

Source codes and descriptions.

SOURCE_SUBSOURCE_VALID

Regular expression for source and subsource codes

STATION_VALID

Regular expression for station code

TEMP_NET_CONVENTION

Network codes for temporary networks convention, ends with 4 digit year.

TEMP_NET_MAPPING

Mapping of older SEED style temp networks to include start year, like XD maps to XD1994. Starts with XYZ or a digit and ends with 4 digit year.

TEMP_NET_SEED

Older SEED style temp networks, like XD. Starts with XYZ or a digit.

TESTDATA_NETCODE

The XX, testing data, network code.

API

simplemseed.fdsnsourceid.BAND_CODE_JSON = None

Band codes, description, and rates.

class simplemseed.fdsnsourceid.FDSNSourceId(networkCode: Union[str, simplemseed.fdsnsourceid.NetworkSourceId], stationCode: str, locationCode: str, bandCode: str, sourceCode: str, subsourceCode: str)

A FDSN Source Id.

Defined in the specification, http://docs.fdsn.org/projects/source-identifiers/en/v1.0.

Initialization

Creates a new source id with the given codes.

SPECIFICATION_URL = 'http://docs.fdsn.org/projects/source-identifiers/en/v1.0'

URL to specification

SPECIFICATION_VERSION = '1.0'

FDSN Specification version that this class corresponds to.

asNslc() simplemseed.fdsnsourceid.NslcId

Convert the source id into an older seed-style nslc.

If the source and subsource are single characters, then a 3 char channel code will be created, like BHZ. But if any are larger, then a longer string with separators will be creates, like B_AA_QW

bandCode: str = None

Band code, depends on sample rate.

static createUnknown(sampRate: Optional[Union[float, int]] = None, sourceCode: str = 'H', response_lb: Optional[Union[float, int]] = None, networkCode: str = TESTDATA_NETCODE, stationCode: str = 'ABC', locationCode: str = '', subsourceCode: str = 'U') simplemseed.fdsnsourceid.FDSNSourceId

Creates a Source Id for non-real data.

Unless specified, this will have network code XX, which is defined to be a “do not use” test network. The band code can be calculated based on the optional sample rate and response lower bound. See bandCodeForRate() for details.

static fromNslc(net: str, sta: str, loc: str, channelCode: str, startYear: str | int | None = None) simplemseed.fdsnsourceid.FDSNSourceId

Create a FDSN Source Id from an older seed-style nslc, network, station location, channel.

Optionally give the start year of the network, which will be appended if it is a SEED-style temporary network like XD.

locationCode: str = None

Location code, 0-8 chars.

locationSourceId() simplemseed.fdsnsourceid.LocationSourceId

The location sourceid containing this channel.

networkCode: str = None

Network code, 1-8 chars.

networkSourceId() simplemseed.fdsnsourceid.NetworkSourceId

The network sourceid containing this channel.

static parse(sid: str) Union[simplemseed.fdsnsourceid.FDSNSourceId, simplemseed.fdsnsourceid.NetworkSourceId, simplemseed.fdsnsourceid.StationSourceId, simplemseed.fdsnsourceid.LocationSourceId]

Parse a FDSN Source Id string, like FDSN:CO_BIRD_00_H_H_Z into its constituant parts.

Also will handle parsing abbreviated codes for network, FDSN:CO station, FDSN:CO_BIRD location, FDSN:CO_BIRD_00

static parseNslc(nslc: str, sep='.', startYear: str | int | None = None) simplemseed.fdsnsourceid.FDSNSourceId

Create a FDSN Source Id by parsing an older seed-style nslc, network, station location, channel, wheret the 4 sections are separated by the given separator, which defaults to a dot, ‘.’.

shortChannelCode() str

Convert the channel part of the source id into an older seed-style nslc.

If the source and subsource are single characters, then a 3 char channel code will be created, like BHZ. But if any are larger, then a longer string with separators will be creates, like B_AA_QW

sourceCode: str = None

Source code, describes the instrument and data type.

stationCode: str = None

Station code, 1-8 chars.

stationSourceId() simplemseed.fdsnsourceid.StationSourceId

The station sourceid containing this channel.

subsourceCode: str = None

Subsource code, describes component of instrument, often orientation.

validate()

Validates a source id, primarily for length limitations.

Returns a tuple of either (True, None) or (False, <reason>)

exception simplemseed.fdsnsourceid.FDSNSourceIdException

Bases: Exception

simplemseed.fdsnsourceid.FDSN_PREFIX = 'FDSN:'

const for fdsn prefix for extra headers, ‘FDSN:’. Note includes colon.

simplemseed.fdsnsourceid.LOCATION_VALID = 'compile(...)'

Regular expression for location code

class simplemseed.fdsnsourceid.LocationSourceId(networkCode: Union[str, simplemseed.fdsnsourceid.NetworkSourceId], stationCode: str, locationCode: str)

An abbreviated source id representing a station-location, like FDSN:CO_BIRD_00

Note if the location segment in zero length, the code will end with the underscore like FDSN:IU_ANMO_

Initialization

createFDSNSourceId(bandCode: str, sourceCode: str, subsourceCode: str) simplemseed.fdsnsourceid.FDSNSourceId

Create a channel-level FDSNSourceId within this location.

locationCode: str = None

Location code, 0-8 chars.

networkCode: str = None

Network code, 1-8 chars.

networkSourceId() simplemseed.fdsnsourceid.NetworkSourceId

The network sourceid containing this location.

stationCode: str = None

Station code, 1-8 chars.

stationSourceId() simplemseed.fdsnsourceid.StationSourceId

The station sourceid containing this location.

validate()

Validation checks.

simplemseed.fdsnsourceid.NET_VALID = 'compile(...)'

Regular expression for network code

class simplemseed.fdsnsourceid.NetworkSourceId(networkCode: str, startYear: str | int | None = None)

An abbreviated source id representing a network, like FDSN:CO or FDSN:XD1994

Initialization

createStationSourceId(stationCode) simplemseed.fdsnsourceid.StationSourceId

Create a station-level source id within this network.

isSeedTempNet() bool

True if the network code is a 2 digit SEED-style temporary network code.

This starts with a digit or one of X,Y,Z, followed by another digit or letter, but not XX which is the network code for test data.

isTempNetConvention() bool

True if the network code follows the temporary network code convention where the last 4 characters of the code are the start year of the network.

Generally permanant networks should not be formed in this way.

isTempNetHistorical() bool

True if the network code follows the FDSN SourceId network code mapping for historical temporary networks.

This starts with a digit or one of X,Y,Z, followed by another digit or letter and then the 4 digit starting year of the network. For example XD1994 is the temporary network assigned the SEED code XD that started in 1994.

isTemporary() bool

True if the network code is follows one of the temporary conventions.

For example XD, XD1994 or ABCD2025

networkCode: str = None

Network code, 1-8 chars.

validate()

Validation checks.

class simplemseed.fdsnsourceid.NslcId(net: str, sta: str, loc: str, chan: str)

Older style NSLC SEED Id. Consists of 2 char network, 5 char station, 2 char location and 3 char channel.

Initialization

channelCode: str = None

Channel code, 3 chars: band, instrument, orientation

locationCode: str = None

Location code, 0 or 2 chars, often 00 or empty.

networkCode: str = None

Network code, 1-2 chars

stationCode: str = None

Station Code, 3-5 chars

simplemseed.fdsnsourceid.SEP = '_'

const default separator.

simplemseed.fdsnsourceid.SINGLE_STATION_NETCODE = 'SS'

The SS, single station network code.

This code may be used by any institution running a Single Station, the station should be registered with the International Registry of Seismograph Stations. Care must be taken to ensure that the station code is not the same as another station using the SS network code..

simplemseed.fdsnsourceid.SOURCE_CODE_JSON = None

Source codes and descriptions.

simplemseed.fdsnsourceid.SOURCE_SUBSOURCE_VALID = 'compile(...)'

Regular expression for source and subsource codes

simplemseed.fdsnsourceid.STATION_VALID = 'compile(...)'

Regular expression for station code

class simplemseed.fdsnsourceid.StationSourceId(networkCode: Union[str, simplemseed.fdsnsourceid.NetworkSourceId], stationCode: str)

An abbreviated source id representing a station, like FDSN:CO_BIRD

Initialization

createLocationSourceId(locationCode) simplemseed.fdsnsourceid.LocationSourceId

Create a location-level source id within this station.

networkCode: str = None

Network code, 1-8 chars.

networkSourceId() simplemseed.fdsnsourceid.NetworkSourceId

The network sourceid containing this station.

stationCode: str = None

Station code, 1-8 chars.

validate()

Validation checks.

simplemseed.fdsnsourceid.TEMP_NET_CONVENTION = 'compile(...)'

Network codes for temporary networks convention, ends with 4 digit year.

simplemseed.fdsnsourceid.TEMP_NET_MAPPING = 'compile(...)'

Mapping of older SEED style temp networks to include start year, like XD maps to XD1994. Starts with XYZ or a digit and ends with 4 digit year.

simplemseed.fdsnsourceid.TEMP_NET_SEED = 'compile(...)'

Older SEED style temp networks, like XD. Starts with XYZ or a digit.

simplemseed.fdsnsourceid.TESTDATA_NETCODE = 'XX'

The XX, testing data, network code.

This code is not real. It is reserved for test data, examples or transient usage when a real code cannot be used. Data with this network code should never be distributed.

simplemseed.fdsnsourceid.bandCodeDescribe(bandCode: str) str

Describe the band code.

See http://docs.fdsn.org/projects/source-identifiers/en/v1.0/channel-codes.html#band-code

simplemseed.fdsnsourceid.bandCodeForRate(sampRatePeriod: Optional[Union[float, int]] = None, response_lb: Optional[Union[float, int]] = None) str

Calculates the band code for the given sample rate/period.

Optionally taking into account the lower bound of the response, response_lb, to distinguish broadband from short period in the higher sample rates, where 0.1 hertz is the boundary.

If sampRatePeriod is negative, then interpreted as a period instead of a rate. So 0.1 and -10 both mean one sample every 10 seconds. Similar for response_lb.

See http://docs.fdsn.org/projects/source-identifiers/en/v1.0/channel-codes.html#band-code

simplemseed.fdsnsourceid.bandCodeInfo(bandCode: str)

Type, rate and response lower bound describing the band code.

{‘type’: ‘Very Long Period’, ‘rate’: ‘>= 0.1 to < 1’, ‘response_lb’: ‘’}

See http://docs.fdsn.org/projects/source-identifiers/en/v1.0/channel-codes.html#band-code

simplemseed.fdsnsourceid.loadBandCodes()

Loads band code definitions.

JSON band codes are available at https://github.com/crotwell/simplemseed/blob/main/src/simplemseed/bandcode.json

simplemseed.fdsnsourceid.loadSourceCodes()

Loads source code definitions.

JSON source codes are available at https://github.com/crotwell/simplemseed/blob/main/src/simplemseed/sourcecode.json

simplemseed.fdsnsourceid.main()
simplemseed.fdsnsourceid.sourceCodeDescribe(sourceCode: str) str

Describe the source code.

See http://docs.fdsn.org/projects/source-identifiers/en/v1.0/channel-codes.html

simplemseed.fdsnsourceid.sourceCodeInfo(sourceCode: str)

Type, describing the source code.

{ “code”: “H”, “type”: “High Gain Seismometer” }

See http://docs.fdsn.org/projects/source-identifiers/en/v1.0/channel-codes.html