from edu.sc.seis.sod.process.waveform import WaveformProcess, WaveformResult
from edu.iris.Fissures.seismogramDC import LocalSeismogramImpl
import edu.sc.seis.sod.status
from  edu.sc.seis.sod.velocity.event import VelocityEvent
import sys , os
from jarray import array
from bag import *

class HelloSod(WaveformProcess):
    def __init__(self, config):
	pass

    def process( self,
		 event,
                 channel,
                 original,
                 available,
                 seismograms,
                 cookieJar):
	print "Hello Sod "
        vEvent = VelocityEvent(event)
	out = os.popen('../c02.histograms %s  /Users/usarray/cherries/sod-3.0beta1/seismograms /Users/usarray/cherries/sod-3.0beta1/seismograms /Users/usarray/cherries/sod-3.0beta1/PLOTS gfortran'%(vEvent.getTime('yyyyMMddHHmm'),), 'w')
        out.close()
	out = os.popen('pstopdf /Users/usarray/cherries/sod-3.0beta1/PLOTS/%s.histograms.ps /Users/usarray/cherries/sod-3.0beta1/PLOTS/%s.histograms.pdf'%(vEvent.getTime('yyyyMMddHHmm'),vEvent.getTime('yyyyMMddHHmm')), 'w')
        out.close()
	return WaveformResult(True, seismograms, self)
