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

parse_usnsn.h

Go to the documentation of this file.
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 $
00007  *
00008  *    Revision history:
00009  *     $Log$
00009  *     Revision 1.1  2006/05/19 16:55:02  paulf
00009  *     first inclusion
00009  *
00010  *     Revision 1.8  2002/03/22 19:53:47  lucky
00011  *     *** empty log message ***
00012  *
00013  *     Revision 1.7  2001/07/01 22:16:07  davidk
00014  *     Added include of earthworm_defs.h.
00015  *     Oops, I guess that include of earthworm.h was neccessary.
00016  *
00017  *     Revision 1.6  2001/07/01 22:08:14  davidk
00018  *     Removed unneccessary include of earthworm.h and added prototype for
00019  *     ParseNSNMsg().
00020  *
00021  *     Revision 1.5  2000/10/02 21:28:23  lucky
00022  *     set lengths of sta and phase in PhaseStruct to #defines STA_LEN and PHA_LEN
00023  *
00024  *     Revision 1.4  2000/09/12 18:14:15  lucky
00025  *     Explicitly set size of phases (max number of phases in the DB)
00026  *
00027  *     Revision 1.2  2000/06/26 20:03:41  lucky
00028  *     Added RETURN_DELETE flag so that parse_usnsn can signal back to the
00029  *     calling routine that it encountered a delete message.
00030  *
00031  *     Revision 1.1  2000/02/14 20:05:54  lucky
00032  *     Initial revision
00033  *
00034  *
00035  */
00036 
00037 
00038 #include <earthworm_defs.h>
00039 
00040 
00041 #define         DATE_BASE                   5
00042 #define         DEPTH_BASE                  25
00043 #define         EVENT_KEY_BASE          52
00044 #define         PRELIM_BASE                 61
00045 #define         ELLIPSE_BASE            22
00046 #define         ELLIPSE_LENGTH          53
00047 #define     EARTH_CIRCUM        40000.0
00048 
00049 /* magnitudes */
00050 #define     MAG_LEN     5
00051 #define     DATUM_LEN   3
00052 #define     MB_BASE     5
00053 #define     MB_DATUM    11
00054 #define     ML_BASE     21
00055 #define     ML_DATUM    27
00056 #define     MBLG_BASE   39
00057 #define     MBLG_DATUM  45
00058 #define     MD_BASE     55
00059 #define     MD_DATUM    61
00060 #define     MS_BASE     71
00061 #define     MS_DATUM    77
00062 
00063 /* phases */
00064 #define         STA_BASE        1
00065 #define         STA_LEN         5
00066 #define         PHA_BASE        6
00067 #define         PHA_LEN         8
00068 #define         OT_BASE         14
00069 #define         OT_LEN          11
00070 #define         RES_BASE        25
00071 #define         RES_LEN         6
00072 #define         RES_USED        31
00073 #define         DIST_BASE       32
00074 #define         DIST_LEN    6
00075 #define         AZM_BASE        39
00076 #define         AZM_LEN         3
00077 #define         MAG1_BASE       43
00078 #define         MAG1_LEN        15
00079 #define         MAG1_USED       58
00080 #define         MAG2_BASE       60
00081 #define         MAG2_LEN        15
00082 #define         MAG2_USED       75
00083 
00084 
00085 #define RETURN_DELETE -100
00086 
00087 # define RETURN_BAD_SCN -3
00088 
00089 #ifndef RETURN_SUCCESS
00090 # define RETURN_SUCCESS 0
00091 # define RETURN_FAILURE -1
00092 #endif /* !DEF RETURN_SUCCESS */
00093 
00094 #define MAX_MAGS        5
00095 
00096 /* Structures */
00097 typedef struct _PhaseMag
00098 {
00099 
00100         int             MagType;                /* see rw_mag.h */
00101         char    magLabel;               /* b, S, d, L, g */
00102         double  value;
00103         double  period;
00104         double  mag;
00105         int             used;
00106 
00107 } PhaseMag;
00108 
00109 
00110 typedef struct _PhaseStruct
00111 {
00112         char            sta[STA_LEN+1];
00113         char            phase[PHA_LEN+1];
00114         int                     automatic;
00115         char            onset;
00116         char            motion;
00117         double          ot;
00118         double          res;
00119         int                     res_used;               /* is this phase used? */
00120         double          dist;
00121         int                     azm;
00122         int                     num_mags;
00123         PhaseMag        mag[5];                 /* magnitudes */
00124 
00125 } Phase;
00126 
00127 typedef struct _OriginMag
00128 {
00129 
00130         int             MagType;                /* see rw_mag.h */
00131         char    magLabel;               /* b, S, d, L, g */
00132         double  magAvg;
00133         int             numStas;
00134         int             isPref;                 /* Is this the preferred mag */
00135 
00136 } OriginMag;
00137 
00138 typedef struct _ErrorElipse
00139 {
00140 
00141         double          maj_s;          /* Semi-major axis - strike */
00142         double          maj_d;          /* Semi-major axis - dip    */
00143         double          maj_l;          /* Semi-major axis - length */
00144 
00145         double          min_s;          /* Semi-minor axis - strike */
00146         double          min_d;          /* Semi-minor axis - dip    */
00147         double          min_l;          /* Semi-minor axis - length */
00148 
00149         double          int_s;          /* Intermediate axis - strike */
00150         double          int_d;          /* Intermediate axis - dip    */
00151         double          int_l;          /* Intermediate axis - length */
00152 
00153 } Err_Elipse;
00154 
00155 
00156 typedef struct _NSNMsgStruct
00157 {
00158 
00159         char            EventKey[6];
00160         char            EventDate[10];
00161         int                     automatic;              /* 1-yes, 0-no */
00162         double          ot;                             /* origin time, seconds since 1970 */
00163         double          ot_err;                 /* time error in seconds */
00164         float           lat;            /* origin lattitude, in degrees */
00165         float           lat_err;        /* origin lattitude error, in km */
00166         float           lon;            /* origin longitude, in degrees */
00167         float           lon_err;        /* origin longitude error, in km */
00168         float           depth;          /* depth, in km */
00169         float           depth_err;      /* depth error, in km */
00170         int                     depth_fixed;    /* 1-yes, 0-no */
00171         int                     nph_used;       /* num phases used */
00172         int                     nph_assoc;      /* num phases associated */
00173         int                     nph_actual;     /* acutal phases parsed and stored */
00174         double          Dmin;                   /* distance from epicenter to nearest station */
00175         double          std_error;      /* standard error - rms of residuals,  */
00176                                     /* in seconds                          */
00177         Err_Elipse  error;                      /* Error elipse - 9 values */
00178         int                     numMags;                /* Number of magnitudes for the event */
00179         OriginMag   O_mag[MAX_MAGS];/* Magnitudes for the event */
00180         Phase           phases[DB_MAX_PHS_PER_EQ];              /* Phases for the event */
00181 
00182 } NSNStruct;
00183 
00184 
00185 int ParseNSNMsg(char *NsnMsg, int msgLen, NSNStruct *msgStruct, 
00186                 int debug, char *debug_dir);
00187 
00188 

Generated on Tue May 6 09:16:07 2003 for Earthworm Libs by doxygen1.3-rc3