MS_SELECTION - Online Linux Manual PageSection : 3
Updated : 2012/12/28
Source : Libmseed API
NAMEms_selection - Routines to manage and use data selection lists.
SYNOPSIS#include <libmseed.h>
Selections *ms_matchselect ( Selections *selections, char *srcname,
hptime_t starttime, hptime_t endtime,
SelectTime **ppselecttime );
Selections *msr_matchselect ( Selections *selections, MSRecord *msr,
SelectTime **ppselecttime );
int ms_addselect ( Selections **ppselections, char *srcname,
hptime_t starttime, hptime_t endtime );
int ms_addselect_comp ( Selections **ppselections, char *net,
char *sta, char *loc, char *chan, char *qual,
hptime_t starttime, hptime_t endtime );
int ms_readselectionsfile ( Selections **ppselections, char *filename );
void ms_freeselections ( Selections *selections );
void ms_printselections ( Selections *selections );
DESCRIPTIONThese routines serve as a convienence facility for creating a list of data selections and using it to match data. The selection criteria are the srcname and optional start and end times. The srcname components in a selection may contain globbing characters for matching (wildcards, character range, etc.). A srcname is generally composed of network, station, location, channel and optional quality components; normally these are created with msr_srcname(3) and mst_srcname(3). ms_matchselect checks for an entry in the selections list that matches the supplied srcname and optionally starttime and endtime. The start and/or end times can be set to HTPERROR to mean "any" time. A selection will match the specified time range if there is any overlap in time coverage. If the ppselecttime pointer is not NULL it will be set to the matching SelectTime entry. msr_matchselect is a simple wrapper to call ms_matchselect using the details from a specified MSRecord. ms_addselect adds a selection entry to the selections list based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP boundaries. The source name components may contain globbing characters for matching including wildcards and character sets, see SRCNAME MATCHING below. Note that the ppselections is a pointer to a pointer, if the secondary pointer has not been allocated (i.e. the list is empty) the first entry will be created and the primary pointer updated. ms_addselect_comp is a wrapper of ms_addselect used to add a selection entry to the selections list. The net, sta, loc, chan and qual source name components are used to create a srcname. The name components may contain globbing characters for matching including wildcards and character sets, see SRCNAME MATCHING below. If a name component is not specified a wildard matching all entries will be subsituted, i.e. net==NULL will be interpreted to match all network codes. As a special case a loc value of "--" will be translated to and empty string to match the srcname representation of a blank (space-space) location ID. ms_readselectionsfile reads a file containing a list of selections and adds them to the specified selections list. As with ms_addselect if the selections list is empty it will be created. For more details see the SELECTION FILE section below. ms_freeselections frees all memory associated with selections. ms_printselections prints all of the entries in the selections list using the ms_log() facility.
RETURN VALUESThe ms_matchselect and msr_matchselect routines return a pointer to the matching Selections entry on success and NULL when no match was found. These routines will also set the ppselecttime pointer to the matching SelectTime entry if supplied. ms_addselect and ms_addselect_comp return 0 on success and -1 on error. ms_readselectionsfile returns the number of selections added to the list or -1 on error.
SELECTION FILEA selection file is used to match input data records based on network, station, location and channel information. Optionally a quality and time range may also be specified for more refined selection. The non-time fields may use the '*' wildcard to match multiple characters and the '?' wildcard to match single characters. Character sets may also be used, for example '[ENZ]' will match either E, N or Z. The '#' character indicates the remaining portion of the line will be ignored. Example selection file entries (the first four fields are required) #net sta loc chan qual start end
IU ANMO * BH?
II * * * Q
IU COLA 00 LH[ENZ] R
IU COLA 00 LHZ * 2008,100,10,00,00 2008,100,10,30,00
SRCNAME MATCHINGEntries in a Selections list include a "source name" (srcname) string to represent matching parameters for network, station, location, channel and optionally the quality name components. Each name component may contain globbing characters to match more than one unique srcname. Valid glob patterns include:
* matches zero or more characters
? matches any single character
[set] matches any character in the set
[^set] matches any character NOT in the set
where a set is a group of characters or ranges. a range
is written as two characters separated with a hyphen:
a-z denotes all characters between a to z inclusive.
[-set] set matches a literal hyphen and any character in the set
[]set] matches a literal close bracket and any character in the set
char matches itself except where char is '*' or '?' or '['
examples:
a*c ac abc abbc ...
a?c acc abc aXc ...
a[a-z]c aac abc acc ...
a[-a-z]c a-c aac abc ...
EXAMPLE USAGEThe primary intention of the Selections list facility is to limit data to a specific selection as it's read into a program. This is illustrated below. main() {
MSRecord *msr = NULL;
Selections *selections = NULL;
hptime_t starttime;
hptime_t endtime;
int retcode;
ms_addselect (&selections, "IU_*_*_LH?_?", HPTERROR, HPTERROR);
starttime = timestr2hptime ("2009/1/15 00:00:00.00");
endtime = timestr2hptime ("2009/1/31 23:59:59.99");
ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
while ( (retcode = ms_readmsr (&msr, filename, 0, NULL, NULL, 1, 0, verbose)) == MS_NOERROR )
{
/* Print details if data record matches selection criteria */
if ( msr_matchselect (selections, msr, NULL) )
{
msr_print (msr, verbose);
}
}
if ( retcode != MS_ENDOFFILE )
ms_log (2, "Error reading input file %s: %s\n",
filename, ms_errorstr(retcode));
/* Cleanup memory and close file */
ms_readmsr (&msr, NULL, 0, NULL, NULL, 0, 0, verbose);
} /* End of main() */The following two calls are equivalent: ms_addselect (&selections, "IU_ANMO_00_LH?_?", starttime, endtime);
ms_addselect_comp (&selections, "IU", "ANMO", "00", "LH?", "?", startime, endtime);As a further convienence usage of ms_readselectionsfile() would allow the selections to be specified in a simple ASCII file and avoid the need to directly call ms_addselect().
SEE ALSOmsr_srcname(3) and mst_srcname(3).
AUTHORChad Trabant
IRIS Data Management Center 0
Johanes Gumabo
Data Size : 20,004 byte
man-ms_printselections.3Build : 2024-12-05, 20:55 :
Visitor Screen : x
Visitor Counter ( page / site ) : 3 / 181,818
Visitor ID : :
Visitor IP : 18.226.52.26 :
Visitor Provider : AMAZON-02 :
Provider Position ( lat x lon ) : 39.962500 x -83.006100 : x
Provider Accuracy Radius ( km ) : 1000 :
Provider City : Columbus :
Provider Province : Ohio , : ,
Provider Country : United States :
Provider Continent : North America :
Visitor Recorder : Version :
Visitor Recorder : Library :
Online Linux Manual Page : Version : Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page : Library : lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page : Library : lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base : Version : Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base : Library : lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36
Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.
ERROR : Need New Coding : (rof_escape_sequence|91|m___s_addselect.3|51|\fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP |based on the \fsrcname\fP and the \fIstarttime\fP and \fIendtime\fP
) (rof_nr_x|149|m___s_addselect.3|171|\n",| ms_log (2, "Error reading input file %s: %s\\n",
)