[ncl-talk] How to make the out of boundary white
Dana Odeh
danaodeh21 at gmail.com
Mon Apr 25 01:01:53 MDT 2022
Hello
How to make the out of boundary white i want just jordan has the
information about precipitation not out
this tihs my code
can you please help me i saw example 4 but i did not understand ant thing
;open file
a=addfile("ens_prAdjust_EUR-11_rcp45_1986-2005.nc","r")
b=addfile("ens_prAdjust_EUR-11_rcp45_2046-2065.nc","r")
c=addfile("ens_prAdjust_EUR-11_rcp45_2081-2100.nc","r")
d=addfile("ens_prAdjust_EUR-11_rcp85_1986-2005.nc","r")
e=addfile("ens_prAdjust_EUR-11_rcp85_2046-2065.nc","r")
f=addfile("ens_prAdjust_EUR-11_rcp85_2081-2100.nc","r")
apr=a->prAdjust(0,:,:)
bpr=b->prAdjust(0,:,:)
cpr=c->prAdjust(0,:,:)
epr=d->prAdjust(0,:,:)
dpr=e->prAdjust(0,:,:)
fpr=f->prAdjust(0,:,:)
apr at units=" "
bpr at units=" "
cpr at units=" "
dpr at units=" "
epr at units=" "
fpr at units=" "
apr at long_name= " "
bpr at long_name= ""
cpr at long_name= ""
dpr at long_name= " "
epr at long_name= ""
fpr at long_name= ""
pltDir = "./"
pltName= "ppn_rain_Euro23"
pltType= "png"
pltPath = pltDir+pltName
wks = gsn_open_wks(pltType, pltPath)
; Create the plots for the panel
nrow = 2
ncol = 3
gsn_define_colormap(wks,"cmocean_deep")
plot =new (nrow*ncol,”graphic”) ; create graphical array
res = True
res at gsnDraw = False
res at gsnFrame = False
res at gsnRightString = "" ; turn off special titles
res at gsnLeftString = ""
res at cnFillOn = True ; turn on contour fill
res at cnLinesOn = False ; turn off contour lines
res at cnLineLabelsOn = False ; turn off contour labels
res at cnFillPalette = "cmocean_deep"
res at gsnAddCyclic = False ; regional
data, don't add cyclic
; Set resources for tickmarks
res at tmYLLabelsOn = True ; turn off lat labels
res at tmXBLabelsOn = True ; turn off lon labels
res at tmYROn = False
res at tmYLOn = False
res at tmXTOn = False
res at tmXBOn = False
res at mpFillDrawOrder = "PostDraw" ; draw map fill last
res at mpLimitMode = "LatLon"
res at mpFillOn = False
res at mpOutlineOn = False
res at mpDataBaseVersion = "HighRes"
res at mpDataSetName = "Earth..4"
; res at mpOutlineOn = True
; res at mpOutlineBoundarySets = "National"
;res at mpGeophysicalLineThicknessF = 2.5
minlat = 29
maxlat = 33.56
minlon = 34.63
maxlon = 39.691
; select a subregion
res at mpMinLonF = minlon
res at mpMaxLonF = maxlon
res at mpMinLatF = minlat
res at mpMaxLatF = maxlat
res at cnFillPalette = "cmocean_deep"
nlon=30.5852
nlat=36.2384
res at lbLabelBarOn = False ; turn off labelbar
res at lbOrientation = "horizontal"
res at cnLevelSelectionMode = "ManualLevels" ; manually specify
contour levels
res at cnMinLevelValF = 0 ; min level
res at cnMaxLevelValF = 600 ; max level
res at cnLevelSpacingF = 50 ; contour interval
txres = True
txres at txFontHeightF = 0.03
gsn_text_ndc(wks," Mean Annual precipitation ",0.5,0.95,txres)
res at gsnCenterString = "1986-2005"
Plot0=gsn_csm_contour_map(wks,apr,res)
res at gsnCenterString = "2046-2065"
Plot1=gsn_csm_contour_map(wks,bpr,res)
res at gsnCenterString = "2081-2100"
Plot2=gsn_csm_contour_map(wks,cpr,res)
res at gsnCenterString = " "
Plot3=gsn_csm_contour_map(wks,dpr,res)
res at gsnCenterString = " "
Plot4=gsn_csm_contour_map(wks,epr,res)
res at gsnCenterString = " "
Plot5=gsn_csm_contour_map(wks,fpr,res)
res at gsnCenterString = ""
filename1 = "gadm40_JOR_1.shp"
filename2 = "jordan_water.shp"
lnres = True
lnres at gsLineThicknessF = 3.0
poly1 = gsn_add_shapefile_polylines(wks,Plot0,filename1,lnres)
poly2 = gsn_add_shapefile_polylines(wks,Plot0,filename2,lnres)
poly3 = gsn_add_shapefile_polylines(wks,Plot1,filename1,lnres)
poly4 = gsn_add_shapefile_polylines(wks,Plot1,filename2,lnres)
poly5 = gsn_add_shapefile_polylines(wks,Plot2,filename1,lnres)
poly6 = gsn_add_shapefile_polylines(wks,Plot2,filename2,lnres)
poly7 = gsn_add_shapefile_polylines(wks,Plot3,filename1,lnres)
poly8 = gsn_add_shapefile_polylines(wks,Plot3,filename2,lnres)
poly9 = gsn_add_shapefile_polylines(wks,Plot4,filename1,lnres)
poly10 = gsn_add_shapefile_polylines(wks,Plot4,filename2,lnres)
poly11 = gsn_add_shapefile_polylines(wks,Plot5,filename1,lnres)
poly12 = gsn_add_shapefile_polylines(wks,Plot5,filename2,lnres)
res at mpOutlineBoundarySets = "National"
mask_areas ="Jordan"
res at mpMaskAreaSpecifiers = mask_areas
res at mpOutlineSpecifiers = mask_areas
res at mpLandFillColor = 0
res at mpInlandWaterFillColor = 0
res at mpFillDrawOrder = "PostDraw”
resP = True
resP at cnExplicitLabelBarLabelsOn = True
resP at gsnPanelLabelBar = True ; turn on a common labelbar for the
entire panel plot
resP at lbTitlePosition = "Bottom" ; put it below the plot
resP at lbTitleString = "mm/year" ; give the labelbar a title
resP at lbTitleFontHeightF = 0.018 ; tweak the size of the labelbar
title
resP at lbTitleOffsetF = 0.2 ; positive values are up when the labelbar
is under the plot
;resP at gsnMaximize = True
;resP at lbTitleFontHeightF = .03 ; make title smaller
resP at lbTitleDirection = "Across" ; title
direction
resP at lbLabelStride = 2
; resP at lbLabelFontHeightF = 0.025
resP at pmLabelBarHeightF = 0.1
resP at lbBoxEndCapStyle = "TriangleBothEnds"
resP at pmLabelBarOrthogonalPosF = -0.02 ; move whole thing down
resP at gsnFrame = True
resP at gsnPanelLeft = 0.005
resP at gsnPanelBottom = 0.08
resP at gsnPanelSave = True
gsn_panel(wks,(/ Plot0, Plot1, Plot2, Plot3, Plot4, Plot5/),
(/nrow,ncol/), resP) ; plots
draw(plot)
frame(wks)
thankyou
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220425/9164a118/attachment.html>
More information about the ncl-talk
mailing list