[ncl-talk] overlaying data on the map
Ciao Kai Liang
ciaokailiang at gmail.com
Fri Jul 8 01:16:49 MDT 2016
Dear alll ncl users,
I try to make a plot of overlaying the wind speed (vector) and the ozone
concentration (contour) on the map. The wind speed vector is from MCIP
output and ozone concentration from CMAQ model. No error message occurs but
I get blank on the map(attached). Is something wrong in my script? Thx in
advance.
Joe
;read files=============================================================
f1 = addfile("METDOT3D","r")
f2 = addfile("CCTM_D502a_Linux2_x86_64ifort.ACONC.CMAQ20101001.nc","r")
u = f1->UWINDC(0,0,:,:) ;U at timestep 0 by 90X135
v = f1->VWINDC(0,0,:,:) ;V at timestep 0 by 90X135
ox = f2->O3(0,0,:,:) ;ozone concentration at timestep 0 by 90X135
;set evn===============================================================
wks = gsn_open_wks("png","overlay")
gsn_define_colormap(wks,"WhiteBlueGreenYellowRed")
vcres = True ;Vector
vcres at gsnDraw = False
vcres at gsnFrame = False
cnres = vcres ;Contour
mpres = vcres ;Map
;Contour===============================================================
cnres at gsnDraw = False
cnres at gsnFrame = False
cnres at cnFillOn = True
cnres at cnFillMode = "RasterFill" ; use raster mode
cnres at cnLinesOn = False
cnres at tmYROn = False ; Turn off right tickmarks.
cnres at tmXTOn = False ; Turn off top tickmarks.
cnres at tmXBLabelFont = "times-roman"
cnres at tmYLLabelFont = "times-roman"
cnres at gsnMaximize = True ; Maximize the plot where it
is drawn
cnres at gsnSpreadColors = True ; use full colormap
cnres at cnLevelSelectionMode = "ManualLevels"
cnres at cnMinLevelValF = 10. ; set the minimum contour level
cnres at cnMaxLevelValF = 120. ; set the maximum contour level
cnres at cnLevelSpacingF = 10. ; set the contour interval
cnres at lbLabelStride = 1
cnres at lbLabelFont = "times-roman"
cnres at tmXBLabelFontHeightF = 0.015
cnres at tmYLLabelFontHeightF = 0.015
;Vector=============================================
vcres at vcLevelSelectionMode = "ManualLevels"
vcres at vcMinLevelValF = -20.0
vcres at vcMaxLevelValF = 100.0
vcres at vcLevelSpacingF = 10.0
vcres at vcLevelPalette = "amwg_blueyellowred" ; assign
color map to vectors
vcres at vcGlyphStyle = "LineArrow"
vcres at vcLineArrowThicknessF = 5
vcres at vcMinDistanceF = 0.01
vcres at vcRefLengthF = 0.03
vcres at vcGlyphStyle = "WindBarb"
vcres at vcWindBarbLineThicknessF = 5
vcres at vcWindBarbColor = "Gray40"
vcres at vcRefAnnoOn = True
vcres at vcRefMagnitudeF = 30
vcres at vcRefAnnoString1 = "30"
vcres at vcRefAnnoSide = "Top"
vcres at vcRefAnnoString2On = False
vcres at vcRefAnnoPerimOn = False
vcres at vcRefAnnoOrthogonalPosF = -0.12
vcres at vcRefAnnoParallelPosF = 0.999
vcres at vcRefAnnoBackgroundColor = "Purple"
vcres at vcVectorDrawOrder = "PostDraw"
vcres at gsnRightString = "Wind"
;Map============================================
mpres at mpProjection = "LambertConformal"
mpres at mpLambertParallel1F = 10.0
mpres at mpLambertParallel2F = 40.0
mpres at mpLambertMeridianF = 120.0
mpres at tfDoNDCOverlay = True
mpres at mpLimitMode = "Corners"
mpres at mpLeftCornerLonF = LON(0,0,0,0)
mpres at mpLeftCornerLatF = LAT(0,0,0,0)
mpres at mpRightCornerLonF =
LON(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)
mpres at mpRightCornerLatF =
LAT(0,0,dimsizes(LAT(0,0,:,0))-1,dimsizes(LAT(0,0,0,:))-1)
mpres at mpDataSetName = "Earth..4" ; This new database contains
mpres at mpDataBaseVersion = "MediumRes" ; Medium resolution database
mpres at mpOutlineOn = True ; Turn on map outlines
mpres at mpFillOn = True
mpres at mpOutlineBoundarySets = "AllBoundaries"
mpres at mpGridAndLimbOn = True
mpres at mpGridLineDashPattern = 2
mpres at mpCenterRotF = 90.0
mpres at mpLabelsOn = False
mpres at mpPerimOn = True
mpres at mpGridAndLimbOn = False
mpres at mpOutlineDrawOrder = "PostDraw"
mpres at mpFillDrawOrder = "Predraw"
mpres at mpOceanFillColor = "lightskyblue1"
mpres at mpLandFillColor = "gray"
mpres at mpGridAndLimbDrawOrder = "Predraw"
mpres at tiMainString = "October 1 2010 ozone concentration(ppm)"
;=====================================================================
vcid = gsn_csm_vector(wks,u,v,vcres)
cnid = gsn_csm_contour(wks,ox*1000.,cnres)
mpid = gsn_csm_map(wks,mpres)
;---Attach the shapefile polylines using files read off gadm.org/country.
lnres = True
lnres at gsLineColor = "gray25"
lnres at gsLineThicknessF = 1.0
twn_id = gsn_add_shapefile_polylines(wks,mpid,sfile,lnres)
;---Overlay contour, streamline, and vector plots on the map plot.
overlay(mpid,cnid)
overlay(mpid,vcid)
draw(mpid)
frame(wks)
maximize_output(wks,True)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160708/bcd0cd95/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: overlay.png
Type: image/png
Size: 53352 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160708/bcd0cd95/attachment.png
More information about the ncl-talk
mailing list