#include <stdlib.h>#include <stdio.h>#include <time.h>#include <ctype.h>#include <math.h>#include <errno.h>#include <unistd.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <dirent.h>#include <assert.h>#include <signal.h>#include "common.h"
Go to the source code of this file.
Defines | |
| #define | MAX_SENSOR_NUMBER 300 |
| #define | DO_COMPARISON_KW(__a, __i) |
Functions | |
| int | ReadSensorList (void) |
| read the sensor list file: sensor_list, the internal sensor list is cleared | |
| char * | ChannelName (char *sensor, float s) |
| compute the channel name from the sensor and the sampling rate | |
| char * | TDBPath (int p, char *s) |
| path name based on TDB information | |
| void | PrintStation (struct StationType *s) |
| void | TDBAbortParsing (char *s, char *fn) |
| int | TDBInit (void) |
| data base initialization : read all stations | |
| struct ChannelType * | TDBGetChannel (char *sta, int channel, time_t when) |
| search tdb for a station | |
| int | TDBUpdateHeader (struct InfoHeaderType *h) |
| overwrite header information with TDB information | |
Variables | |
| struct SensorType | sensorEntry [MAX_SENSOR_NUMBER] |
| char ** | tdbPaths = NULL |
| struct StationType * | tdbStation = NULL |
| char * | confKeyWord [] = { "dt", "dft", "tc", "stations", NULL } |
| #define DO_COMPARISON_KW | ( | __a, | |||
| __i | ) |
Value:
if (0==strcmp(strcat(strcat(strcpy(tmp,tdbName),"_"),__a),kw)) \ { \ if (1!=sscanf(line,"%*s %s",tdbPaths[__i])) \ { \ PrintError("error parsing %s for keyword '%s'\n", \ conf,kw); \ exit(0); \ } \ }
Referenced by TDBInit().
| #define MAX_SENSOR_NUMBER 300 |
| char* ChannelName | ( | char * | sensor, | |
| float | s | |||
| ) |
compute the channel name from the sensor and the sampling rate
| sensor | the sensor name | |
| s | the sampling rate |
Definition at line 190 of file tdb.c.
References MAX_SENSOR_NUMBER, and PrintError.
Referenced by TDBUpdateHeader().
| void PrintStation | ( | struct StationType * | s | ) |
Definition at line 320 of file tdb.c.
References MAX_OSIRIS_CHANNEL, PrintDebug, and time2str().
Referenced by TDBInit(), and TDBUpdateHeader().
| int ReadSensorList | ( | void | ) |
read the sensor list file: sensor_list, the internal sensor list is cleared
Definition at line 136 of file tdb.c.
References MAX_SENSOR_NUMBER, PrintDebug, PrintLog, TDB_PATH_SENSORLIST, and TDBPath().
Referenced by TDBInit().
| void TDBAbortParsing | ( | char * | s, | |
| char * | fn | |||
| ) |
Definition at line 341 of file tdb.c.
References PrintError, TDB_PATH_STATIONS, and tdbPaths.
Referenced by TDBInit().
| struct ChannelType* TDBGetChannel | ( | char * | sta, | |
| int | channel, | |||
| time_t | when | |||
| ) | [read] |
search tdb for a station
| sta | the station to look for | |
| channel | the channel number to look for | |
| when | the time of the information to find |
Definition at line 704 of file tdb.c.
Referenced by TDBUpdateHeader().
| int TDBInit | ( | void | ) |
data base initialization : read all stations
| frame | the frame to dump |
Definition at line 352 of file tdb.c.
References __scandir(), ADD_CHANNEL_CODE, ADD_LOCATION_CODE, ADD_NETWORK_CODE, confKeyWord, DO_COMPARISON_KW, fileNameOptions, MAX_OSIRIS_CHANNEL, MyGetenv(), PrintDebug, PrintError, PrintLog, PrintStation(), ReadSensorList(), str2time(), TDB_PATH_LAST, TDB_PATH_SENSORLIST, TDB_PATH_STATIONS, TDBAbortParsing(), tdbName, and tdbPaths.
Referenced by ParseOptions().
| char* TDBPath | ( | int | p, | |
| char * | s | |||
| ) |
path name based on TDB information
| p | the path to return the station we are working on, may be NULL |
Definition at line 299 of file tdb.c.
References PrintError, TDB_PATH_LAST, TDB_PATH_SENSORLIST, tdbName, and tdbPaths.
Referenced by GetExtraTcorr(), GetFrameSkip(), GetInterpolatedShift(), MakeDtFileName(), and ReadSensorList().
| int TDBUpdateHeader | ( | struct InfoHeaderType * | h | ) |
overwrite header information with TDB information
| h | the information header to change |
Definition at line 725 of file tdb.c.
References Titan2SRType::base, InfoHeaderType::ch, InfoHeaderType::channel, ChannelName(), InfoHeaderType::correctedTime, Titan2SRType::div, InfoHeaderType::location, InfoHeaderType::network, PrintDebug, PrintError, PrintStation(), InfoHeaderType::sr, InfoHeaderType::station, TDBGetChannel(), and time2str().
Referenced by UpdateInfoHeader().
| char* confKeyWord[] = { "dt", "dft", "tc", "stations", NULL } |
| struct SensorType sensorEntry[MAX_SENSOR_NUMBER] |
Initial value:
{
{ "STS1", "LP", 0, -1. },
{ "STS2", "LP", 0, -1. },
{ "STS2L", "LP", 0, -1. },
{ "STS1P", "MP", 0, -1. },
{ "STS2P", "MP", 0, -1. },
{ "STS2LP", "MP", 0, -1. },
{ "CMG5", "ACC", 0, -1. },
{ "CMG5HP", "ACC", 0, -1. },
{ "CMG3T", "LP", 0, -1. },
{ "CMG3E", "LP", 0, -1. },
{ "CMG40T", "LP", 0, -1. },
{ "EST", "ACC", 0, -1. },
{ "LE3D1S", "CP", 0, -1. },
{ "LE3D5S", "CP", 0, -1. },
{ "LE3D20S", "LP", 0, -1. },
{ "L22", "CP", 0, -1. },
{ "L4C", "CP", 0, -1. },
{ "SDJ", "CP", 0, -1. },
{ "SDJ5S", "CP", 0, -1. },
{ "", "", 0, -1. }
}
| char** tdbPaths = NULL |
| struct StationType* tdbStation = NULL |
1.5.6