[ncl-talk] Overlay on panel plots
Adam Phillips
asphilli at ucar.edu
Tue May 7 09:59:32 MDT 2019
Hi Nkese,
I see two issues:
1) A plot that is to be overlaid on another plot cannot be created by one
of the *_map* plotting routines. So change this:
plots(nmo) = gsn_csm_vector_map(wks,uwnd_monthly(nmo,:,:),vwnd_monthly(
nmo,:,:),vecres)
to this:
plots(nmo) = gsn_csm_vector(wks,uwnd_monthly(nmo,:,:),vwnd_monthly(
nmo,:,:),vecres)
2) You are overwriting your plot array every time through your loop.
Change this:
overlay(plot(nmo),plots(nmo))
plot = plot(nmo)
end do
gsn_panel(wks,plot,(/3,4/),resP)
to this:
overlay(plot(nmo),plots(nmo))
end do
gsn_panel(wks,plot,(/3,4/),resP)
Adam
On Tue, May 7, 2019 at 9:15 AM Nkese Mc Shine <Nkese.McShine at sta.uwi.edu>
wrote:
> Good day everyone,
>
> I would like to overlay 12 wind direction vector maps on 12 wind speed
> maps however I keep getting an error. Can anyone assist?
>
> Thanking you in advance.
>
> Regards,
> Nkese.
>
> My script:
>
> ;;create plots
>
> wks = gsn_open_wks("ps","Caribbeanwinds_monthly6")
> plot = new(12,graphic)
> plots = new(12,graphic)
>
> res = True
> res at gsnDraw = False ; don't draw
> res at gsnFrame = False ; don't advance frame
> res at cnFillOn = True ; turn on color
> res at gsnMaximize = True
>
> cmap = read_colormap_file("BkBlAqGrYeOrReViWh200")
> res at cnFillPalette = cmap(25:170,:) ; set color map
>
> res at cnLinesOn = False ; no contour lines
> res at lbLabelBarOn = False
>
> res at gsnLeftString = "Speed" ; change left string
> res at gsnRightString = uwnd_practice at units ; assign right string
>
> res at mpDataSetName = "Earth..4"
> res at mpDataBaseVersion = "MediumRes"
> res at mpOutlineOn = True
>
> res at mpGeophysicalLineThicknessF = 2
> res at mpNationalLineThicknessF = 2
> res at mpFillDrawOrder = "PostDraw"
> res at mpFillOn = False ; no map
> fill
>
> res at mpMinLatF = 0
> res at mpMaxLatF = 30
> res at mpMinLonF = -110
> res at mpMaxLonF = -30
>
> vecres = True ; vector only
> resources
> vecres at gsnDraw = False ; don't draw
> vecres at gsnFrame = False ; don't advance frame
> vecres at vcGlyphStyle = "LineArrow" ; curly vectors
> vecres at vcRefMagnitudeF = 10 ; define vector ref mag
> vecres at vcRefLengthF = 0.045 ; define length of vec ref
>
> vecres at vcLineArrowThicknessF = 1
> vecres at vcMinDistanceF = 0.05
>
> vecres at gsnRightString = " " ; turn off right string
> vecres at gsnLeftString = " " ; turn off left string
> vecres at tiXAxisString = " " ; turn off axis label
> vecres at vcRefAnnoOrthogonalPosF = -1.0 ; move ref vector into plot
>
> months = (/"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug",\
> "Sep","Oct","Nov","Dec"/)
>
> resP = True ; panel only
> resources
> resP at gsnPanelLabelBar = True
> resP at gsnMaximize = True ; maximize plots
>
>
> do nmo=0,11
> res at gsnCenterString=months(nmo)
> vecres at gsnCenterString=months(nmo)
> plot(nmo) = gsn_csm_contour_map_ce(wks,wspd_monthly(nmo,:,:),res)
> plots(nmo) =
> gsn_csm_vector_map(wks,uwnd_monthly(nmo,:,:),vwnd_monthly(nmo,:,:),vecres)
> overlay(plot(nmo),plots(nmo))
> plot = plot(nmo)
> end do
>
>
> gsn_panel(wks,plot,(/3,4/),resP)
>
>
> Error:
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> fatal:NhlAddOverlay: plot class mapPlotClass cannot be overlay plot member
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
> warning:MapSetTrans: map limits invalid - using maximal area
> fatal:MapSetTrans: error initializing map: MAPINT/MDPINT - MAP HAS ZERO
> AREA
>
> CONFIDENTIALITY: This email (including any attachments) may contain
> confidential, proprietary and/or privileged information. Any duplication,
> copying, distribution, dissemination, transmission, disclosure or use in
> any manner of this email (including any attachments) without the
> authorisation of the sender is strictly prohibited. If you receive this
> email (including any attachments) in error, please notify the sender and
> delete this email (including any attachments) from your system. Thank you.
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
--
Adam Phillips
Associate Scientist, Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/ 303-497-1726
<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190507/f99cd1e1/attachment.html>
More information about the ncl-talk
mailing list