私はグラフをプロットしています。そして私は、グラフのカラーバー "U_velocity"と "U_shear_velocity"の値の範囲を-0.3から0.3にしたいと考えています。さらに、私はx軸の範囲をUとVのせん断速度プロットで0〜12.5時間にしようとしていますが、何も働かず、その代わりに私は速度の意味を持っています。どうすればいいですか、私を助けてください。Pythonの海洋図解
from netCDF4 import *
import matplotlib as mp
import numpy as np
#import matplotlib.pyplot as plt
import pylab as plt
#%%
file = "/home/vlad/Desktop/task/Untitled Folder/result.nc"
ncdata = Dataset(file, 'r')
u = np.squeeze(ncdata.variables['u'][:])
v = np.squeeze(ncdata.variables['v'][:])
z = np.squeeze(ncdata.variables['z'][:])
time = ncdata.variables['time'][:]/3600
ncdata.close()
u_mean = np.mean(u[0:100,:],0)
z_mean = np.mean(z[0:100,:],0)
v_mean = np.mean(v[0:100,:],0)
u_mean_10 = u[900:1000,:]
v_mean_10 = v[900:1000,:]
z_10 = np.mean(z[900:1000,:],0)
time_10 = time[900:1000] - time[900]
T = len(time_10)
L = len(z_10)
fig = plt.figure(6)
plt.pcolormesh(time_10,z_10,u_mean_10.T)
plt.xlim([0, time_10[-1]])
fig.suptitle('U_velocity', fontsize=25)
plt.xlabel('time', fontsize=20)
plt.ylabel('depth(m)', fontsize=20)
plt.colorbar()
plt.show()
shear_u_mean_10 = np.zeros([T,L])
for t in range(T):
for i in range(L-1):
tmp=(u_mean_10[t, i+1]-u_mean_10[t, i])/(z_10[i+1]-z_10[i])
tmp_depth = 0.5 * (z_10[i+1]+z_10[i])
shear_u_mean_10[t,i] = tmp
fig = plt.figure(10)
plt.pcolormesh(time_10/3600,z_10, shear_u_mean_10.T)
plt.xlim([0, time_10[-1]/3600])
plt.colorbar()
#plt.ylim([-30, -25])
fig.suptitle('U_shear velocity', fontsize=25)
plt.xlabel('time', fontsize=20)
plt.ylabel('depth(m)', fontsize=20)
plt.show()
shear_v_mean_10 = np.zeros([T,L])
for t in range(T):
for i in range(L-1):
tmp=(v_mean_10[t, i+1]-v_mean_10[t, i])/(z_10[i+1]-z_10[i])
tmp_depth = 0.5 * (z_10[i+1]+z_10[i])
shear_v_mean_10[t,i] = tmp
fig = plt.figure(11)
plt.pcolormesh(time_10/3600,z_10, shear_v_mean_10.T)
plt.xlim([0, time_10[-1]/3600])
plt.colorbar()
#plt.ylim([-30, -25])
fig.suptitle('V_shear velocity', fontsize=25)
plt.xlabel('time', fontsize=20)
plt.ylabel('depth(m)', fontsize=20)
plt.show()
fig = plt.figure(7)
plt.pcolormesh(time_10,z_10,v_mean_10.T)
plt.xlim([0, time_10[-1]])
fig.suptitle('V_velocity', fontsize=25)
plt.xlabel('time', fontsize=20)
plt.ylabel('depth(m)', fontsize=20)
plt.colorbar()
plt.show()
[mcve]を作成してみてください。走ってみることができますか?または、どのようなエラーメッセージが表示されるか教えてください。データファイルがないため、グラフをプロットできません。また、あなたの質問にあなたの現在のプロット出力の画像を含めてください – Praveen
@Praveen私はこのデータファイルをダウンロードしようとしましたが、私はそれを直接行う方法を見つけることができませんでした。それから私はリンクを通してそれをダウンロードしようとしましたが、ウェブサイトは私がスパムである可能性があるためリンクを参照することを許可していません。 – Vlados9951