Ejemplo n.º 1
0
def detide(gaugeno):

    fname = '%s.txt' % gaugeno
    if gaugeno == 21401:
        t1fit = -12.*3600.
        t2fit = 36.*3600.
        t1out = 0.
        t2out = 12.*3600.
        degree = 15
    else:
        t1fit = -12.*3600.
        t2fit = 36.*3600.
        t1out = 0.
        t2out = 12.*3600.
        degree = 15

    fname_notide = os.path.splitext(fname)[0] + '_notide.txt'
    t,t_sec,eta = dart.plotdart(fname, t_quake)

    c,t_notide,eta_notide = dart.fit_tide_poly(t_sec,eta,degree,\
                               t1fit,t2fit, t1out,t2out)


    # fix bad data value:
    if gaugeno==21418:
        print "Bad data: ",eta_notide[121:124]
        eta_notide[122] = -0.075
        print "Fix data: ",eta_notide[121:124]
        print "Bad data: ",eta_notide[152:155]
        eta_notide[153] = -0.07
        print "Fix data: ",eta_notide[152:155]

    d = np.vstack([t_notide,eta_notide]).T
    pylab.savetxt(fname_notide,d)
    print "Created file ",fname_notide

    dart.plot_post_quake(t_notide,eta_notide,gaugeno)


    pylab.figure(70)
    pylab.subplot(211)
    pylab.title('DART %s' % gaugeno)

    if 0:
        pylab.figure(75)
        pylab.plot(t_notide,eta_notide,'k')
        pylab.xlim(0,3.*3600)
        pylab.ylim(-1,2)

    return t_notide, eta_notide
Ejemplo n.º 2
0
def detide(gaugeno):

    fname = '%s.txt' % gaugeno
    if gaugeno == 21401:
        t1fit = -12. * 3600.
        t2fit = 36. * 3600.
        t1out = 0.
        t2out = 12. * 3600.
        degree = 15
    else:
        t1fit = -12. * 3600.
        t2fit = 36. * 3600.
        t1out = 0.
        t2out = 12. * 3600.
        degree = 15

    fname_notide = os.path.splitext(fname)[0] + '_notide.txt'
    t, t_sec, eta = dart.plotdart(fname, t_quake)

    c,t_notide,eta_notide = dart.fit_tide_poly(t_sec,eta,degree,\
                               t1fit,t2fit, t1out,t2out)

    # fix bad data value:
    if gaugeno == 21418:
        print "Bad data: ", eta_notide[121:124]
        eta_notide[122] = -0.075
        print "Fix data: ", eta_notide[121:124]
        print "Bad data: ", eta_notide[152:155]
        eta_notide[153] = -0.07
        print "Fix data: ", eta_notide[152:155]

    d = np.vstack([t_notide, eta_notide]).T
    pylab.savetxt(fname_notide, d)
    print "Created file ", fname_notide

    dart.plot_post_quake(t_notide, eta_notide, gaugeno)

    pylab.figure(70)
    pylab.subplot(211)
    pylab.title('DART %s' % gaugeno)

    if 0:
        pylab.figure(75)
        pylab.plot(t_notide, eta_notide, 'k')
        pylab.xlim(0, 3. * 3600)
        pylab.ylim(-1, 2)

    return t_notide, eta_notide
Ejemplo n.º 3
0
def detide(gaugeno):

    fname = '%s.txt' % gaugeno
    if gaugeno == 21401:
        t1fit = -12.*3600.
        t2fit = 36.*3600.
        t1out = 0.
        t2out = 12.*3600.
        degree = 15
    else:
        t1fit = -12.*3600.
        t2fit = 36.*3600.
        t1out = 0.
        t2out = 12.*3600.
        degree = 15

    fname_notide = os.path.splitext(fname)[0] + '_notide.txt'
    t,t_sec,eta = dart.plotdart(fname, t_quake)

    c,t_notide,eta_notide = dart.fit_tide_poly(t_sec,eta,degree,\
                               t1fit,t2fit, t1out,t2out)


    # fix bad data value:
    if gaugeno==21418:
        print "Bad data: ",eta_notide[121:124]
        eta_notide[122] = -0.075
        print "Fix data: ",eta_notide[121:124]
        print "Bad data: ",eta_notide[152:155]
        eta_notide[153] = -0.07
        print "Fix data: ",eta_notide[152:155]

    d = np.vstack([t_notide,eta_notide]).T
    np.savetxt(fname_notide, d)
    print "Created file ",fname_notide

    dart.plot_post_quake(t_notide,eta_notide,gaugeno)

    fig = plt.figure()
    axes = fig.add_subplot(1, 1, 1)
    axes.plot(t_notide, eta_notide, 'k')
    axes.set_title("DART Buoy %s" % gaugeno)

    return t_notide, eta_notide
Ejemplo n.º 4
0
import sys, os
import pylab
sys.path.append('../../datatools')
import dart  # from the directory above

gaugeno = 43412
fname = '43412_5day-03132011.txt'
t1fit = 16500.
t2fit = 18000.
t1out = 16800
t2out = 17500.
degree = 15

fname_notide = os.path.splitext(fname)[0] + '_notide.txt'
t,eta = dart.plotdart(fname)    
t = pylab.flipud(t)
eta = pylab.flipud(eta)

c,t_notide,eta_notide = dart.fit_tide_poly(t,eta,degree,t1fit,t2fit, t1out,t2out)

# Time of quake:  05:48:15 UTC on March 12, 2011
# Convert to minutes after start of March:
t_quake = 11*24*60 + 5*60 + 48 + 15/60.  
#print "Time of quake = %7.2f minutes after start of March" % t_quake

t_sec = (t_notide-t_quake)*60.
d = pylab.vstack([t_sec,eta_notide]).T
pylab.savetxt(fname_notide,d)
print "Created file ",fname_notide