我如何使颤动图更能代表数据,即。带有清晰的箭头?

时间:2019-07-22 17:09:48

标签: python netcdf

我正在尝试从NETCDF文件的数据中绘制曲线图。但是,数据的矢量表示不好。我希望有小的矢量,而没有零值矢量,这些矢量显示为点。

我尝试使用颤动函数的不同参数,此图是我最清楚的图:plot1

from netCDF4 import Dataset
from pylab import *
import numpy as np

nest_1_filename = "nests/expt_91.2-1.nc"

# Reading the nest data.
ncid_1 = Dataset(nest_1_filename, "r+", format = "NETCDF4")

# Getting the values of Longitude from the nestfile.
lon_1 = ncid_1.variables['lon']

# Getting the values of Latitude from the nestfile.
lat_1 = ncid_1.variables['lat']

# Getting the values of U-velocity from the nestfile.
zu_1 = ncid_1.variables['water_u']

# Getting the values of V-velocity from the nestfile.
zv_1 = ncid_1.variables['water_v']

# Removing single-dimensional entries.
mask_1 = squeeze(zu_1[0][0][:][:])
mask_2 = squeeze(zv_1[0][0][:][:])

X, Y = np.meshgrid(transpose(lon_1), transpose(lat_1))  
quiver(X, Y, mask_1, mask_2, angles='xy', scale_units='xy', scale = 1, headwidth=25, headlength=10, minshaft = 50)

我希望输出结果是这样的。plot2

此处使用的NETCDF文件:link

1 个答案:

答案 0 :(得分:0)

您必须调整箭头的比例和宽度。尝试比例= 0.33,宽度= 0.003。忽略头宽,头长和最小轴。