Main Page Class Hierarchy Compound List File List Compound Members File Members

# k2evt2ew.c File Reference

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <math.h>`
`#include <sys/types.h>`
`#include <time.h>`
`#include <earthworm.h>`
`#include <chron3.h>`
`#include <kom.h>`
`#include <swap.h>`
`#include <k2evt2ew.h>`

Go to the source code of this file.

## Defines
#define | PACKET_MAX_SIZE 3003
#define | GRAVITY 978.03
#define | SWAP(a, b) temp=(a);(a)=(b);(b)=temp
#define | DECADE 315532800
## Functions
int | read_tag (FILE *fp, KFF_TAG *)
int | read_head (FILE *fp, MW_HEADER *, int tagLength)
int | read_frame (FILE *fp, FRAME_HEADER *, unsigned long *channels)
int | extract (int pktdatalen, const unsigned char *pktbuff, float *Data, long *Counts, float scale, int nchan, int jchan, int *ind)
int | peak_ground (float *Data, int npts, int itype, float dt, SM_INFO *sm)
void | demean (float *A, int N)
void | locut (float *s, int nd, float fcut, float delt, int nroll, int icaus)
void | rdrvaa (float *acc, int na, float omega, float damp, float dt, float *rd, float *rv, float *aa)
void | amaxper (int npts, float dt, float *fc, float *amaxmm, float *aminmm, float *pmax, int *imin, int *imax)
int | k2evt2ew (FILE *fp, char *fname, K2InfoStruct *pk2info, CHANNELNAME *pChanName, int numChans, char *NetCode, int Debug)
## Variables
int | K2EW_Debug

## Define Documentation

#define DECADE 315532800

| Definition at line 39 of file k2evt2ew.c.

#define GRAVITY 978.03

| Definition at line 37 of file k2evt2ew.c. Referenced by k2evt2ew().

#define PACKET_MAX_SIZE 3003

| Definition at line 36 of file k2evt2ew.c. Referenced by k2evt2ew().

#define SWAP | ( | a,
|  | b |  | ) | temp=(a);(a)=(b);(b)=temp

| Definition at line 38 of file k2evt2ew.c.

## Function Documentation

void amaxper | ( | int | npts,
|  | float | dt,
|  | float * | fc,
|  | float * | amaxmm,
|  | float * | aminmm,
|  | float * | pmax,
|  | int * | imin,
|  | int * | imax
| ) |

| Definition at line 1103 of file k2evt2ew.c. Referenced by peak_ground().

void demean | ( | float * | A,
|  | int | N
| ) |

| Definition at line 919 of file k2evt2ew.c. Referenced by peak_ground().

int extract | ( | int | pktdatalen,
|  | const unsigned char * | pktbuff,
|  | float * | Data,
|  | long * | Counts,
|  | float | scale,
|  | int | nchan,
|  | int | jchan,
|  | int * | ind
| ) |

| Definition at line 716 of file k2evt2ew.c. References SwapLong(). Referenced by k2evt2ew().

int k2evt2ew | ( | FILE * | fp,
|  | char * | fname,
|  | K2InfoStruct * | pk2info,
|  | CHANNELNAME * | pChanName,
|  | int | numChans,
|  | char * | NetCode,
|  | int | Debug
| ) |

| Definition at line 85 of file k2evt2ew.c. References _SM_INFO::altcode, CHANNEL_RW_PARMS::azimuth, RW_MW_PARMS::channel, MISC_RW_PARMS::comment, _SM_INFO::comp, _k2info::Counts, _k2info::Databuf, KFF_TAG::dataLength, STREAM_RO_PARMS::duration, EW_FAILURE, EW_SUCCESS, extract(), STREAM_RO_PARMS::flags, _k2info::frame, CHANNEL_RW_PARMS::fullscale, GRAVITY, _k2info::head, K2EW_Debug, KFF_TAG::length, _SM_INFO::loc, logit(), MAXTRACELTH, RW_MW_PARMS::misc, MISC_RW_PARMS::nchannels, _SM_INFO::net, _k2info::numDataPoints, PACKET_MAX_SIZE, peak_ground(), read_frame(), read_head(), read_tag(), MW_HEADER::roParms, MW_HEADER::rwParms, CHANNEL_RW_PARMS::sensitivity, SENSOR_ACCELERATION, SENSOR_EPI, SENSOR_FBA11, SENSOR_FBA23, SENSOR_MARKL22, SENSOR_MARKL4C, SENSOR_VELOCITY, CHANNEL_RW_PARMS::sensorType, MISC_RW_PARMS::serialNumber, _k2info::sm, SM_ALTCODE_RECEIVING_MODULE, _SM_INFO::sta, STREAM_RO_PARMS::startTime, STREAM_RO_PARMS::startTimeMsec, MISC_RW_PARMS::stnID, RO_MW_PARMS::stream, _SM_INFO::t, _k2info::tag, _SM_INFO::talt, STREAM_RO_PARMS::triggerTime, and STREAM_RO_PARMS::triggerTimeMsec.

void locut | ( | float * | s,
|  | int | nd,
|  | float | fcut,
|  | float | delt,
|  | int | nroll,
|  | int | icaus
| ) |

| Definition at line 961 of file k2evt2ew.c. Referenced by peak_ground().

int peak_ground | ( | float * | Data,
|  | int | npts,
|  | int | itype,
|  | float | dt,
|  | SM_INFO * | sm
| ) |

| Definition at line 767 of file k2evt2ew.c. References amaxper(), demean(), id, locut(), MAXTRACELTH, _SM_INFO::nrsa, _SM_INFO::pdrsa, _SM_INFO::pga, _SM_INFO::pgd, _SM_INFO::pgv, rdrvaa(), _SM_INFO::rsa, _SM_INFO::t, _SM_INFO::tpga, _SM_INFO::tpgd, and _SM_INFO::tpgv. Referenced by k2evt2ew().

void rdrvaa | ( | float * | acc,
|  | int | na,
|  | float | omega,
|  | float | damp,
|  | float | dt,
|  | float * | rd,
|  | float * | rv,
|  | float * | aa
| ) |

| Definition at line 1042 of file k2evt2ew.c. Referenced by peak_ground().

int read_frame | ( | FILE * | fp,
|  | FRAME_HEADER * | ,
|  | unsigned long * | channels
| ) | `[static]`

| Definition at line 643 of file k2evt2ew.c. References FRAME_HEADER::blockTime, FRAME_HEADER::blockTime2, FRAME_HEADER::channelBitMap, FRAME_HEADER::channelBitMap1, EW_FAILURE, EW_SUCCESS, FRAME_HEADER::frameSize, FRAME_HEADER::frameStatus, FRAME_HEADER::frameStatus2, FRAME_HEADER::frameType, FRAME_HEADER::instrumentCode, K2EW_Debug, logit(), FRAME_HEADER::msec, FRAME_HEADER::recorderID, FRAME_HEADER::streamPar, and SwapShort(). Referenced by k2evt2ew().

int read_head | ( | FILE * | fp,
|  | MW_HEADER * | ,
|  | int | tagLength
| ) | `[static]`

| Definition at line 306 of file k2evt2ew.c. References MISC_RO_PARMS::a2dBits, TIMING_RO_PARMS::acqDelay, CHANNEL_RW_PARMS::alarmTriggerThreshold, CHANNEL_RW_PARMS::altitude, MISC_RO_PARMS::appBlkVersion, STREAM_MW_RW_PARMS::apw, CHANNEL_RO_PARMS::aqOffset, CHANNEL_RW_PARMS::azimuth, MISC_RO_PARMS::batteryVoltage, MISC_RO_PARMS::bootBlkVersion, STREAM_MW_RW_PARMS::BufferSize, RW_MW_PARMS::channel, RO_MW_PARMS::channel, MISC_RW_PARMS::channel_bitmap, TIMING_RO_PARMS::clockSource, MISC_RW_PARMS::comment, MISC_RO_PARMS::crc, MISC_RW_PARMS::cutler_bitmap, MISC_RW_PARMS::cutler_decimation, MISC_RW_PARMS::cutler_irig_type, MISC_RW_PARMS::cutler_protocol, MISC_RW_PARMS::cutlerCode, TIMING_RO_PARMS::dacCount, CHANNEL_RW_PARMS::damping, STREAM_MW_RW_PARMS::DataFmt, CHANNEL_RW_PARMS::detriggerThreshold, MISC_RO_PARMS::dspBlkVersion, STREAM_RO_PARMS::duration, CHANNEL_RW_PARMS::east, MISC_RW_PARMS::elevation, STREAM_RO_PARMS::errors, STREAM_MW_RW_PARMS::eventNumber, EW_FAILURE, EW_SUCCESS, MISC_RW_PARMS::externalTrigger, STREAM_MW_RW_PARMS::filterFlag, STREAM_MW_RW_PARMS::FilterType, STREAM_RO_PARMS::flags, MISC_RO_PARMS::flags, CHANNEL_RW_PARMS::fullscale, CHANNEL_RW_PARMS::gain, TIMING_RO_PARMS::gpsAltitude, TIMING_RO_PARMS::gpsLastDrift, TIMING_RO_PARMS::gpsLastLockTime, TIMING_RO_PARMS::gpsLastTurnOnTime, TIMING_RO_PARMS::gpsLastUpdateTime, TIMING_RO_PARMS::gpsLatitude, TIMING_RO_PARMS::gpsLockFailCount, TIMING_RO_PARMS::gpsLongitude, TIMING_RW_PARMS::gpsMaxTurnOnTime, TIMING_RO_PARMS::gpsSOH, TIMING_RO_PARMS::gpsStatus, TIMING_RW_PARMS::gpsTurnOnInterval, TIMING_RO_PARMS::gpsUpdateRTCCount, RO_MW_PARMS::headerBytes, RO_MW_PARMS::headerVersion, CHANNEL_RW_PARMS::id, RO_MW_PARMS::id, CHANNEL_RW_PARMS::iirTriggerFilter, MISC_RO_PARMS::installedChan, RO_MW_PARMS::instrumentCode, K2EW_Debug, MISC_RW_PARMS::latitude, TIMING_RW_PARMS::localOffset, logit(), MISC_RW_PARMS::longitude, CHANNEL_RW_PARMS::LtaSeconds, MAX_K2_CHANNELS, MAX_MW_CHANNELS, MISC_RO_PARMS::maxChannels, CHANNEL_RO_PARMS::maxPeak, CHANNEL_RO_PARMS::maxPeakOffset, CHANNEL_RO_PARMS::mean, MISC_RW_PARMS::minBatteryVoltage, CHANNEL_RO_PARMS::minPeak, CHANNEL_RO_PARMS::minPeakOffset, STREAM_MW_RW_PARMS::minRunTime, RW_MW_PARMS::misc, RO_MW_PARMS::misc, RW_MW_PARMS::modem, CHANNEL_RW_PARMS::naturalFrequency, MISC_RW_PARMS::nchannels, MISC_RW_PARMS::networkFlag, CHANNEL_RW_PARMS::north, STREAM_RO_PARMS::nscans, STREAM_MW_RW_PARMS::postEvent, STREAM_MW_RW_PARMS::preEvent, STREAM_MW_RW_PARMS::primaryStorage, MISC_RO_PARMS::restartSource, MW_HEADER::roParms, MW_HEADER::rwParms, MISC_RO_PARMS::sampleBytes, STREAM_MW_RW_PARMS::SampleRate, STREAM_MW_RW_PARMS::secondaryStorage, CHANNEL_RW_PARMS::sensitivity, CHANNEL_RW_PARMS::sensorSerialNumber, CHANNEL_RW_PARMS::sensorSerialNumberExt, CHANNEL_RW_PARMS::sensorType, MISC_RW_PARMS::serialNumber, MISC_RW_PARMS::siteID, STREAM_MW_RW_PARMS::sps, CHANNEL_RW_PARMS::StaLtaPercent, CHANNEL_RW_PARMS::StaLtaRatio, STREAM_RO_PARMS::startTime, STREAM_RO_PARMS::startTimeMsec, CHANNEL_RW_PARMS::StaSeconds, MISC_RW_PARMS::stnID, RW_MW_PARMS::stream, RO_MW_PARMS::stream, SwapFloat(), SwapLong(), SwapShort(), MISC_RO_PARMS::sysBlkVersion, MISC_RO_PARMS::temperature, STREAM_MW_RW_PARMS::Timeout, RW_MW_PARMS::timing, RO_MW_PARMS::timing, CHANNEL_RW_PARMS::triggerThreshold, STREAM_RO_PARMS::triggerTime, STREAM_RO_PARMS::triggerTimeMsec, CHANNEL_RW_PARMS::triggerType, STREAM_MW_RW_PARMS::TxBlkSize, STREAM_MW_RW_PARMS::TxChanMap, CHANNEL_RW_PARMS::up, MISC_RW_PARMS::userCodes, STREAM_MW_RW_PARMS::VotesToDetrigger, and STREAM_MW_RW_PARMS::VotesToTrigger. Referenced by k2evt2ew().

int read_tag | ( | FILE * | fp,
|  | KFF_TAG * |
| ) | `[static]`

| Definition at line 266 of file k2evt2ew.c. References KFF_TAG::byteOrder, KFF_TAG::checksum, KFF_TAG::dataLength, EW_FAILURE, EW_SUCCESS, KFF_TAG::id, KFF_TAG::instrumentType, K2EW_Debug, KFF_TAG::length, logit(), SwapLong(), SwapShort(), KFF_TAG::sync, KFF_TAG::type, and KFF_TAG::version. Referenced by k2evt2ew().

## Variable Documentation

int K2EW_Debug`[static]`

| Definition at line 43 of file k2evt2ew.c. Referenced by k2evt2ew(), read_frame(), read_head(), and read_tag().