Esempio n. 1
0
def plot_gauge(d,my_list,gaugeno):
    figure(360)
    clf()

    plotdata = ClawPlotData()
    d, gt, gv = read_lab_data(d)
    for my in my_list:
        outdir = "_output_%s_my%s" %(d,my)
        plotdata.outdir = outdir
        gs = plotdata.getgauge(gaugeno)
        plot(gs.t, gs.q[:,3], linewidth=1)
    legend_list = []
    for my in my_list:
        legend_list.append("my = %s" % my)
    if gv[gaugeno] is not None:
        plot(gt, gv[gaugeno],'k', linewidth=2)
        legend_list.append("Lab data")
    #axis([0,5,-.01,.02])
    legend(legend_list, loc='lower right')
    title("Gauge %s for d = %5.3f" % (gaugeno,d), fontsize=20)
Esempio n. 2
0
def plot_gauge(d, my_list, gaugeno):
    figure(360)
    clf()

    plotdata = ClawPlotData()
    d, gt, gv = read_lab_data(d)
    for my in my_list:
        outdir = "_output_%s_my%s" % (d, my)
        plotdata.outdir = outdir
        gs = plotdata.getgauge(gaugeno)
        plot(gs.t, gs.q[:, 3], linewidth=1)
    legend_list = []
    for my in my_list:
        legend_list.append("my = %s" % my)
    if gv[gaugeno] is not None:
        plot(gt, gv[gaugeno], 'k', linewidth=2)
        legend_list.append("Lab data")
    #axis([0,5,-.01,.02])
    legend(legend_list, loc='lower right')
    title("Gauge %s for d = %5.3f" % (gaugeno, d), fontsize=20)
Esempio n. 3
0
from matplotlib import image

dartpng = image.imread('dart32412_comp-2.png')
pylab.figure(400)
pylab.clf()
pylab.imshow(dartpng)
pylab.hold(True)

# origin of plot in pixels on image:
t0 = 195.
y0 = 221.
tscale = 120.0
yscale = -446.66666666666669
plotdata = ClawPlotData()
plotdata.outdir = "_output"
gaugedata = plotdata.getgauge(32412)
t = gaugedata.t
eta = gaugedata.q[:, 3]
t = t0 + tscale * (t / 3600.)
y = y0 + yscale * eta

pylab.plot(t, y, 'b')
pylab.plot([160, 225], [550, 550], 'b')
pylab.text(240, 560, 'GeoClaw (added to NOAA original)', fontsize=8)
pylab.text(
    100,
    600,
    'NOAA Original from http://nctr.pmel.noaa.gov/chile20100227/dart32412_comp-2.pdf',
    fontsize=8)

pylab.xlim([50, 1300])
Esempio n. 4
0
#             )
# 
# ax.set_ylim(-2,2)
# plt.show()

from pyclaw.plotters.data import ClawPlotData

plotdata = ClawPlotData()

plt.figure(1)

plotdata.outdir = '_output'

plt.hold(True)
plt.grid(True)
gs = plotdata.getgauge(9)
plt.plot(gs.t,gs.q[:,3],'b',linewidth=2)
plt.annotate('Gauge 1',(100e3,2.0),(120e3,2.25),arrowprops={'width':1,'color':'k'})
gs = plotdata.getgauge(11)
plt.plot(gs.t,gs.q[:,3],'b--',linewidth=2)
plt.annotate('Gauge 2',(100e3,-2.0),(120e3,-2.25),arrowprops={'width':1,'color':'k'})
# gs = plotdata.getgauge(18)
# plt.plot(gs.t,gs.q[:,3],'b-.',linewidth=2)
# plt.annotate('Gauge 3',(50e3,-0.15),(15e3,-1.5),arrowprops={'width':1,'color':'k','shrink':0.1})    

plt.plot([0,40*3600],[0,0],'k')

    
plt.title("Gauge Data")
plt.xlabel('t (hours)')
plt.ylabel('m')
Esempio n. 5
0
from matplotlib import image

dartpng = image.imread("dart32412_comp-2.png")
pylab.figure(400)
pylab.clf()
pylab.imshow(dartpng)
pylab.hold(True)

# origin of plot in pixels on image:
t0 = 195.0
y0 = 221.0
tscale = 120.0
yscale = -446.66666666666669
plotdata = ClawPlotData()
plotdata.outdir = "_output"
gaugedata = plotdata.getgauge(32412)
t = gaugedata.t
eta = gaugedata.q[:, 3]
t = t0 + tscale * (t / 3600.0)
y = y0 + yscale * eta

pylab.plot(t, y, "b")
pylab.plot([160, 225], [550, 550], "b")
pylab.text(240, 560, "GeoClaw (added to NOAA original)", fontsize=8)
pylab.text(100, 600, "NOAA Original from http://nctr.pmel.noaa.gov/chile20100227/dart32412_comp-2.pdf", fontsize=8)


pylab.xlim([50, 1300])
pylab.ylim([640, 0])
pylab.axis("off")
Esempio n. 6
0
dtopodir = '/Users/rjl/git/tohoku2011a/sources/'

gaugenos = [21401, 21413, 21418, 21419]
models = """GCMT Hayes UCSB3 Ammon Caltech Fujii Saito Gusman GusmanAU
            pmelWei""".split()

models = ["GCMT"]

for model in models:
    print "Model: ",model

    rundata = setrun.setrun()
    rundata.geodata.dtopofiles = [[1,4,4,dtopodir+'%s.txydz' % model]]
    rundata.write()  # create *.data files

    outdir = '_output_%s' % model
    runclaw.runclaw('xgeoclaw',outdir)

    pd = ClawPlotData()
    pd = setplot.setplot(pd)
    pd.outdir = outdir
    for gaugeno in gaugenos:
        g = pd.getgauge(gaugeno)
        d = np.vstack([g.t,g.q[:,3]]).T
        fname = '../simulation_results/%s_%s.txt' % (model,gaugeno)
        np.savetxt(fname, d)
        print "Created ",fname


Esempio n. 7
0
tlimits[21418] = [0,28800]
tlimits[21419] = [0,28800]
tlimits[52402] = [0,36000]
tlimits[51407] = [2100,40000]
tlimits[52403] = [8000,40000]
tlimits[52405] = [0,32400]
tlimits[52406] = [16000,40000]
tlimits[52425] = [25200,40000]

#-----------------------------------------------------
pd = ClawPlotData()
pd.outdir = '_output'

gd = {}
for gn in [51425, 21413, 52402, 52403, 52405, 52406]:
    gd[gn] = pd.getgauge(gn)


figure(3, figsize=[10,8])
clf()

gn = 21413
shift = 0.
plot(gd[gn].t, gd[gn].q[:,3] + shift, 'b', linewidth=2)
text(400, shift+0.05, "%s" % gn)
dart = dartdata[gn]
mask = (dart[:,0] > gd[gn].t.min()) & (dart[:,0] < gd[gn].t.max()) 
plot(dart[mask,0],dart[mask,1]+shift,'r')

def plotdart(gn, shift):
    plot(gd[gn].t, gd[gn].q[:,3] + shift, 'b', linewidth=2)
Esempio n. 8
0
import setplot
import numpy as np

dtopodir = '/Users/rjl/git/tohoku2011a/sources/'

gaugenos = [21401, 21413, 21418, 21419]
models = """GCMT Hayes UCSB3 Ammon Caltech Fujii Saito Gusman GusmanAU
            pmelWei""".split()

models = ["GCMT"]

for model in models:
    print "Model: ", model

    rundata = setrun.setrun()
    rundata.geodata.dtopofiles = [[1, 4, 4, dtopodir + '%s.txydz' % model]]
    rundata.write()  # create *.data files

    outdir = '_output_%s' % model
    runclaw.runclaw('xgeoclaw', outdir)

    pd = ClawPlotData()
    pd = setplot.setplot(pd)
    pd.outdir = outdir
    for gaugeno in gaugenos:
        g = pd.getgauge(gaugeno)
        d = np.vstack([g.t, g.q[:, 3]]).T
        fname = '../simulation_results/%s_%s.txt' % (model, gaugeno)
        np.savetxt(fname, d)
        print "Created ", fname
Esempio n. 9
0
g_obs = tidegauge.read_tide_gauge('1615680__2011-03-11_to_2011-03-13.csv')

tsec = g_obs[1]
thour = tsec / 3600.
eta = g_obs[3]

figure(3)
clf()
plot(thour, eta, 'k', linewidth=1)
plot(thour, eta, 'k.', linewidth=1, label='Observed')

# computed results:
plotdata = ClawPlotData()
plotdata.outdir = '_output_americano'
print "Looking for GeoClaw results in ", plotdata.outdir
g5680 = plotdata.getgauge(5680)

# shift by 10 minutes:
thour = (g5680.t + 600.) / 3600.
plot(thour, g5680.q[:, 3], 'r', linewidth=2, label='GeoClaw')
xlim(7.5, 13)
ylim(-3, 3)
legend(loc='lower right')
xticks(range(8, 14), fontsize=15)
yticks(fontsize=15)
title('Surface elevation at Gauge 1615680', fontsize=15)

if 0:
    fname = "TG5680.png"
    savefig(fname)
    print "Created ", fname
Esempio n. 10
0
g_obs=tidegauge.read_tide_gauge('1615680__2011-03-11_to_2011-03-13.csv')

tsec = g_obs[1]
thour = tsec / 3600.
eta = g_obs[3]

figure(3)
clf()
plot(thour,eta,'k',linewidth=1)
plot(thour,eta,'k.',linewidth=1,label='Observed')

# computed results:
plotdata = ClawPlotData()
plotdata.outdir = '_output_americano'
print "Looking for GeoClaw results in ",plotdata.outdir
g5680 = plotdata.getgauge(5680)

# shift by 10 minutes:
thour = (g5680.t + 600.) / 3600.
plot(thour, g5680.q[:,3],'r',linewidth=2,label='GeoClaw')
xlim(7.5,13)
ylim(-3,3)
legend(loc='lower right')
xticks(range(8,14),fontsize=15)
yticks(fontsize=15)
title('Surface elevation at Gauge 1615680',fontsize=15)

if 0:
    fname = "TG5680.png"
    savefig(fname)
    print "Created ",fname