[ncl-talk] Incorrect significance plot

Ipshita Majhi ipmajhi at alaska.edu
Fri Feb 5 11:01:57 MST 2016


Thank you so much for your  help
I will debug the code and I will also fix the transpose thing again.

Best Regards
Ipshita

On Fri, Feb 5, 2016 at 8:49 AM, Mary Haley <haley at ucar.edu> wrote:

> 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.
>
> Have you tried debugging your code, to see if any of the values you've
> calculated are incorrect?
>
> I suggest using printVarSummary and printMinMax to make sure you have the
> values and metadata that you expect:
>
> printVarSummary(corr_dec)
> printMinMax(corr_dec,0)
> printVarSummary(prob_dec)
> printMinMax(prob_dec,0)
>
> etcetera.
>
> As a side, why do you have this line:
>
> e=transpose(transpose(JJAS_1967_2012))
>
> If you transpose an array and then transpose it again, you are going to
> get the same array back.  This is an unnecessary operation.
>
> --Mary
>
>
> On Tue, Feb 2, 2016 at 11:35 AM, Ipshita Majhi <ipmajhi at alaska.edu> wrote:
>
>> Dear NCL,
>>
>> 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.
>> Best Regards
>> Ipshita
>>
>> ;=============================================
>> ; Reading data
>> ;=============================================
>>
>> a=addfile("~/Documents/SST/Monthly/sst.mnmean.v4.nc","r")
>> JJAS
>> =asciiread("~/Documents/SST/Monthly/jjas_1871_2012.txt",(/142,1/),"float")
>>
>> ;============================================
>> ;Extracting JJAS for 1967 to 2012
>> ;============================================
>>
>> JJAS_1967_2012=JJAS(96:141,0)
>>
>> e=transpose(transpose(JJAS_1967_2012))
>>
>> ;=============================================
>> ;The dataset goes from 1854-2015
>>
>> sst=a->sst
>>
>>  copy_VarAtts(a,sst)
>>  copy_VarCoords_1(a,sst)
>> ;============================================
>>
>> ;Extracting sea surface temperature
>>
>> sst=a->sst
>>
>> ;Extracting 1967-2012 for SST
>> sst_1967_2012=sst(1356:1907,:,:)
>>
>> copy_VarAtts(sst,sst_1967_2012)
>> copy_VarCoords_1(a,sst_1967_2012)
>>
>> ;============================================
>> ;Extracting 1871 to 2012 SST
>>
>> Dec_sst = new((/46,89,180/),float)
>> Dec_sst at _FillValue = -9.9621e+36
>>
>>
>> ;==========================================
>> ;Extracting SST for each month
>> ;========================================
>>
>> do nyr=0,551,12
>>
>> Dec_sst(nyr/12,:,:) =sst_1967_2012(nyr+11,:,:)
>> end do
>>
>> copy_VarAtts(sst_1967_2012,Dec_sst)
>> copy_VarCoords_1(sst_1967_2012,Dec_sst)
>>
>> ;=======================================
>> ;Reordering
>> ;=======================================
>>
>> Dec_reorder=Dec_sst(lat|:,lon|:,time|:)
>>
>> Dec_reorder at _FillValue = -9.9621e+36
>>
>> copy_VarAtts(Dec_sst,Dec_reorder)
>> copy_VarCoords_1(Dec_sst,Dec_reorder)
>>
>> ;=====================================
>>
>> ;======================================
>> ;Calculating Correlation
>> ;======================================
>>
>> corr_dec=escorc(Dec_reorder,e)
>> copy_VarCoords_1(Dec_reorder,corr_dec)
>>
>> ;===========================================
>>
>> ;Calculating significance
>> prob_dec   = rtest(corr_dec(:,:,0),46,0)
>> copy_VarCoords_1(Dec_reorder,prob_dec)
>> prob_dec at _FillValue = -9.9621e+36
>>
>> ;==============================================
>>
>> ; Now plotting the Significance
>>   wks  = gsn_open_wks("pdf","Significance_test")
>>   gsn_define_colormap(wks,"testcmap")              ; choose colormap
>>
>>   res                      = True                ; make plot mods
>>   res at gsnDraw = True
>>   res at gsnFrame = True
>>   res at cnFillOn             = True                ; turn on color
>>   res at gsnSpreadColors      = True                ; use full colormap
>>   res at lbLabelAutoStride    = True         ; automatic lb label stride
>>
>>   res at cnLinesOn            = False               ; turn off contour lines
>>   res at cnLevelSelectionMode = "ManualLevels" ; manually set cnlev
>>   res at cnMinLevelValF       = -1            ; min level
>>   res at cnMaxLevelValF       =  1                 ; max level
>>   res at cnLevelSpacingF      = 0.1                 ; contour level spacing
>>
>>
>>
>>   res at tiMainString         = "Dec SST with JJAS rainfall Regular
>> 1967-2012"
>>   plot= gsn_csm_contour_map_ce(wks,prob_dec,res)
>>
>>  ;===========================================
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>


-- 
Ipshita Majhi
PhD Candidate
University of Alaska , Fairbanks
Atmospheric Science Department
(907)978-4220 ipmajhi at alaska.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160205/9af4aeb2/attachment.html 


More information about the ncl-talk mailing list