<div dir="ltr"><div><div><div>Hi Ipshita,<br></div>It looks to me like you cut and pasted different parts of your script for the sake of emailing but I think the group would be hard pressed to diagnose your issue with what you provided. What do you mean by "the probability function is not working"?
Are you getting any error messages? As you don't show how you are
forming your prob_djf array I don't think anyone will be able to assist.You also pass a 3-dimensional array (corr_djf) into gsn_csm_contour_map_ce but that plotting function expects a 2D array. <br><br></div><div>Please provide more information so that the group can assist. As always please respond to the ncl-talk email list with any future inquiries. <br></div></div>Adam<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Aug 27, 2015 at 12:07 PM, Ipshita Majhi <span dir="ltr"><<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Dear NCL,<br><br></div>I have been working on creating a plot with correlation and probability function. I am able to do it with no lag between two variables, but when I introduce lag, the probability function is not working, I am not sure why that is, it will be great if you could guide me on this:-<br><br>;This is for correlating JJAS monthly precp with JJAS temperature with lag<br><br>;******************************************************<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"<br>;*******************************************************<br><br>;=============================================<br>; Reading data<br>;=============================================<br><br>a=addfile("~/Documents/SST/Monthly/<a href="http://sst.mnmean.v4.nc" target="_blank">sst.mnmean.v4.nc</a>","r")<br><br>;==============================================<br><br>JJAS_1871_2012 =asciiread("~/Documents/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")<br>;Extracting JJAS for 1967 to 2012<br><br>JJAS_1967_2012=JJAS_1871_2012(96:141,0)<br>print(dimsizes(JJAS_1967_2012))<br><br>e=transpose(transpose(JJAS_1967_2012))<br>;print(dimsizes(e))<br><br>;=============================================<br><br>;For some months around september it is better to <br>;=============================================<br> ;The dataset goes from 1854-2015<br> sst=a->sst<br>; copy meta data and coordinate variables using contributed functions<br> copy_VarAtts(a,sst) <br> copy_VarCoords_1(a,sst)<br>;============================================<br><br>;Extracting 1967-2012 for SST<br>sst_1967_2012=sst(1367:1918,:,:)<br><br><br>copy_VarAtts(sst,sst_1967_2012) <br>copy_VarCoords_1(a,sst_1967_2012)<br><br>;============================================<br>;Seasonal three month average<br><br> <br> sst_djf=month_to_season(sst_1967_2012, "DJF")<br><br>;==============================================<br>;Copying Attributes and Coordinates<br><br>copy_VarAtts(sst_1967_2012,sst_djf) <br>copy_VarCoords_1(sst_1967_2012,sst_djf)<br>;Calculating correlation<br><br><br><br>djf_reorder=sst_djf(lat|:,lon|:,time|:)<br><br>;Calculating Correlation Coefficient<br><br>;Months with Lag<br>corr_djf=esccr(JJAS_1967_2012,djf_reorder,1)<br><br>;========================================<br>;Probability<br>x=corr_djf(:,:,1)<br>print(dimsizes(x))<br>;==============================<br>; Now plotting the correlation<br><br>;===========================================<br><br>; Now plotting the correlation<br><br><br> wks = gsn_open_wks("pdf","DJF_sst_jjas_cor_prob_sig_lag") <br> gsn_define_colormap(wks,"BlWhRe") ; choose colormap<br> <br> res = True ; make plot mods<br> res@gsnDraw = False<br> res@gsnFrame = False<br> res@cnFillOn = True ; turn on color<br> res@gsnSpreadColors = True ; use full colormap<br> res@lbLabelAutoStride = True ; automatic lb label stride<br><br> res@cnLinesOn = False ; turn off contour lines<br> res@cnLevelSelectionMode = "ManualLevels" ; manually set cnlev<br> res@cnMinLevelValF = -1. ; min level<br> res@cnMaxLevelValF = 1. ; max level<br> res@cnLevelSpacingF = .1 ; contour level spacing<br><br> lag = 0<br> res@tiMainString = "DJF SST with JJAS rainfall"<br> plotA = gsn_csm_contour_map_ce(wks,corr_djf,res)<br><br> ; Significance plot on top of correlation plot<br> ;========================= PLOT 2 =========<br> res2 = True ; res2 probability plots<br><br> res2@gsnDraw = False ; Do not draw plot<br> res2@gsnFrame = False ; Do not advance frome<br> res2@cnFillOn = True ; turn on color/pattern fill<br> res2@cnMonoFillPattern = False ; allow different patterns<br> res2@cnMonoFillColor = True ; only use one color (black)<br><br> res2@cnLevelSelectionMode = "ExplicitLevels" ; set explicit cnlev<br> res2@cnLevels = (/.90/) ; only have 1 contour level<br> res2@cnFillPatterns = (/-1,17/) ; don't fill <0.95, stipple >=0.95<br> <br> res2@gsnAddCyclic = True ; may or may not be needed<br> <br> res2@cnInfoLabelOn = False ; turn off info label<br><br> res2@cnLinesOn = False ; do not draw contour lines<br> res2@cnLineLabelsOn = False ; do not draw contour labels<br><br> res2@cnFillScaleF = 0.5 ; add extra density<br><br> printMinMax(prob_djf,0) ; check to make sure values are<br> ; between 0 and 1.<br><br> plot2 = gsn_csm_contour(wks,prob_djf, res2)<br> overlay (plotA, plot2)<br><br> draw (plotA)<br> frame(wks)<br>;=================================================<br><br></div>Best Regards<span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888">Ipshita<br clear="all"><div><div><div><div><div><br></div></div></div></div></div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><div><span><font color="#888888">Adam Phillips <br></font></span></div><span><font color="#888888">Associate Scientist, </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br></font></span></div></div><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> </font></span><span><font color="#888888">303-497-1726 </font></span></div><span><font color="#888888"></font></span><div><div><span><font color="#888888"><br></font></span><div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div></div></div></div></div></div></div></div></div></div></div>
</div>