Re: Overlay National country map

From: Adam Phillips <asphilli_at_nyahnyahspammersnyahnyah>
Date: Mon, 26 Nov 2007 12:51:12 -0700

Hi Louis,

I would suggest following the procedure outlined in polyline example #9:
http://www.ncl.ucar.edu/Applications/Scripts/polyg_9.ncl
http://www.ncl.ucar.edu/Applications/polyg.shtml#ex9

For instance (untested):

nlin = 4401
ncol = 2
xca = asciiread("./xcamair_contour",(/nlin,ncol/),"float")

wks = gsn_open_wks("ps", "native")
<snip>
res_at_gsnFrame = False
plot = gsn_csm_contour_map(wks,fsd(0,:,:),res) ; create plot

resp = True ; polyline mods desired
resp_at_gsLineColor = "black" ; color of lines
resp_at_gsLineThicknessF = 2.0 ; thickness of lines

dum = new(nlin,graphic)
do gg = 0,dimsizes(nlin)-2
    dum(gg)=gsn_add_polyline(wks,plot,xca(gg:gg+1,1),xca(gg:gg+1,0),resp)
end do

Hope that helps...
Adam

louis Vonder wrote:
> Dear NCL users,
> I am trying to do something like in figure "topo_grey.jpg" which I
> plotted by GMT (Generic Mapping Tools).
>
> The file "Xcamair_contour" come from GMT. I am trying to used the same
> file to plot cameroon border. Despite multiple modifications of NCL
> code I am not able to use it and plot what I want.
>
>
> Thanks for help
>
> Here the NCL script I am using
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> ;*****************************************************
> begin
>
> nlin = 4401
> ncol = 2
> xca = asciiread("./xcamair_contour",(/nlin,ncol/),"float")
>
>
> f1 = addfile("./topo.nc","r")
>
>
> fsd=f1->HT
>
> lat = fsd&lat
> lon = fsd&lon
> nlat = dimsizes(lat)
> ;print(nlat)
> nlon = dimsizes(lon)
> ;print(nlon)
> ;**************************************
> ; Create plot
> ;***************************************
> wks = gsn_open_wks("ps", "native")
> ; gsn_define_colormap(wks,"BlGrYeOrReVi200") ; choose color map
> ; gsn_define_colormap(wks,"BlGrYeOrReVi200")
> ; i = NhlNewColor(wks,0.7,0.7,0.7) ; add gray to colormap
>
> gsn_define_colormap (wks,"gsltod") ; choose colormap
> setvalues wks
> "wkColorMap" : "gsltod"
> "wkForegroundColor" : (/0.,0.,0./)
> "wkBackgroundColor" : (/1.,1.,1./)
> end setvalues
>
>
> res = True ; plot mods desired
>
> res_at_cnFillOn = True ; turn on color
> res_at_cnLinesOn = False ; no contour lines
> res_at_gsnSpreadColors = True ; use full color map
>
> res_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour
> levels
> res_at_cnMinLevelValF = 0. ; set min contour level
> res_at_cnMaxLevelValF = 4200 ; set max contour
> level
> res_at_cnLevelSpacingF = 400 ; contour spacing
>
>
> res_at_gsnSpreadColors = True ; use full color map
> res_at_gsnSpreadColorEnd = -3 ; don't use added gray
> res_at_lbOrientation ="vertical" ; vertical label bar
>
> res_at_mpDataBaseVersion = "Ncarg4_1" ; use finer database
> res_at_pmTickMarkDisplayMode = "Always" ; turn on tickmarks
>
> res_at_gsnAddCyclic = False ; regional data,
> don't add pt
>
> res_at_mpProjection = "mercator" ; projection
> res_at_mpLimitMode = "Corners" ; method to zoom
> res_at_mpLeftCornerLatF = min(lat)
> res_at_mpLeftCornerLonF = min(lon)
> res_at_mpRightCornerLatF = max(lat)
> res_at_mpRightCornerLonF = max(lon)
> res_at_tfDoNDCOverlay = True ; do not transform data
>
> ; res_at_cnLineLabelsOn = True
> res_at_cnLineLabelBackgroundColor = "white" ; white bckgrnd around
> label
> res_at_cnLineLabelDensityF = 1.0
> res_at_cnLevelSpacingF = 400
>
> res_at_tiMainString ="TOPOGRAPHY"
> plot = gsn_csm_contour_map(wks,fsd(0,:,:),res) ; create plot
>
>
>
> end
>
>
> ------------------------------------------------------------------------
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails
> <http://www.trueswitch.com/yahoo-fr/> vers Yahoo! Mail
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
--------------------------------------------------------------
Adam Phillips			             asphilli_at_ucar.edu
National Center for Atmospheric Research   tel: (303) 497-1726
ESSL/CGD/CAS                               fax: (303) 497-1333
P.O. Box 3000				
Boulder, CO 80307-3000	  http://www.cgd.ucar.edu/cas/asphilli
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Nov 26 2007 - 12:51:12 MST

This archive was generated by hypermail 2.2.0 : Tue Nov 27 2007 - 07:07:11 MST