python中的地转流/速度

python中的地转流/速度,python,numpy,matplotlib-basemap,Python,Numpy,Matplotlib Basemap,我试图从海面高度数据计算地转速度,然后用python中的quiver绘制它们,但是我得到的图没有显示箭头,尽管我认为速度正在计算中。下面是我的代码。我对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 i

我试图从海面高度数据计算地转速度,然后用python中的quiver绘制它们,但是我得到的图没有显示箭头,尽管我认为速度正在计算中。下面是我的代码。我对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()'''

欢迎,你能发布情节的截图吗?