|
3 | 3 | * |
4 | 4 | * This file is part of the miniSEED Library. |
5 | 5 | * |
6 | | - * Copyright (c) 2020 Chad Trabant, IRIS Data Management Center |
| 6 | + * Copyright (c) 2021 Chad Trabant, IRIS Data Management Center |
7 | 7 | * |
8 | 8 | * Licensed under the Apache License, Version 2.0 (the "License"); |
9 | 9 | * you may not use this file except in compliance with the License. |
@@ -113,18 +113,25 @@ static const int monthdays_leap[] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, |
113 | 113 |
|
114 | 114 |
|
115 | 115 | /**********************************************************************/ /** |
116 | | - * @brief Parse network, station, location and channel from a source ID URI |
| 116 | + * @brief Parse network, station, location and channel from an FDSN Source ID |
| 117 | + * |
| 118 | + * FDSN Source Identifiers are defined at: |
| 119 | + * https://docs.fdsn.org/projects/source-identifiers/ |
117 | 120 | * |
118 | 121 | * Parse a source identifier into separate components, expecting: |
119 | | - * \c "XFDSN:NET_STA_LOC_CHAN", where \c CHAN="BAND_SOURCE_POSITION" |
| 122 | + * \c "FDSN:NET_STA_LOC_CHAN", where \c CHAN="BAND_SOURCE_POSITION" |
120 | 123 | * |
121 | 124 | * The CHAN value will be converted to a SEED channel code if |
122 | 125 | * possible. Meaning, if the BAND, SOURCE, and POSITION are single |
123 | 126 | * characters, the underscore delimiters will not be included in the |
124 | 127 | * returned channel. |
125 | 128 | * |
126 | 129 | * Identifiers may contain additional namespace identifiers, e.g.: |
127 | | - * \c "XFDSN:AGENCY:NET_STA_LOC_CHAN" |
| 130 | + * \c "FDSN:AGENCY:NET_STA_LOC_CHAN" |
| 131 | + * |
| 132 | + * Such additional namespaces are not part of the Source ID standard |
| 133 | + * as of this writing and support is included for specialized usage or |
| 134 | + * future identifier changes. |
128 | 135 | * |
129 | 136 | * Memory for each component must already be allocated. If a specific |
130 | 137 | * component is not desired set the appropriate argument to NULL. |
@@ -154,21 +161,20 @@ ms_sid2nslc (char *sid, char *net, char *sta, char *loc, char *chan) |
154 | 161 | return -1; |
155 | 162 | } |
156 | 163 |
|
157 | | - /* Handle the XFDSN: and FDSN: namespace identifiers */ |
158 | | - if (!strncmp (sid, "XFDSN:", 6) || |
159 | | - !strncmp (sid, "FDSN:", 5)) |
| 164 | + /* Handle the FDSN: namespace identifier */ |
| 165 | + if (!strncmp (sid, "FDSN:", 5)) |
160 | 166 | { |
161 | 167 | /* Advance sid pointer to last ':', skipping all namespace identifiers */ |
162 | 168 | sid = strrchr (sid, ':') + 1; |
163 | 169 |
|
164 | | - /* Verify 3 or 5 delimiters */ |
| 170 | + /* Verify 5 delimiters */ |
165 | 171 | id = sid; |
166 | 172 | while ((id = strchr (id, '_'))) |
167 | 173 | { |
168 | 174 | id++; |
169 | 175 | sepcnt++; |
170 | 176 | } |
171 | | - if (sepcnt != 3 && sepcnt != 5) |
| 177 | + if (sepcnt != 5) |
172 | 178 | { |
173 | 179 | ms_log (2, "Incorrect number of identifier delimiters (%d): %s\n", sepcnt, sid); |
174 | 180 | return -1; |
@@ -205,7 +211,7 @@ ms_sid2nslc (char *sid, char *net, char *sta, char *loc, char *chan) |
205 | 211 |
|
206 | 212 | top = next; |
207 | 213 | } |
208 | | - /* Location (potentially empty) */ |
| 214 | + /* Location, potentially empty */ |
209 | 215 | if ((ptr = strchr (top, '_'))) |
210 | 216 | { |
211 | 217 | next = ptr + 1; |
@@ -240,11 +246,14 @@ ms_sid2nslc (char *sid, char *net, char *sta, char *loc, char *chan) |
240 | 246 | } /* End of ms_sid2nslc() */ |
241 | 247 |
|
242 | 248 | /**********************************************************************/ /** |
243 | | - * @brief Convert network, station, location and channel to a source ID URI |
| 249 | + * @brief Convert network, station, location and channel to an FDSN Source ID |
| 250 | + * |
| 251 | + * FDSN Source Identifiers are defined at: |
| 252 | + * https://docs.fdsn.org/projects/source-identifiers/ |
244 | 253 | * |
245 | 254 | * Create a source identifier from individual network, |
246 | 255 | * station, location and channel codes with the form: |
247 | | - * \c XFDSN:NET_STA_LOC_CHAN, where \c CHAN="BAND_SOURCE_POSITION" |
| 256 | + * \c FDSN:NET_STA_LOC_CHAN, where \c CHAN="BAND_SOURCE_POSITION" |
248 | 257 | * |
249 | 258 | * Memory for the source identifier must already be allocated. If a |
250 | 259 | * specific component is NULL it will be empty in the resulting |
@@ -288,13 +297,12 @@ ms_nslc2sid (char *sid, int sidlen, uint16_t flags, |
288 | 297 | return -1; |
289 | 298 | } |
290 | 299 |
|
291 | | - *sptr++ = 'X'; |
292 | 300 | *sptr++ = 'F'; |
293 | 301 | *sptr++ = 'D'; |
294 | 302 | *sptr++ = 'S'; |
295 | 303 | *sptr++ = 'N'; |
296 | 304 | *sptr++ = ':'; |
297 | | - needed = 6; |
| 305 | + needed = 5; |
298 | 306 |
|
299 | 307 | if (net) |
300 | 308 | { |
|
0 commit comments