seed.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 <netinet/in.h>
#include "common.h"

Include dependency graph for seed.c:

Go to the source code of this file.

Defines

#define US2S   0.23283064365386962891e-9
#define FSDH_SIZE   48
#define BLOCKLEN   (1<<(9+seedBlockSizePowerOf2))
#define NETBO
#define ToNBOs(x)   htons(x)
#define ToNBOl(x)   htonl(x)
#define ToHBOs(x)   ntohs(x)
#define ToHBOl(x)   ntohl(x)
#define HEADEROFFSET   16

Functions

int ParseSeedOptions (char *cmd)
struct SeedTime * TimeToSeedTime (double T0, struct SeedTime *sd)
double SeedTimeToTime (struct SeedTime *sd)
void UpdateFSDH (struct FixedSeedDataHeader_b1000_b1001 *fsdh, int seq, int ndata, double CT, double correction, char *station, char *location, char *channel, char *network)
FILE * OpenMSeedChannel (int channel)
 open an mseed file for output
void CloseMSeedInt32File (int channel)
 end a mseed channel file for int32 format The mseed header is updated according to the previous information structure
void AbortMSeedFile (int channel)
 cancel a mseed channel file
void AddMSeedDataInt32 (int channel)
 process one channel in 32 bits format
void AddMSeedDataSteim1 (int channel)
 process one channel in steim1 format
void CloseMSeedSteim1File (int channel)
 steim1 compression
void CloseMSeedFile (int channel)
 process one channel
void AddMSeedData (int channel)
 process one channel

Variables

FILE * mseedChannelFile [MAX_CHANNEL]
char mseedChannelFileName [MAX_CHANNEL][128]
int seedDataFormat = 3
double staticDt [MAX_CHANNEL]


Define Documentation

#define BLOCKLEN   (1<<(9+seedBlockSizePowerOf2))

#define FSDH_SIZE   48

Definition at line 51 of file seed.c.

Referenced by UpdateFSDH().

#define HEADEROFFSET   16

Definition at line 121 of file seed.c.

Referenced by CloseMSeedSteim1File(), and UpdateFSDH().

#define NETBO

Definition at line 55 of file seed.c.

#define ToHBOl (  )     ntohl(x)

Definition at line 61 of file seed.c.

#define ToHBOs (  )     ntohs(x)

Definition at line 60 of file seed.c.

Referenced by SeedTimeToTime().

#define ToNBOl (  )     htonl(x)

Definition at line 59 of file seed.c.

Referenced by AddMSeedDataInt32(), CloseMSeedSteim1File(), and UpdateFSDH().

#define ToNBOs (  )     htons(x)

Definition at line 58 of file seed.c.

Referenced by AddMSeedDataInt32(), CloseMSeedSteim1File(), TimeToSeedTime(), and UpdateFSDH().

#define US2S   0.23283064365386962891e-9

Definition at line 49 of file seed.c.


Function Documentation

void AbortMSeedFile ( int  channel  ) 

cancel a mseed channel file

Parameters:
channel the channel to cancel

Definition at line 446 of file seed.c.

References mseedChannelFile, mseedChannelFileName, and PrintDebug.

void AddMSeedData ( int  channel  ) 

process one channel

Parameters:
channel the channel to append the sample

Definition at line 850 of file seed.c.

References ADCDelay(), AddMSeedDataInt32(), AddMSeedDataSteim1(), HWConfigType::digitizer, FilterDelayTime(), HWConfig, DigitizerType::ok, seedDataFormat, HWConfigType::srExp, and staticDt.

Referenced by EndSuperFrame().

Here is the call graph for this function:

void AddMSeedDataInt32 ( int  channel  ) 

void AddMSeedDataSteim1 ( int  channel  ) 

process one channel in steim1 format

Parameters:
channel the channel to append the sample

Definition at line 529 of file seed.c.

References Titan2SRType::base, currentTime, HWConfigType::data, Titan2SRType::div, HWConfig, infoHeader, mseedChannelFile, InfoHeaderType::npts, Titan2SRType::npts, OpenMSeedChannel(), PrimaryChannel(), PrintWarning, HWConfigType::srExp, HWConfigType::srObs, US2S, and Titan2TimeType::usecond.

Referenced by AddMSeedData().

Here is the call graph for this function:

void CloseMSeedFile ( int  channel  ) 

process one channel

Parameters:
channel the channel to close

Definition at line 835 of file seed.c.

References CloseMSeedInt32File(), CloseMSeedSteim1File(), and seedDataFormat.

Referenced by FlushDataFiles().

Here is the call graph for this function:

void CloseMSeedInt32File ( int  channel  ) 

end a mseed channel file for int32 format The mseed header is updated according to the previous information structure

Parameters:
channel the channel to close

Definition at line 348 of file seed.c.

References BLOCKLEN, InfoHeaderType::correctionMethod, FileName(), fileNameOptions, GetInterpolatedShift(), infoHeader, INTERPOLATION_CORRECTION, mseedChannelFile, mseedChannelFileName, NO_TIME_CORRECTION, noWrite, InfoHeaderType::npts, InfoHeaderType::otshift, PrintDebug, PrintLog, PrintWarning, Rename(), SeedTimeToTime(), staticDt, station, time2str(), UpdateFSDH(), and UpdateInfoHeader().

Referenced by CloseMSeedFile().

Here is the call graph for this function:

void CloseMSeedSteim1File ( int  channel  ) 

FILE* OpenMSeedChannel ( int  channel  ) 

open an mseed file for output

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

Definition at line 320 of file seed.c.

References ADD_LOCATION_CODE, ADD_NETWORK_CODE, FILE_BUFFER_SIZE, fileNameOptions, InitInfoHeader(), mseedChannelFile, mseedChannelFileName, OpenTempFile(), and PrintError.

Referenced by AddMSeedDataInt32(), and AddMSeedDataSteim1().

Here is the call graph for this function:

int ParseSeedOptions ( char *  cmd  ) 

Definition at line 123 of file seed.c.

References BLOCKLEN, PrintDebug, PrintError, seedBlockSizePowerOf2, and seedDataFormat.

Referenced by ParseOptions().

double SeedTimeToTime ( struct SeedTime *  sd  ) 

Definition at line 205 of file seed.c.

References ToHBOs.

Referenced by CloseMSeedInt32File().

struct SeedTime* TimeToSeedTime ( double  T0,
struct SeedTime *  sd 
) [read]

Definition at line 182 of file seed.c.

References ToNBOs.

Referenced by UpdateFSDH().

void UpdateFSDH ( struct FixedSeedDataHeader_b1000_b1001 *  fsdh,
int  seq,
int  ndata,
double  CT,
double  correction,
char *  station,
char *  location,
char *  channel,
char *  network 
)

Definition at line 219 of file seed.c.

References BLOCKLEN, FSDH_SIZE, HEADEROFFSET, seedBlockSizePowerOf2, seedDataFormat, TimeToSeedTime(), ToNBOl, and ToNBOs.

Referenced by AddMSeedDataInt32(), CloseMSeedInt32File(), and CloseMSeedSteim1File().

Here is the call graph for this function:


Variable Documentation

FILE* mseedChannelFile[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 35 of file seed.c.

Referenced by AbortMSeedFile(), AddMSeedDataInt32(), AddMSeedDataSteim1(), CloseMSeedInt32File(), CloseMSeedSteim1File(), and OpenMSeedChannel().

char mseedChannelFileName[MAX_CHANNEL][128]

Definition at line 42 of file seed.c.

Referenced by AbortMSeedFile(), CloseMSeedInt32File(), CloseMSeedSteim1File(), and OpenMSeedChannel().

int seedDataFormat = 3

Definition at line 45 of file seed.c.

Referenced by AddMSeedData(), CloseMSeedFile(), ParseSeedOptions(), and UpdateFSDH().

double staticDt[MAX_CHANNEL]

Definition at line 47 of file seed.c.

Referenced by AddMSeedData(), CloseMSeedInt32File(), and CloseMSeedSteim1File().


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