[ncl-talk] map outline using shapefile

Debasish Hazra debasish.hazra5 at gmail.com
Tue Nov 27 19:53:20 MST 2018


Thanks Adam.I applied your changes and it removed double lines over India,
but it still not drawing other neighbouring country borders. Here is the
script I am using and attached is current figure generated :

plot_A   = new (2 , graphic)                    ; create graphical array
  res      = True               ; plot options desired
   USE_SHAPEFILE_OUTLINES = True
  res at gsnDraw = False
  res at gsnFrame = False
  res at gsnMajorLatSpacing = 10             ; change maj lat tm spacing
  res at gsnMajorLonSpacing = 20
 res at cnLinesOn            = False
  res at cnFillOn             = True               ; turn on color fill
  res at cnInfoLabelOn        = False              ; turn off contour info
label
  res at cnLineLabelsOn       = False              ; turn off line labels
   res at cnFillDrawOrder  = "Predraw"
  res at gsnSpreadColors      = True            ; use full color table
  res at mpFillOn             = False              ; do not grey fill land
  res at lbLabelBarOn         = False           ; turn off individual color
bars
  res at gsnStringFontHeightF = 0.018
  res at tmYRMode             = "Automatic"          ; turn off special labels
on right axis
  res at lbAutoManage          = False             ; we control label bar
  if(USE_SHAPEFILE_OUTLINES) then
       res at mpOutlineOn               = False
  else
;       res at mpOutlineOn               = True
;        res at mpOutlineBoundarySets = "National"
       res at mpDataBaseVersion         = "MediumRes"        ; higher
resolution basemap
       res at mpDataSetName             = "Earth..4"         ; contains
divisions for other countries
        res at mpOutlineMaskingOn = True
        res at mpMaskOutlineSpecifiers = "Indian:states"
    end if

   res at mpLimitMode = "Corners"
   res at mpLeftCornerLatF  =  0.0
   res at mpLeftCornerLonF  =  50.0
   res at mpRightCornerLatF =  40.0
   res at mpRightCornerLonF =  100.0

   res at gsnDraw = False
   res at gsnFrame = False
    res at gsnLeftString = ""
    res at gsnRightString = ""

        res at gsnCenterString   = labes(0)
        plot_A(0) = gsn_csm_contour_map_ce (wks, rainl(:,:), res)
        res at gsnCenterString   = labes(1)
        plot_A(1) = gsn_csm_contour_map_ce (wks, rain2(:,:), res)

         if(USE_SHAPEFILE_OUTLINES) then
         lnres= True
         ind_met =
gsn_add_shapefile_polylines(wks,plot_A,"./Indian_met_zones-master/indian_met_zones.v2.shp",lnres)
         end if
   pres1                     = True               ; panel options
   pres1 at gsnFrame         = False
   pres1 at gsnDraw = True
  pres1 at gsnMaximize         = True               ; maximize image
  pres1 at gsnPanelLabelBar    = True               ; Add common label bar

 gsn_panel(wks,plot_A,(/1,2/),pres1)
       ;draw(plot)
frame(wks)

Any help.
Thanks
Debasish

On Tue, Nov 27, 2018 at 3:43 PM Adam Phillips <asphilli at ucar.edu> wrote:

> Hi Debasish,
> I am guessing your shapefile outlines are more precise than NCL's built in
> outlines, and that's why you're getting double boundaries being shown. I
> would suggest continuing what you're doing, but tell NCL to exclude drawing
> the Indian states by utilizing the mpMaskOutlineSpecifiers:
> res at mpDataBaseVersion       = "MediumRes"
> res at mpDataSetName         = "Earth..4"
> res at mpOutlineMaskingOn = True
> res at mpMaskOutlineSpecifiers = "Indian:states"    ; do not draw any
> outlines specified here
>
>
> http://www.ncl.ucar.edu/Document/Graphics/Resources/mp.shtml#mpMaskOutlineSpecifiers
> Example showing mpMaskOutlineSpecifier use:
> http://www.ncl.ucar.edu/Applications/Scripts/maponly_14.ncl
> Example showing how to specify Indian states:
> http://www.ncl.ucar.edu/Applications/Scripts/maponly_16.ncl
>
> If you have any further questions let ncl-talk know.
> Adam
>
>
> On Tue, Nov 27, 2018 at 1:16 PM Debasish Hazra <debasish.hazra5 at gmail.com>
> wrote:
>
>> Hi,
>> I am using shapefile to draw outline over India following polyg_shp_9.ncl
>> example. However, my plotting domain covers other area besides India and
>> when I am using
>>  lnres= True
>>  ind_met =
>> gsn_add_shapefile_polylines(wks,plot_A,"./Indian_met_zones-master/indian_met_zones.v2.shp",lnres)
>> in combination with
>> res at mpOutlineOn               = False
>>
>> I am getting outline of India only, with neighboring counties boundaries
>> not drawn.
>>
>> But when I am using
>> res at mpOutlineOn               = True
>> in combination with the above mentioned shapefile over India, I am
>> getting double line borders over India (coming from both India met
>> shapefile and ncl map outline). I have attached both resulting figures. How
>> do I  solve this to combine both in proper way ?
>>
>> Thanks
>> Debasish
>> _______________________________________________
>> 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/20181127/8f97b38d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mapoutiline.png
Type: image/png
Size: 133127 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20181127/8f97b38d/attachment.png>


More information about the ncl-talk mailing list