<div dir="ltr"><div>Thank you so much for your help</div><div>I will debug the code and I will also fix the transpose thing again. </div><div><br></div><div>Best Regards</div><div>Ipshita</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 5, 2016 at 8:49 AM, Mary Haley <span dir="ltr"><<a href="mailto:haley@ucar.edu" target="_blank">haley@ucar.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 class="gmail_default" style="font-size:small">It's hard for us to look at a code with lots of calculations to try to figure out why a plot is not correct, if we don't have access to the data.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Have you tried debugging your code, to see if any of the values you've calculated are incorrect?</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I suggest using printVarSummary and printMinMax to make sure you have the values and metadata that you expect:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">printVarSummary(corr_dec)</div><div class="gmail_default">printMinMax(corr_dec,0)</div><div class="gmail_default">printVarSummary(prob_dec)</div><div class="gmail_default" style="font-size:small">printMinMax(prob_dec,0)</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">etcetera.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">As a side, why do you have this line:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px">e=transpose(transpose(JJAS_</span><span style="font-size:12.8px">1967_2012))</span><br style="font-size:12.8px"></div><div class="gmail_default" style="font-size:small"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">If you transpose an array and then transpose it again, you are going to get the same array back. This is an unnecessary operation.</span></div><span class="HOEnZb"><font color="#888888"><div class="gmail_default"><span style="font-size:12.8px"><br></span></div><div class="gmail_default"><span style="font-size:12.8px">--Mary</span></div><div class="gmail_default"><span style="font-size:12.8px"><br></span></div></font></span></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Feb 2, 2016 at 11:35 AM, Ipshita Majhi <span dir="ltr"><<a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div>Dear NCL,<br><br></div>I calculated correlation and am trying to plot the significance plot. The significance plot , is not plotting correctly, it is giving no significance where there is high correlation and vice versa. It will be great if you could point out where I am going wrong.<br></div>Best Regards<br></div>Ipshita<br clear="all"><div><div><div><div><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>JJAS =asciiread("~/Documents/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")<br><br>;============================================<br>;Extracting JJAS for 1967 to 2012<br>;============================================<br><br>JJAS_1967_2012=JJAS(96:141,0)<br><br>e=transpose(transpose(JJAS_1967_2012))<br><br>;=============================================<br>;The dataset goes from 1854-2015<br><br>sst=a->sst<br><br> copy_VarAtts(a,sst) <br> copy_VarCoords_1(a,sst)<br>;============================================<br><br>;Extracting sea surface temperature<br><br>sst=a->sst<br><br>;Extracting 1967-2012 for SST<br>sst_1967_2012=sst(1356:1907,:,:)<br><br>copy_VarAtts(sst,sst_1967_2012) <br>copy_VarCoords_1(a,sst_1967_2012)<br> <br>;============================================<br>;Extracting 1871 to 2012 SST<br><br>Dec_sst = new((/46,89,180/),float)<br>Dec_sst@_FillValue = -9.9621e+36<br><br><br>;==========================================<br>;Extracting SST for each month<br>;========================================<br><br>do nyr=0,551,12<br><br>Dec_sst(nyr/12,:,:) =sst_1967_2012(nyr+11,:,:)<br>end do<br><br>copy_VarAtts(sst_1967_2012,Dec_sst) <br>copy_VarCoords_1(sst_1967_2012,Dec_sst)<br><br>;=======================================<br>;Reordering<br>;=======================================<br><br>Dec_reorder=Dec_sst(lat|:,lon|:,time|:)<br><br>Dec_reorder@_FillValue = -9.9621e+36<br><br>copy_VarAtts(Dec_sst,Dec_reorder) <br>copy_VarCoords_1(Dec_sst,Dec_reorder)<br><br>;=====================================<br><br>;======================================<br>;Calculating Correlation<br>;======================================<br><br>corr_dec=escorc(Dec_reorder,e)<br>copy_VarCoords_1(Dec_reorder,corr_dec)<br><br>;===========================================<br><br>;Calculating significance<br>prob_dec = rtest(corr_dec(:,:,0),46,0)<br>copy_VarCoords_1(Dec_reorder,prob_dec)<br>prob_dec@_FillValue = -9.9621e+36<br><br>;==============================================<br><br>; Now plotting the Significance<br> wks = gsn_open_wks("pdf","Significance_test") <br> gsn_define_colormap(wks,"testcmap") ; choose colormap<br> <br> res = True ; make plot mods<br> res@gsnDraw = True<br> res@gsnFrame = True<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 = 0.1 ; contour level spacing<br><br> <br><br> res@tiMainString = "Dec SST with JJAS rainfall Regular 1967-2012"<br> plot= gsn_csm_contour_map_ce(wks,prob_dec,res)<br> <br> ;===========================================<br><br></div></div></div></div></div>
<br></div></div><span>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank" rel="noreferrer">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><div><div>Ipshita Majhi<br></div>PhD Candidate<br></div>University of Alaska , Fairbanks<br></div>Atmospheric Science Department<br></div>(907)978-4220 <a href="mailto:ipmajhi@alaska.edu" target="_blank">ipmajhi@alaska.edu</a><br></div></div>
</div>