1

I want to plot a plume from netcdf data over a satellite image. I just wanna display Z values which in my case means precipitation, but it seems that X and Y (lon, lat) has been plotting as well that not I wanted since they make image darker. Someone has a solution for that?

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() 
Thomas Kühn
  • 9,412
  • 3
  • 47
  • 63
  • 1
    Are you drawing two plots on top of each other or why do you use both `imshow` *and* `pcolormesh`? Please consider writing a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) -- right now we cannot run your code and thus we cannot try to reproduce your problem. – Thomas Kühn Nov 26 '18 at 13:09
  • Yes, I'm plotting the image which is a .PNG and plotting the netcdf data over this image, because I wanna see the spatial-temporal distribution of rainfall over the region. I used imshow and pcolormesh to be able to use the utilities of each one. I'm addind the whole script. – Yasmin Kaore Nov 26 '18 at 13:25

0 Answers0