[ncl-talk] Plotting overlay plot with significance values

Mary Haley haley at ucar.edu
Wed Jan 31 14:56:28 MST 2018


The error message is telling you what the problem is:

Argument type mismatch on argument (1) of (gsn_csm_contour_map_polar) can
not coerce

Argument #1 refers to the second argument in the gsn_csm_contour_map_polar
call, because argument count starts at 0.

I looked at your gsn_csm_contour_map_polar calls and found this one:

  plots(mm)   = gsn_csm_contour_map_polar(wks,plots(mm),res)

You are trying to pass plots(mm) to gsn_csm_contour_map_polar which doesn't
make sense.

You have already called gsn_csm_contour_map_polar earlier in your script
and put the plots in plots(mm) via these calls:

 plots(0)  = gsn_csm_contour_map_polar(wks,T1diff,res)
 plots(1)  = gsn_csm_contour_map_polar(wks,T2diff,res)
 plots(2)  = gsn_csm_contour_map_polar(wks,T3diff,res)
 plots(3)  = gsn_csm_contour_map_polar(wks,T4diff,res)

so I'm not sure why you are trying to call gsn_csm_contour_map_polar again.
Try removing or commenting out the offending line and see what happens.

;   plots(mm)   = gsn_csm_contour_map_polar(wks,plots(mm),res)

--Mary







On Wed, Jan 31, 2018 at 8:47 AM, Sri Nandini via ncl-talk <ncl-talk at ucar.edu
> wrote:

> Hello
>
> I am trying to plot seasonal (DJF, MAM, JJA, SON) temperature values with
> thier ttest values (all already calculated and saved in netcdf file).
>
> I attach my plotting script below:
> And my error is:
> Argument type mismatch on argument (1) of (gsn_csm_contour_map_polar) can
> not coerce
>
> Would appreciate any advice on why the plot turns out like this, see
> attached.
>
> ; Reading all seasonal differences and ttest, then overlaying on each plot
> with the caspian basin shapefile to show the 95% or 99% significance levels
>
>
>   latS   =  30.                ; N. Hemisphere
>   latN   =  90.
>
> ADD_SHAPEFILE_OUTLINES = True
>   sname = "Caspian_Basin.shp"
>
> ; ==============================================================
> ; Open the files:Read all the seasonal differences and ttest values
> ; ==============================================================
> f     = addfile ("T2M_BC_DJF_Diff.nc", "r")
> T1diff    = f->T1diff
>
> f2 = addfile("T2M_BC_MAM_Diff.nc","r")
> T2diff    = f2->T2diff
>
> f3 = addfile("T2M_BC_JJA_Diff.nc","r")
> T3diff    = f3->T3diff
>
> f4 = addfile("T2M_BC_SON_Diff.nc","r")
> T4diff    = f4->T4diff
>
> ;==================================================================
> f5 = addfile("T2M_BC_DJF_ttest.nc","r")
> probt1    = f5->probt1
>
> f6 = addfile("T2M_BC_MAM_ttest.nc","r")
> probt2    = f6->probt2
>
> f7 = addfile("T2M_BC_JJA_ttest.nc","r")
> probt3    = f7->probt3
>
> f8 = addfile("T2M_BC_SON_ttest.nc","r")
> probt4    = f8->probt4
>
> ;=====================================================================Start
> the graphics
>   wks = gsn_open_wks("png","T2M_BC_seasons_diff_ttest_")
>
>   res                     = True
>   res at gsnDraw             = False
>   res at gsnFrame            = False
>   res at cnFillPalette       = "BlWhRe"            ; select a color map with
> white in the
>   res at gsnPolar            = "NH"
>   res at mpGridAndLimbOn     = "False"             ; turn off lat/lon lines
>   res at mpFillOn            = False               ; turn off map fill
>
>   res at mpMinLatF            = latS               ; zoom in on map
>   res at mpMaxLatF            = latN
>
>   res at cnLevelSelectionMode = "ManualLevels"     ; manual set levels
>   res at cnMinLevelValF       =-3
>   res at cnMaxLevelValF       = 3
>   res at cnLevelSpacingF      = 0.5                ; contour levels
>
>   res at cnFillOn             = True
>   res at cnLinesOn            = False
>   res at cnLineLabelsOn       = False
>   res at cnFillDrawOrder      = "Predraw"          ; fill and lines before
> map
>   res at mpDataBaseVersion    = "MediumRes"        ; use GMT coastline
>
>   res at mpGridAndLimbOn      = False              ; set to true if you want
> grid lines to show
>   res at lbLabelBarOn         = False              ; turn off individual
> label bars
>   ;res at cnRasterModeOn      = True               ; Raster mode shows grid
> cells
>   res at gsnRightString       = ""                 ; Turn off subtitles
>   res at gsnLeftString        = ""
>
> ;==================================Create arrays to hold series of plots
>     plots = new(4,graphic)
>
>  plots(0)  = gsn_csm_contour_map_polar(wks,T1diff,res)
>
>  plots(1)  = gsn_csm_contour_map_polar(wks,T2diff,res)
>
>  plots(2)  = gsn_csm_contour_map_polar(wks,T3diff,res)
>
>  plots(3)  = gsn_csm_contour_map_polar(wks,T4diff,res)
>   printVarSummary(plots)
>
> ;=====================================================================
> ;Second plot resources and overlay onto first
> ;=====================================================================
>   res2 = True                            ; res2 probability plots
>   res2 at gsnDraw             = False       ; Do not draw plot
>   res2 at gsnFrame            = False       ; Do not advance frome
>
>   res2 at cnLevelSelectionMode = "ExplicitLevels"       ; set explicit cnlev
>   res2 at cnLevels   = (/99./)              ; only have 1 contour level
>   res2 at cnInfoLabelOn       = False
>   res2 at cnLinesOn           = False       ; do not draw contour lines
>   res2 at cnLineLabelsOn      = False       ; do not draw contour labels
>   res2 at cnFillScaleF        = 0.6         ; add extra density
>
>   res2 at gsnRightString      = ""          ; Turn off subtitles
>   res2 at gsnLeftString       = ""
>   res at gsnAddCyclic         = True        ; add cyclic point
>
> ;========================================================================
>   opt = True                                         ; set up parameters
> for pattern fill
>   opt at gsnShadeFillType = "pattern"                   ; specify pattern
> fill
>   opt at gsnShadeHigh      = 17                         ; stipple pattern
>   opt at gsnShadeDotSizeF = 1                           ; make dots larger
>
> ;==================================Create arrays to hold series of ttests
> or make a loop
>     plot2 = new(4,graphic)
>
>  plot2(0)  = gsn_csm_contour(wks,probt1,res2)
>
>  plot2(1)  = gsn_csm_contour(wks,probt2,res2)
>
>  plot2(2)  = gsn_csm_contour(wks,probt3,res2)
>
>  plot2(3)  = gsn_csm_contour(wks,probt4,res2)
>   printVarSummary(plot2)
> ;==========================================================================cycle
> through seasons
> season = (/"DJF","MAM","JJA","SON"/)
> nof=4
>
> do mm=0,nof-1
>   res at gsnCenterString = season(mm)
>
>   plots(mm)   = gsn_csm_contour_map_polar(wks,plots(mm),res)
>   plot2(mm)   = gsn_contour_shade(plot2(mm),1,99., opt)        ; stipple
> all areas >= 99%  contour
>
>   overlay (plots (mm), plot2 (mm))
> end do
>
>   printVarSummary(plots)
>   printVarSummary(plot2)
>
> ;=====================================
> ;Attach the polylines and shape
> ;=====================================
>    pres             = True
>    pres at gsLineColor = "black"
>    pres at gsLineThicknessF = 2.0                ; 2x thickness
>    shp1 = gsn_add_shapefile_polylines(wks,plots,sname,pres)
>    printVarSummary(shp1)
>
> ;==================================
> ; panel resources for the 4 plots
> ;==================================
>   pres1                     = True             ; modify the panel plot
>   pres1 at gsnPanelLabelBar    = True             ; common label bar
>   pres1 at gsnFrame            = False            ; don't advance frame yet
>   pres1 at lbOrientation       = "Vertical"       ; vertical label bar
>   pres1 at gsnPanelMainString  = "T2m BigCaspian-NoCaspian Seasonal
> Difference"
>   pres1 at lbBoxEndCapStyle  = "TriangleBothEnds" ; Added in NCL V6.4.0
>   pres1 at gsnMaximize         = True             ; large format
>
>    gsn_panel(wks,plots,(/2,2/),pres1)
>
>    draw (plots)
>    frame(wks)
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180131/c720273d/attachment.html>


More information about the ncl-talk mailing list