所以这是我的代码:
from netCDF4 import *
import datetime as dt
import numpy as np
import numpy.ma as ma
from datetime import date, datetime, timedelta
import matplotlib.pyplot as plt
nc=Dataset('datasets/essai.nc')
time_var = nc.variables[str('forecast_time0')]
wave_var = nc.variables['DIST_GDS0_SFC']
lat = nc.variables['g0_lat_1'][:]
lon = nc.variables['g0_lon_2'][:]
uin = nc.variables['UOGRD_GDS0_DBSL'][:]
vin = nc.variables['VOGRD_GDS0_DBSL'][:]
plt.quiver(lon[::5], lat[::5], uin[::5], vin[::5], scale=200)
这是我得到的错误:
Traceback (most recent call last):
File "nctry.py", line 37, in <module>
plt.quiver(lon[::5], lat[::5], uin[::5], vin[::5], scale=200)
File "C:\Python27\lib\site-packages\matplotlib\pyplot.py", line 2877, in quive
r
ret = ax.quiver(*args, **kw)
File "C:\Python27\lib\site-packages\matplotlib\axes.py", line 6627, in quiver
q = mquiver.Quiver(self, *args, **kw)
File "C:\Python27\lib\site-packages\matplotlib\quiver.py", line 394, in __init
__
X, Y, U, V, C = _parse_args(*args)
File "C:\Python27\lib\site-packages\matplotlib\quiver.py", line 356, in _parse
_args
nr, nc = U.shape
ValueError: too many values to unpack
我认为问题来自 UOGRD 和 VOGRD,它们有很多值但不知道如何操作它?
这是我的 uogrd 的样子: