在pcolormesh图上出现不必要的网格线,图像上方带有alpha

时间:2018-11-26 12:49:27

标签: python matplotlib netcdf weather

我想在卫星图像上绘制来自netcdf数据的羽状流。 我只是想显示Z值,在我的情况下,这意味着沉淀,但是似乎X和Y(lon,lat)也一直在绘制,所以我不想要它,因为它们使图像更暗。有人对此有解决方案吗?

enter image description here

from scipy.io import netcdf
import numpy as np
from matplotlib.pyplot import title,figure,show,savefig,colorbar,cm
from matplotlib import pyplot as plt
import os
import matplotlib.colors
import matplotlib.cm as cm
import matplotlib.image as mpimg

m1=netcdf.netcdf_file('/scratch/wrf-project/modelagem/yasmin/guara/lin-gd/previsao/wrfout_d03_2017-12-09_01:00:00','r')

im=mpimg.imread('/scratch/wrf-project/modelagem/yasmin/shape1/satelite_yasmin.png')

lon0=np.array(m1.variables['XLONG'][xx,:,:])

lat0=np.array(m1.variables['XLAT'][xx,:,:])

nnc0=np.array(m1.variables['RAINNC'][xx-1,:,:])

nnc1=np.array(m1.variables['RAINNC'][xx,:,:])

prec=np.subtract(nnc1,nnc0)

mycmap = matplotlib.colors.LinearSegmentedColormap.from_list("",["black","gold","yellow","orangered","red","indianred","maroon"])

prec[prec<=1] = np.nan

fig= plt.figure(figsize=(8,8))

plt.imshow(im,extent=[-38.99,-37.785,-13.362,-12.185]) 

gra=plt.pcolormesh(lon0,lat0,prec,cmap=mycmap,vmin=0,vmax=60,alpha=0.6)

plt.show() 

0 个答案:

没有答案