First, I am a Japanese student who are not good at English.
Sorry for my poor sentences.
I will make animation of tsunami.
I want to plot land data (bathymetry) and tsunami data together.
But I cannot make animation.
I can plot only bathymetry and initial data of tsunami.
I cannot move tsunami.
My code is shown below. If there is anyone to know, please give me some advice.
import plotly.plotly as py
import plotly.graph_objs as go
import numpy as np
import glob
# input and make data
bath = np.loadtxt('./bathymetry.dat',dtype=float)
bath = -1*bath[::-1]
bathymetry = go.Surface(z=bath,
#
colorscale='Greys',
cmin=-1000,cmax=2000,
showscale=False,
)
tsunamilist = glob.glob('./tsunami/*.dat')
tsunamilist.sort()
tnm = np.zeros((len(tsunamilist),len(bath[:,0]),len(bath[0,:])),dtype=float)
n = 0
for filename in tsunamilist:
data_tnm = np.loadtxt(filename,dtype=float)
data_tnm = data_tnm[::-1]
data_tnm = np.where(data_tnm!=-99.0,data_tnm,np.nan) # no water point(tnm =-99.0)
tnm[n] = data_tnm
n += 1
tsunami_ini = go.Surface(z=tnm[0],
#
colorscale='RdBu',
cmin=-20,cmax=20,
)
datalist=[]
for i in range(10):
tsunami = go.Surface(z=tnm[i],
#
colorscale='RdBu',
cmin=-20,cmax=20,
)
thedata=[tsunami]
datalist.append(thedata)
# define frames
frames = []
for k in range(10):
frames.append(
dict(
data=datalist[k],
)
)
# make figure and plot
data=[bathymetry,tsunami_ini]
fig= go.Figure(data=data,frames=frames)
py.iplot(fig,filename='test')