[ncl-talk] In significance plot stippling dot not showing up

Ipshita Majhi ipmajhi at alaska.edu
Wed Sep 13 20:39:06 MDT 2017


Dear NCL,

I am plotting correlation and significance in the same plot. I am not
getting the dots , I am getting a contour instead and I am not sure where I
am making a mistake. If someone could guide me then I will be
grateful.Listed below is my code.


;*******************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
;*******************************************

;*******************************************
MJ_1982_2014=asciiread("/Volumes/Ipshita_extra/Documents/NCL_files/SST/Monthly/MJ.txt",(/33,1/),"float")
MJ_1982_2012=MJ_1982_2014(0:31,0)

print(dimsizes(MJ_1982_2012))

;*************************************************
;Reading in SWE data
;*************************************************
a = addfile("monthly_82_13.nc","r")
b = addfile("GlobSnow_SWE_L3A_20130507_v2.0.nc","r")

swe  = a->swe
time = a->time

lat  = b->lat
lon  = b->lon
swe at lat2d = lat
swe at lon2d = lon

print(dimsizes(lat))
print(dimsizes(lon))

swe_FillValue=-9.99e+08

utc_date = cd_calendar(time, 0)
year=utc_date(:,0)
month=utc_date(:,1)

;********************************************
;This is to extract 1982-2012 of swe data
;********************************************
swe_82_12=swe(0:371,:,:)

;********************************************
;*******************************************
;Extracting monthly data for sce
;*******************************************

March_swe = swe(0:31,:,:)

March_swe at _FillValue = -9.99e+08

do nyr=0,371,12

March_swe(nyr/12,:,:) =swe_82_12(nyr+2,:,:)

end do
;=================================================
March_swe at _FillValue = -9.99e+08
;**********************************************

March_dt =
dtrend_msg(March_swe&time,March_swe(lat|:,lon|:,time|:),True,False)

printMinMax(March_dt,False)
MJ_dt=dtrend(MJ_1982_2012,False)
;****************************************
;Calculating Correlation
;***************************************

corr_March=escorc(March_dt,MJ_dt)

copy_VarCoords(swe(0,:,:),corr_March)
copy_VarAtts(swe(0,:,:),corr_March)

;**********************************************
;Calculating significance
;**********************************************

prob_March=rtest(corr_March,31,0)

sig_March =100*(1-prob_March)

 copy_VarCoords(swe(0,:,:),sig_March)
 copy_VarAtts(swe(0,:,:),sig_March)

 sig_March = mask(sig_March, sig_March.ge.100,False)
 sig_March = mask(sig_March, sig_March.lt.90,False)


;************************************************
; create plot
;************************************************

 wks = gsn_open_wks("x11","swe_march_mj_cor_sig")               ;

 gsn_define_colormap(wks, "BlueYellowRed")


 ;************************************************
    res                     = True              ; Plot modes desired.
    res at gsnMaximize         = True              ; Maximize plot
    res at gsnDraw             = False            ; don't draw
    res at gsnFrame            = False            ; don't advance frame
    res at cnFillOn            = True              ; color plot desired
    res at cnLinesOn           = False             ; turn off contour lines
    res at pmLabelBarWidthF    = 0.9             ; make wider
    res at pmLabelBarHeightF   = 0.1               ; default is taller
    res at lbLabelFontHeightF  = .018              ; default is HUGE
    res at lbLabelBarOn        =True           ; turn off individual cb's


;*******************************************
; georeferencing: plot on polar projection
;*******************************************
    res at trGridType   = "TriangularMesh"        ; allow missing coordinates
    res at gsnAddCyclic = False
    res at cnFillMode   = "RasterFill"
    res at cnInfoLabelOn       = False       ; turn off info label
    res at gsnPolar   = "NH"                          ; specify the hemisphere
    res at mpMinLatF  = 40
    res at mpMaxLatF  = 70
    res at mpMinLonF  = -30
    res at mpMinLonF  = -180
    plot = gsn_csm_contour_map_polar(wks,corr_March, res)
 ;*********************************************

  res2=True
  res2 at gsnDraw              = False           ; Do not draw plot
  res2 at gsnFrame             = False           ; Do not advance frome
  res2 at cnFillOn             = True
  res2 at cnMonoFillColor      = True
  res2 at cnMonoFillPattern    = False
  res2 at lbLabelBarOn        = False                            ; turn off
label bar
  res2 at cnLevelSelectionMode = "ManualLevels"   ; manually specify contour
levels
  res2 at cnMinLevelValF       = 90             ; min level
  res2 at cnMaxLevelValF       = 100             ; max level
  res2 at cnLevelSpacingF      =  1              ; contour interval
  res2 at gsnSpreadColors      = False


  plot2=gsn_csm_contour(wks,sig_March, res2) ; contours are at 90,100


  opt     = True
  opt at gsnShadeFillType = "pattern"
  opt at gsnShadeLow = 17

plot2=gsn_contour_shade(plot2,-999.,90.,opt) ;

 overlay (plot, plot2)

 draw (plot)
 frame(wks)



;=================================================





;


-- 


Ipshita Majhi
PhD Candidate
University of Alaska , Fairbanks
Atmospheric Science Department
(907)978-4220 ipmajhi at alaska.edu

************************************************************************************************************
Happiness comes when we stop complaining about the troubles we have and
offer thanks for all the troubles we don't have. Life is a gift!
-Sri Sri
****************************************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170913/22c3ed30/attachment.html>


More information about the ncl-talk mailing list