Ignore:
Timestamp:
06/13/19 15:31:08 (3 months ago)
Author:
kevin
Message:

Added Arias Intensity and ColorPGA option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/seismic_processing/gmew/gm_util.c

    r7593 r8019  
    7272#include "gm_xml.h" 
    7373#include "../localmag/lm_site.h" 
     74 
     75#define GRAVITY 980.665 /* G cm/s/s  */ 
    7476 
    7577/* Standard Spectral Response periods and damping value */ 
     
    744746} 
    745747 
     748/* calcAriasIntensity: Calculate the AI (Arias Intensity) from acceleration data. 
     749*/ 
     750double calcAriasIntensity(double delta, double *acc, int acclen) 
     751{ 
     752  int i; 
     753  double acc_value, ai, sum = 0.; 
     754  // integrate acceleration squared 
     755  for (i = 0; i < acclen; i++) 
     756  { 
     757    acc_value = acc[i]; 
     758    // square the acceleration 
     759    acc_value *= acc_value; 
     760    if (i == 0 || i == acclen - 1) 
     761      sum += acc_value; 
     762    else 
     763      sum += 2. * acc_value; 
     764  } 
     765  sum *= (delta/2.); 
     766  ai = sum; 
     767  ai *= (M_PI / (2. * GRAVITY)); 
     768  return ai; 
     769} 
     770 
    746771/* getPeakGM: Find the maximum absolute values of acceleration, velocity, 
    747772 *            displacement and Spectra Response from the processed data. 
     
    867892  pSms->nrsa = NSP; 
    868893   
     894  if (pgmParams->ariasIntensity) 
     895  { 
     896     pSms->ai = calcAriasIntensity(pTrace->delta, acc, pTrace->lenProc); 
     897  } 
     898 
    869899  /* Write some XML */ 
    870900  if (pgmParams->XMLDir && strlen(pgmParams->XMLDir) > 0) 
Note: See TracChangeset for help on using the changeset viewer.