Python中的地转流/速度

问题描述

我正在尝试从海面高度数据计算地转速度,然后使用quiver在python中绘制它们,但是尽管我认为正在计算速度,但得到的图没有显示箭头。下面是我的代码。我对python还是很陌生,所以如果有任何不清楚的词道歉。

#import the modules needed
import xarray as xr
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from mpl_toolkits.basemap import Basemap
import math
# Set problem
g =9.8#gravity constant
R = 6400000#Earth radius
omega =2*math.pi/(24*60*60)#Earth rotation angle veLocity
#load the data
data=xr.open_dataset("seasurfaceheight.nc")
ssh=data.sla.data
time=data.time
time=pd.to_datetime(time.data)
lat=data.latitude.data
lon=data.longitude.data
lon,lat=np.meshgrid(lon,lat)
# Set Coriolis force coefficients
f=2*omega*np.sin(lat*np.pi/180)
# Visualization of sea surface height
u=np.zeros(ssh[0,:,:].shape)
v=np.zeros(ssh[0,:].shape)
v1=np.zeros(ssh[0,:].shape)
ssh=ssh[0,:]
for i in np.arange(0,len(lon[0,:])-1):
    for j in np.arange(0,len(lat[:,0])-1):
        dx=(lon[j,i+1]-lon[j,i-1])*R*np.cos(lat[j,i])*math.pi/180
        print(dx)
        dy=(lat[j+1,i]-lat[j-1,i])*R*math.pi/180
        print(dy)
        u[j,i]=(g)/f[j,i]*(ssh[j,i+1]-ssh[j,i-1])/dy
        v[j,i]=(-g/f[j,i])*(ssh[j+1,i]-ssh[j-1,i])/dx 
#Plot the field using Basemap
map=Basemap(projection='mill',lat_ts=10,llcrnrlon=lon.min(),\
             urcrnrlon=lon.max(),llcrnrlat=lat.min(),urcrnrlat=lat.max(),resolution='f')
x,y = map(lon,lat)
map.drawmapboundary()
map.fillcontinents()
map.drawcoastlines()      
map.quiver(x,y,u,v)
plt.show()'''

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...