Moving from scnlobject to channeltag - geoscience-community-codes/GISMO GitHub Wiki
New capabilities for channeltag
####create using a string.
old usage
scnl = scnlobject('STA','CHA','NW', 'LOC')
new usage
chaTag = channeltag('NW.STA.LOC.CHA')
multiple channeltags can be initialized with either a cell of strings, or an NxM char array via channeltag.array()
.
cellArray = {'AV.OKCF..EHZ', 'AV.RSO..EHZ', 'AV.OKER..EHZ'}; % good for arbitrary lists
chaTag = channeltag.array(cellArray);
Working with a char array is often messy, but sometimes it keeps your code simpler.
charArray = ['AV.OKCF..EHZ';'AV.RSO..EHZ ';'AV.OKER..EHZ']; % 3x12 char array
chaTag = channeltag.array(charArray);
channeltag.array()
instead of channeltag()
?
Why do I need to use By specifying channeltag.array()
you are explicitly saying that your code expects one or more channeltags.
Conversely, using channeltag()
means that the code will error with multiple inputs, which makes for easier debugging.
Additionally, having a separate array constructor means that channeltag()
can be streamlined. This is important, since the copy constructor will likely be called many, many times internally.
Parsing routines
channeltag.parse
- can return a network, station, location and channel from either a period-delimited string or a channeltag.
s = 'IU.ANMO.00.BHZ'; ct = channeltag('IU.ANMO.00.BHZ');
[N, S, L, C] = channeltag.parse(s);
[N, S, L, C] = channeltag.parse(ct);
% both work and provide the same answer, where N='IU' S='ANMO' L='00' C='BHZ'