sourceid2nslc¶
- pymseed.sourceid2nslc(sourceid)[source]¶
Convert an FDSN Source ID to a tuple of (net, sta, loc, chan)
Components that are empty in the Source ID are returned as empty strings.
The individual codes in the Source ID are commonly compatible with SEED format codes. However, 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 sourceid2nslc >>> sourceid2nslc("FDSN:IU_COLA_00_B_H_Z") ('IU', 'COLA', '00', 'BHZ') >>> sourceid2nslc("FDSN:IU_COLA__B_H_Z") ('IU', 'COLA', '', 'BHZ') >>> sourceid2nslc("FDSN:NETWORK_STATION_LOCATION_XX_YY_ZZ") ('NETWORK', 'STATION', 'LOCATION', 'XX_YY_ZZ')
>>> sourceid2nslc("not-a-source-id") Traceback (most recent call last): ... ValueError: Invalid FDSN Source ID: not-a-source-id
>>> sourceid2nslc(42) Traceback (most recent call last): ... TypeError: sourceid must be str; got int
Raises
TypeErrorif the Source ID is not a str, andValueErrorif it is malformed.