00001 00002 /* 00003 * THIS FILE IS UNDER RCS - DO NOT MODIFY UNLESS YOU HAVE 00004 * CHECKED IT OUT USING THE COMMAND CHECKOUT. 00005 * 00006 * $Id: sacputaway_8h-source.html 2161 2006-05-19 16:55:03Z paulf $ 00007 * 00008 * Revision history: 00009 * $Log$ 00009 * Revision 1.1 2006/05/19 16:55:02 paulf 00009 * first inclusion 00009 * 00010 * Revision 1.3 2002/03/22 18:24:23 lucky 00011 * Changed prototype for SACPABase_init 00012 * 00013 * Revision 1.2 2001/08/07 16:48:37 lucky 00014 * Pre v6.0 checkin 00015 * 00016 * Revision 1.1 2001/04/12 03:06:13 lombard 00017 * Initial revision 00018 * 00019 * 00020 * 00021 */ 00022 00023 /* 00024 * This is sacputaway.h. It contains structures and function prototypes 00025 * for the SAC putaway routines. If you are looking for SAC header 00026 * information, see sachead.h 00027 */ 00028 00029 #ifndef SACPUTAWAY_h 00030 #define SACPUTAWAY_h 00031 00032 #include <earthworm.h> 00033 #include <sachead.h> 00034 00035 #if defined (_SPARC) 00036 # define SAC_DIFFERENT_PLATFORM "intel" 00037 #elif defined (_INTEL) 00038 # define SAC_DIFFERENT_PLATFORM "sparc" 00039 #endif 00040 00041 /* ERROR CONSTANTS 00042 *******************************/ 00043 #define SACPAB_ALREADY_INIT -4 00044 #define SACPAB_DIRECTORY_TOO_LONG -5 00045 #define SACPAB_NULL_POINTERS -6 00046 #define SACPAB_SCN_ALREADY_OPEN -7 00047 #define SACPAB_SCN_NOT_OPEN -8 00048 #define SACPAB_NOT_INIT -9 00049 #define SACPAB_FOPEN_FAILED -11 00050 #define SACPAB_OUTPUT_FORMAT_TOO_LONG -12 00051 00052 /* Other CONSTANTS 00053 *******************************/ 00054 #define MAXTXT 150 00055 #define MIN_OUTBUFFER_LEN 32000 00056 00057 #define SAC_MAX_POLES_OR_ZEROES 100 00058 00059 /* constant to denote whether we are saving a P or S wave*/ 00060 #define PWAVE 123 00061 #define SWAVE 456 00062 00063 00064 typedef struct _SAC_PZNum 00065 { 00066 double dReal; 00067 double dImag; 00068 } SAC_PZNum; 00069 00070 typedef struct _SAC_ResponseStruct 00071 { 00072 double dGain; 00073 int iNumPoles; 00074 int iNumZeroes; 00075 SAC_PZNum Poles[SAC_MAX_POLES_OR_ZEROES]; 00076 SAC_PZNum Zeroes[SAC_MAX_POLES_OR_ZEROES]; 00077 } SAC_ResponseStruct; 00078 00081 typedef struct _SACFileList 00082 { 00083 char filename[MAXTXT]; /* Sac file name */ 00084 double sort_param; /* sort parameter - starttime */ 00085 } SACFileListStruct; 00086 00087 typedef struct _SAC_OriginStruct 00088 { 00089 double dLat; /* ->evla */ 00090 double dLon; /* ->evlo */ 00091 double dElev; /* ->evel */ 00092 double tOrigin; /* ->o */ 00093 } SAC_OriginStruct; 00094 00095 typedef struct _SAC_ArrivalStruct 00096 { 00097 double tPhase; /* ->a */ 00098 char cPhase; /* ->ka[0] */ /* only P and S are supported by SAC */ 00099 double dCodaLen; /* ->f */ 00100 float dDist; /* ->dist */ 00101 float dAzm; /* ->az */ 00102 int iPhaseWt; /* ->ka[2] */ 00103 char cFMotion; /* ->ka[1] */ 00104 char cOnset; /* ->ka[3] */ 00105 } SAC_ArrivalStruct; 00106 00107 typedef struct _SAC_AmpPickStruct 00108 { 00109 int PickType; /* 0=zero-to-peak, 1=peak-to-peak */ 00110 double ZP_time; /* ->t0 */ 00111 double ZP_amp; /* ->user0 */ 00112 double PPmin_time;/* ->t1 */ 00113 double PPmax_time;/* ->t2 */ 00114 double PP_amp; /* ->user1 */ 00115 } SAC_AmpPickStruct; 00116 00117 typedef struct _SAC_StationStruct 00118 { 00119 float dLat; /* ->stla */ 00120 float dLon; /* ->stlo */ 00121 float dElev; /* ->stel */ 00122 int bResponseIsValid; 00123 SAC_ResponseStruct * pResponse; 00124 } SAC_StationStruct; 00125 00126 00127 /* Supports external (urban hazards) channel info */ 00128 typedef struct _SAC_ExtChanStruct 00129 { 00130 int iGain; /* user0 */ 00131 float dFullscale; /* user1 */ 00132 float dSensitivity; /* user2 */ 00133 float dDamping; /* user3 */ 00134 float dNaturalFrequency; /* user4 */ 00135 int iSensorType; /* user5 */ 00136 float tLastGPSLock; /* user6 */ 00137 float dAzm; /* cmpaz */ 00138 float dDip; /* cmpinc */ 00139 } SAC_ExtChanStruct; 00140 00141 00142 00143 00144 /************************************/ 00146 /************************************/ 00147 00148 /* SACPABase interface routines. 00149 These are the bottom layer routines 00150 that convert data into SAC format. 00151 *************************************/ 00152 int SACPABase_Debug(int); 00153 int SACPABase_SetOutputFormat(char *); 00154 int SACPABase_init(int, char *, int, char * ); 00155 int SACPABase_next_ev(char *, double, SAC_OriginStruct *); 00156 int SACPABase_next_ev_review (char *, int, SAC_OriginStruct *); 00157 int SACPABase_next_scn(char *, char *, char *); 00158 int SACPABase_write_trace(TRACE_REQ *, double); 00159 int SACPABase_write_parametric(SAC_ArrivalStruct *, int); 00160 int SACPABase_write_amppicks(SAC_AmpPickStruct *); 00161 int SACPABase_write_stainfo(SAC_StationStruct *); 00162 int SACPABase_write_extinfo(SAC_ExtChanStruct *); 00163 int SACPABase_end_scn (void); 00164 int SACPABase_end_ev (void); 00165 int SACPABase_close (void); 00166 00167 00168 00169 #endif