We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I cannot plot vertical velocity with depth using 2160 THIS IS MY CODE:
from xmitgcm import llcreader import xarray as xr
from pylab import mpl mpl.rcParams['font.sans-serif']=['SimHei']
model = llcreader.ECCOPortalLLC2160Model()
ds = model.get_dataset(varnames=['W'], k_levels=list(range(10)))
print(ds)
w_data = ds['W'].isel(time=0, face=0, j=0, i=0)
print(w_data) import matplotlib.pyplot as plt
depths = ds['Z'].isel(k=list(range(10))) # 确保深度与垂直速度对应
plt.figure(figsize=(10, 6)) plt.plot(w_data, depths) plt.xlabel('垂直速度 (m/s)') plt.ylabel('深度 (m)') plt.title('垂直速度随深度变化') plt.gca( plt.show()).invert_yaxis() # 因为深度增加是向下的,所以反转y轴 plt.grid(True)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I cannot plot vertical velocity with depth using 2160
THIS IS MY CODE:
from xmitgcm import llcreader
import xarray as xr
from pylab import mpl
mpl.rcParams['font.sans-serif']=['SimHei']
创建模型实例
model = llcreader.ECCOPortalLLC2160Model()
获取数据集,指定需要的变量(垂直速度 'W')和垂直层级
ds = model.get_dataset(varnames=['W'], k_levels=list(range(10)))
查看数据集的信息
print(ds)
选择第一个时间步长,第一个面的第一个网格点的数据
w_data = ds['W'].isel(time=0, face=0, j=0, i=0)
查看选定的数据
print(w_data)
import matplotlib.pyplot as plt
获取深度数据
depths = ds['Z'].isel(k=list(range(10))) # 确保深度与垂直速度对应
绘制垂直速度随深度变化的图
plt.figure(figsize=(10, 6))
plt.plot(w_data, depths)
plt.xlabel('垂直速度 (m/s)')
plt.ylabel('深度 (m)')
plt.title('垂直速度随深度变化')
plt.gca(
plt.show()).invert_yaxis() # 因为深度增加是向下的,所以反转y轴
plt.grid(True)
The text was updated successfully, but these errors were encountered: