[ncl-talk] Attach shapefile polylines to contour

Amadou Coulibaly mpapin24 at gmail.com
Fri May 27 04:49:31 MDT 2016


Hi Rick,

It works. Thank you for your suggestions.

Best regards

On 26 May 2016 at 20:38, Rick Brownrigg <brownrig at ucar.edu> wrote:

> Hi,
>
> wrf_map_overlays has some resources specific to it, one of which controls
> "framing" similar to gsnFrame.  You might set:
>
>    pltres at FramePlot = False    ; default is True
>
> For more details, see:
>
> http://ncl.ucar.edu/Document/Functions/WRF_arw/wrf_map_overlays.shtml
>
> Note that it says "...the plot will be drawn, but the frame will not
> advanced."  I'm totally sure my suggestion will work -- it seems like the
> calls to
> gsn_add_shapefile_polylines() should be made before the plot is drawn.
> But perhaps give it a try.
>
> Hope that helps...
> Rick
>
> On Thu, May 26, 2016 at 11:06 AM, Amadou Coulibaly <mpapin24 at gmail.com>
> wrote:
>
>> Dear NCL users,
>>
>> I want to attach shapefile polylines to my wrf_contour plot, but I am
>> facing an issue. After downloading the country data from Global
>> Administrative Area, I wrote the command lines below:
>> ;---Start the graphics
>>        wks = gsn_open_wks("eps","wrf_latlonoverlay_16_ERA")
>>
>> ;---Set some basic plot options
>>       opts                     = True
>>       opts at MainTitle                    = "REAL-TIME WRF"
>>       opts at gsnDraw                       = False
>>         opts at gsnFrame                      = False
>>       ;opts at gsnAddCyclic             = False
>>
>>       pltres                 = True
>>       mpres                  = True
>>       mpres at mpGeophysicalLineColor      = "Black"
>>       mpres at mpNationalLineColor         = "Black"
>>       mpres at mpUSStateLineColor          = "Black"
>>       mpres at mpGridLineColor             = "Black"
>>       mpres at mpLimbLineColor             = "Black"
>>       mpres at mpPerimLineColor            = "Black"
>>       mpres at mpGeophysicalLineThicknessF = 2.0
>>       mpres at mpGridLineThicknessF        = 2.0
>>       mpres at mpLimbLineThicknessF        = 2.0
>>       mpres at mpNationalLineThicknessF    = 2.0
>>       mpres at mpUSStateLineThicknessF     = 2.0
>>
>>       opts at TimeLabel = times   ; Set valid time to use on plots
>>
>>       pressure = pressure_levels(0)
>>
>>       ; Add some level info to the plot
>>           opts at PlotLevelID = pressure + " hPa"
>> ;----------------------------------------------------------------------
>> ; Plot full domain first.
>> ;----------------------------------------------------------------------
>>       opts at cnFillOn = True
>>
>>       contour = wrf_contour(f,wks,Rot_avg(0,:,:),opts)
>>
>>   x = (/3., 4., 5., 6., 7./)
>>   y = (/3., 4., 5., 6., 7./)
>>
>>
>> ;-- polymarker resources
>>   pmres                        =  True
>>   pmres at gsMarkerColor          = "red"       ;-- marker color
>>   pmres at gsMarkerSizeF          =  0.03        ;-- set size of marker
>>   pmres at gsLineThicknessF       =  13.          ;-- marker line thickness
>>
>> ;-- draw all 16 markers on map using unique identifier name
>> ;-- and additional map attribute settings
>>   x = 3.                                 ;-- x-position of first marker
>>   y = 3.                                 ;-- y-position of first marker
>>   do i = 5,7,2                                     ;-- 16 different marker
>>      pmres at gsMarkerIndex = i+1
>>      str = unique_string("poly")            ;-- result is poly0-poly15
>>      contour@$str$ = gsn_add_polymarker(wks, contour, x+(i*11.3),
>> y+(i*8.5), pmres)
>>
>>
>>                                             ;-- add marker to map
>>   end do
>>
>>       plot = wrf_map_overlays(f,wks,(/contour/),pltres,mpres)
>>
>> ;---Attach shapefile polylines to map
>>   dir1       = "CIV_adm/"
>>   dir2       = "GHA_adm/"
>>   dir3       = "TGO_adm/"
>>   dir4       = "BEN_adm/"
>>   dir5       = "NGA_adm/"
>>
>>   filename1  = "CIV_adm0.shp"
>>   filename2  = "GHA_adm0.shp"
>>   filename3  = "TGO_adm0.shp"
>>   filename4  = "BEN_adm0.shp"
>>   filename5  = "NGA_adm0.shp"
>>
>>
>>   lnres                  = True
>>   lnres at gsLineThicknessF = 1.0
>>
>>   poly1 = gsn_add_shapefile_polylines(wks,plot,dir1+filename1,lnres)
>>   poly2 = gsn_add_shapefile_polylines(wks,plot,dir2+filename2,lnres)
>>   poly3 = gsn_add_shapefile_polylines(wks,plot,dir3+filename3,lnres)
>>   poly4 = gsn_add_shapefile_polylines(wks,plot,dir4+filename4,lnres)
>>   poly5 = gsn_add_shapefile_polylines(wks,plot,dir5+filename5,lnres)
>>
>>   draw(plot)
>>   frame(wks)
>> end
>>
>> But instead of overlaying country map with contour, I am getting two
>> separate plots one with contour and another one with country maps, as
>> showing attached plot.
>>
>> What,s wrong with my script? And how to put vertically the labelbar?
>>
>> Best regards
>>
>> --
>> * COULIBALY   AMADOU   *
>> PhD  Student  on  West  African  Climate  System (WACS)
>> FUTA - Federal  University  of  Technology of Akure, Nigeria
>>
>> *Visiting Student - *
>> *University of Cologne, Germany**Institute of Geophysics and Meteorology*
>> Pohligstr. 3 / Office 3.102
>> D-50969 Köln
>>
>> *Project*: WASCAL (West African Science Service Centre on Climate Change
>> and Adapted Land Use)
>> Phone:(+234) 812 965 3659 /(+223) 90 08 26 71 /(+226) 64 57 37 27 /+49
>> 15218352574
>>
>> E-mail: mpapin24 at gmail.com / coulibalya68 at yahoo.com
>>
>> "*The time is always right to do right": Nelson Mandela*
>>
>> *"Character is like a tree and reputation like a shadow.  The shadow is
>> what we think of it; the tree is the real thing" : Abraham Lincoln*
>>
>> *"Do what you can, with what you have, where you are" Theodore Roosevelt*
>>
>>
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>


-- 
* COULIBALY   AMADOU   *
PhD  Student  on  West  African  Climate  System (WACS)
FUTA - Federal  University  of  Technology of Akure, Nigeria

*Visiting Student - *
*University of Cologne, Germany**Institute of Geophysics and Meteorology*
Pohligstr. 3 / Office 3.102
D-50969 Köln

*Project*: WASCAL (West African Science Service Centre on Climate Change
and Adapted Land Use)
Phone:(+234) 812 965 3659 /(+223) 90 08 26 71 /(+226) 64 57 37 27 /+49
15218352574

E-mail: mpapin24 at gmail.com / coulibalya68 at yahoo.com

"*The time is always right to do right": Nelson Mandela*

*"Character is like a tree and reputation like a shadow.  The shadow is
what we think of it; the tree is the real thing" : Abraham Lincoln*

*"Do what you can, with what you have, where you are" Theodore Roosevelt*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160527/f4dfab4d/attachment.html 


More information about the ncl-talk mailing list