nslc2sourceid¶
- pymseed.nslc2sourceid(net, sta, loc, chan)[source]¶
Convert network, station, location, channel to FDSN Source ID
The network, station, location, and channel inputs are commonly SEED format codes. They can also be extended codes allowed by the Source ID standard, such as long network, station, and location codes and extended channel codes including multiple-character band, source or subsource codes.
Examples
>>> from pymseed import nslc2sourceid >>> nslc2sourceid("IU", "COLA", "00", "BHZ") 'FDSN:IU_COLA_00_B_H_Z' >>> nslc2sourceid("IU", "COLA", "", "BHZ") 'FDSN:IU_COLA__B_H_Z' >>> nslc2sourceid("NETWORK", "STATION", "LOCATION", "XX_YY_ZZ") 'FDSN:NETWORK_STATION_LOCATION_XX_YY_ZZ'
>>> nslc2sourceid("IU", "COLA", "00", 42) Traceback (most recent call last): ... TypeError: chan must be str; got int
>>> nslc2sourceid("A" * 30, "B" * 30, "00", "BHZ") Traceback (most recent call last): ... ValueError: Error creating Source ID from AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.00.BHZ
Raises
TypeErrorif a component is not a str, andValueErrorif the components cannot be combined into a valid FDSN Source ID.