[cig-commits] r19600 - in seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS: lib seis_process
danielpeter at geodynamics.org
danielpeter at geodynamics.org
Tue Feb 7 13:24:08 PST 2012
Author: danielpeter
Date: 2012-02-07 13:24:07 -0800 (Tue, 07 Feb 2012)
New Revision: 19600
Added:
seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/Makefile
Modified:
seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/convolve_stf.c
seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/seis_process/ascii2sac.csh
Log:
adds Makefile to UTILS/lib; updates UTILS/seis_process/ascii2sac.csh script
Added: seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/Makefile
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/Makefile (rev 0)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/Makefile 2012-02-07 21:24:07 UTC (rev 19600)
@@ -0,0 +1,72 @@
+# Makefile
+
+#############################################################
+## modify to match your compiler defaults
+
+F90 = gfortran
+CC = gcc
+
+# modify to point to your own SAC installation path
+SAC_INC = /usr/local/sac/sac/include
+SAC_LIB = /usr/local/sac/sac/lib
+
+#############################################################
+
+# function library
+F90FLAGS = -O2
+CCFLAGS = -O2
+
+CSRC = rw_ascfile_c
+F90SRC = rw_ascfile_f
+
+F90OBJ_LIB = $(patsubst %,%.o,$(F90SRC))
+COBJ_LIB = $(patsubst %,%.o,$(CSRC))
+OBJ_LIB = $(F90OBJ_LIB) $(COBJ_LIB)
+
+#
+# program asc2sac
+#
+PROG = asc2sac
+
+SRCS = $(PROG).c
+OBJS = ${SRCS:%.c=%.o}
+
+CVS_INCDIR = $(SAC_INC) #formats
+CVS_LIBDIR = $(SAC_LIB) #formats
+
+INCS = -I$(CVS_INCDIR) -DSAC_NULL
+CFLAGS = $(INCS)
+LIBS = -L$(CVS_LIBDIR) -lsac -lsacio -lm #-lformats
+
+
+all : $(PROG)
+
+lib : $(OBJ_LIB)
+
+#
+# convolve_stf
+#
+convolve_stf: convolve_stf.c
+ $(CC) $(CFLAGS) -o convolve_stf convolve_stf.c $(LIBS)
+
+#
+# program asc2sac
+#
+$(PROG): $(OBJS)
+ $(CC) $(CFLAGS) -o $(PROG) $(OBJS) $(LIBS)
+
+#
+# library routines
+#
+$(F90OBJ_LIB) : %.o : %.f90
+ $(F90) $(F90FLAGS) -c $*.f90
+
+$(COBJ_LIB): %.o : %.c
+ $(CC) $(CCFLAGS) -c $*.c
+
+
+clean:
+ \rm -f $(OBJS) *~ *.o $(PROG) $(OBJS) *~ core convolve_stf
+
+cleanall:
+ \rm -f $(OBJS) *.o *~ $(PROG) $(OBJS) *~ core convolve_stf
Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/convolve_stf.c
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/convolve_stf.c 2012-02-07 21:21:03 UTC (rev 19599)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/lib/convolve_stf.c 2012-02-07 21:24:07 UTC (rev 19600)
@@ -27,6 +27,7 @@
#include "sacio.h"
#include "config.h"
+double const Pi= M_PI; // or: = 4*atan(1);
/* defined in libsac */
void fft(float *xreal, float *ximag, sac_int_t n, sac_int_t idir);
@@ -217,7 +218,7 @@
printf("convolved by a gaussian function with hdur %f\n",hdur);
float alpha = 1. / hdur;
- float divisor = sqrt(pi);
+ float divisor = sqrt(Pi);
for (i=0; i<nstf; i++) {
float tao_i = fabs(i*dt - hstf);
stf[i] = alpha * exp(- alpha*alpha* tao_i*tao_i) / divisor;
Modified: seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/seis_process/ascii2sac.csh
===================================================================
--- seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/seis_process/ascii2sac.csh 2012-02-07 21:21:03 UTC (rev 19599)
+++ seismo/3D/SPECFEM3D_GLOBE/trunk/UTILS/seis_process/ascii2sac.csh 2012-02-07 21:24:07 UTC (rev 19600)
@@ -5,8 +5,23 @@
# uses `asc2sac` binary which can be compiled from UTILS/lib/asc2sac.c
# (requires SAC libraries for compilation)
+#############################################################
+## modify to match your location
+
+asc2sac_bin=/opt/seismo-util/bin/asc2sac
+
+#############################################################
+
foreach file ($*)
echo $file
- set nlines = `wc -l $file | awk '{print $1}'`
- /opt/seismo-util/bin/asc2sac $file $nlines $file.sac
+
+ # call depending on which version you use:
+ #
+ # seismo-util version by Brian
+ #set nlines = `wc -l $file | awk '{print $1}'`
+ #$asc2sac_bin $file $nlines $file.sac
+
+ # UTILS/lib version by Eh
+ $asc2sac_bin $file
+
end
More information about the CIG-COMMITS
mailing list