sac.c File Reference

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <string.h>
#include <assert.h>
#include <sys/types.h>
#include "common.h"

Include dependency graph for sac.c:

Go to the source code of this file.

Defines

#define IREAL   0
#define ITIME   1
#define IRLIM   2
#define IAMPH   3
#define IXY   4
#define IUNKN   5
#define IDISP   6
#define IVEL   7
#define IACC   8
#define IB   9
#define IDAY   10
#define IO   11
#define IA   12
#define IT0   13
#define IT1   14
#define IT2   15
#define IT3   16
#define IT4   17
#define IT5   18
#define IT6   19
#define IT7   20
#define IT8   21
#define IT9   22
#define IRADNV   23
#define ITANNV   24
#define IRADEV   25
#define ITANEV   26
#define INORTH   27
#define IEAST   28
#define IHORZA   29
#define IDOWN   30
#define IUP   31
#define ILLLBB   32
#define IWWSN1   33
#define IWWSN2   34
#define IHGLP   35
#define ISRO   36
#define INUCL   37
#define IPREN   38
#define IPOSTN   39
#define IQUAKE   40
#define IPREQ   41
#define IPOSTQ   42
#define ICHEM   43
#define IOTHER   44
#define IGOOD   45
#define IGLCH   46
#define IDROP   47
#define ILOWSN   48
#define IRLDTA   49
#define IVOLTS   50
#define INIV51   51
#define INIV52   52
#define INIV53   53
#define INIV54   54
#define INIV55   55
#define INIV56   56
#define INIV57   57
#define INIV58   58
#define INIV59   59
#define INIV60   60

Functions

double sac2unix (struct sac *sac0)
void unix2sac (struct sac *sac0, double temps)
int32_t defsack (char *field)
FILE * OpenSacChannel (int channel)
 open a sac file for output
void CloseSacFile (int channel)
 end a SAC channel file The sac header is updated according to the previous information structure
void AbortSacFile (int channel)
 cancel a SAC channel file
void AddSacData (int channel)
 process one channel
void SetSource (float lat, float lon, float dep, double OT)
 set the source location

Variables

struct sac sacHeader [MAX_CHANNEL]
FILE * sacChannelFile [MAX_CHANNEL]
char sacChannelFileName [MAX_CHANNEL][128]


Define Documentation

#define IA   12

Definition at line 128 of file sac.c.

#define IACC   8

Definition at line 124 of file sac.c.

#define IAMPH   3

Definition at line 119 of file sac.c.

#define IB   9

Definition at line 125 of file sac.c.

Referenced by OpenSacChannel().

#define ICHEM   43

Definition at line 159 of file sac.c.

#define IDAY   10

Definition at line 126 of file sac.c.

#define IDISP   6

Definition at line 122 of file sac.c.

#define IDOWN   30

Definition at line 146 of file sac.c.

#define IDROP   47

Definition at line 163 of file sac.c.

#define IEAST   28

Definition at line 144 of file sac.c.

#define IGLCH   46

Definition at line 162 of file sac.c.

#define IGOOD   45

Definition at line 161 of file sac.c.

#define IHGLP   35

Definition at line 151 of file sac.c.

#define IHORZA   29

Definition at line 145 of file sac.c.

#define ILLLBB   32

Definition at line 148 of file sac.c.

#define ILOWSN   48

Definition at line 164 of file sac.c.

#define INIV51   51

Definition at line 167 of file sac.c.

#define INIV52   52

Definition at line 168 of file sac.c.

#define INIV53   53

Definition at line 169 of file sac.c.

#define INIV54   54

Definition at line 170 of file sac.c.

#define INIV55   55

Definition at line 171 of file sac.c.

#define INIV56   56

Definition at line 172 of file sac.c.

#define INIV57   57

Definition at line 173 of file sac.c.

#define INIV58   58

Definition at line 174 of file sac.c.

#define INIV59   59

Definition at line 175 of file sac.c.

#define INIV60   60

Definition at line 176 of file sac.c.

#define INORTH   27

Definition at line 143 of file sac.c.

#define INUCL   37

Definition at line 153 of file sac.c.

#define IO   11

Definition at line 127 of file sac.c.

#define IOTHER   44

Definition at line 160 of file sac.c.

#define IPOSTN   39

Definition at line 155 of file sac.c.

#define IPOSTQ   42

Definition at line 158 of file sac.c.

#define IPREN   38

Definition at line 154 of file sac.c.

#define IPREQ   41

Definition at line 157 of file sac.c.

#define IQUAKE   40

Definition at line 156 of file sac.c.

#define IRADEV   25

Definition at line 141 of file sac.c.

#define IRADNV   23

Definition at line 139 of file sac.c.

#define IREAL   0

Definition at line 116 of file sac.c.

#define IRLDTA   49

Definition at line 165 of file sac.c.

#define IRLIM   2

Definition at line 118 of file sac.c.

#define ISRO   36

Definition at line 152 of file sac.c.

#define IT0   13

Definition at line 129 of file sac.c.

#define IT1   14

Definition at line 130 of file sac.c.

#define IT2   15

Definition at line 131 of file sac.c.

#define IT3   16

Definition at line 132 of file sac.c.

#define IT4   17

Definition at line 133 of file sac.c.

#define IT5   18

Definition at line 134 of file sac.c.

#define IT6   19

Definition at line 135 of file sac.c.

#define IT7   20

Definition at line 136 of file sac.c.

#define IT8   21

Definition at line 137 of file sac.c.

#define IT9   22

Definition at line 138 of file sac.c.

#define ITANEV   26

Definition at line 142 of file sac.c.

#define ITANNV   24

Definition at line 140 of file sac.c.

#define ITIME   1

Definition at line 117 of file sac.c.

Referenced by OpenSacChannel().

#define IUNKN   5

Definition at line 121 of file sac.c.

Referenced by sac2unix().

#define IUP   31

Definition at line 147 of file sac.c.

#define IVEL   7

Definition at line 123 of file sac.c.

#define IVOLTS   50

Definition at line 166 of file sac.c.

#define IWWSN1   33

Definition at line 149 of file sac.c.

#define IWWSN2   34

Definition at line 150 of file sac.c.

#define IXY   4

Definition at line 120 of file sac.c.


Function Documentation

void AbortSacFile ( int  channel  ) 

cancel a SAC channel file

Parameters:
channel the channel to cancel

Definition at line 328 of file sac.c.

References PrintDebug, sacChannelFile, and sacChannelFileName.

Referenced by AddSacData().

void AddSacData ( int  channel  ) 

process one channel

Parameters:
channel the channel to process

Definition at line 341 of file sac.c.

References AbortSacFile(), currentFile, currentTime, HWConfigType::data, HWConfig, infoHeader, noWrite, InfoHeaderType::npts, Titan2SRType::npts, OpenSacChannel(), PrintError, PrintLog, privateDebug, sacChannelFile, sacChannelFileName, sacHeader, HWConfigType::srExp, HWConfigType::srObs, StrTime(), test0, and titan2File.

Referenced by EndSuperFrame().

Here is the call graph for this function:

void CloseSacFile ( int  channel  ) 

end a SAC channel file The sac header is updated according to the previous information structure

Parameters:
channel the channel to close

Definition at line 273 of file sac.c.

References HWConfigType::avgPos, Titan2SRType::base, InfoHeaderType::correctedTime, PositionType::elev, FileName(), fileNameOptions, infoHeader, PositionType::lat, PositionType::lon, noWrite, oldHWConfig, PrintLog, Rename(), sacChannelFile, sacChannelFileName, sacHeader, InfoHeaderType::sr, station, unix2sac(), and UpdateInfoHeader().

Referenced by FlushDataFiles().

Here is the call graph for this function:

int32_t defsack ( char *  field  ) 

Definition at line 222 of file sac.c.

FILE* OpenSacChannel ( int  channel  ) 

open a sac file for output

Parameters:
channel the channel number
Returns:
the correponding FILE* pointer, NULL on error

Definition at line 233 of file sac.c.

References Titan2SRType::base, Titan2SRType::div, FILE_BUFFER_SIZE, HWConfig, IB, InitInfoHeader(), ITIME, OpenTempFile(), PrintError, sacChannelFile, sacChannelFileName, sacHeader, and HWConfigType::srExp.

Referenced by AddSacData().

Here is the call graph for this function:

double sac2unix ( struct sac *  sac0  ) 

Definition at line 178 of file sac.c.

References IUNKN, and PrintError.

void SetSource ( float  lat,
float  lon,
float  dep,
double  OT 
)

set the source location

Parameters:
lat latitude
lon longitide
dep depth
OT origin time

Definition at line 409 of file sac.c.

void unix2sac ( struct sac *  sac0,
double  temps 
)

Definition at line 208 of file sac.c.

References PrintError.

Referenced by CloseSacFile().


Variable Documentation

FILE* sacChannelFile[MAX_CHANNEL]

Initial value:

 {
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
        NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
}

Definition at line 68 of file sac.c.

Referenced by AbortSacFile(), AddSacData(), CloseSacFile(), and OpenSacChannel().

char sacChannelFileName[MAX_CHANNEL][128]

Definition at line 75 of file sac.c.

Referenced by AbortSacFile(), AddSacData(), CloseSacFile(), and OpenSacChannel().

struct sac sacHeader[MAX_CHANNEL]

Definition at line 67 of file sac.c.

Referenced by AddSacData(), CloseSacFile(), and OpenSacChannel().


Generated on Tue Jul 22 23:11:57 2008 for Titan2Reader by  doxygen 1.5.6