[ncl-talk] Terrain and SST
Andrea Perez
andreaperez151 at yahoo.es
Fri Feb 8 10:17:52 MST 2019
Hello, I am using MM5 ouput and I want to plot terrain, wind vector and SST in a map. I have tried with a mask, res_base but nothing works. Can any one help me??
code:load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin f1=addfile("data.nc","r")
lat=f1->latitcrs lon=f1->longicrs dims=dimsizes(lat) lat2d=(/lat/) lat2d at units = "degreeN" lon2d=(/lon/) lon2d at units = "degreeE"
ter=f1->terrain ter at lat2d=lat2d ter at lon2d=lon2d
u=f1->u10 v=f1->v10 u at lat2d=lat2d u at lon2d=lon2d v at lat2d=lat2d v at lon2d=lon2d med=ter
ts = f1->tseasfc(24,:,:) ts = (ts*1) ts at lat2d=lat2d ts at lon2d=lon2d
;****************************************************************************** wks = gsn_open_wks("eps","terrain_sst") ; open a workstation;******************************************************************************
res = True res at gsnDraw = False res at gsnFrame = False res at mpProjection = "Mercator" res at cnLinesOn = False res at cnFillOn = True ; color plot desired res at mpOutlineDrawOrder = "PostDraw" res at mpFillDrawOrder = "Predraw" res at gsnSpreadColors = True res at cnLevelSelectionMode = "ManualLevels" res at lbLabelAutoStride = True res at cnLineLabelsOn = False ; turn off contour lines res at cnFillDrawOrder = "Predraw" res at mpDataBaseVersion = "HighRes" ; res at mpProjection = "Mercator" res at mpDataBaseVersion = "HighRes" res at mpLimitMode = "Corners" ; choose range of map res at mpLeftCornerLatF = lat2d(0,0) res at mpLeftCornerLonF = lon2d(0,0) res at mpRightCornerLatF = lat2d(dims(0)-1,dims(1)-1) res at mpRightCornerLonF = lon2d(dims(0)-1,dims(1)-1)
; res at tfDoNDCOverlay = True
res at mpGeophysicalLineColor = "black" ; color of continental outlines res at mpPerimOn = True ; draw box around map res at mpGridLineDashPattern = 2 ; lat/lon lines as dashed res at mpOutlineBoundarySets = "GeophysicalAndUSStates" ; add state boundaries res at mpUSStateLineColor = "black" ; make them red res at mpOutlineOn = True res at mpDataBaseVersion = "MediumRes" res at mpDataSetName = "Earth..4" res at mpOutlineBoundarySets = "National" res at mpGeophysicalLineColor = "black" ; color of cont. outlines res at mpGeophysicalLineThicknessF = 3 ; thickness of outlines res at mpNationalLineThicknessF = 3 ; interior boundaries ;********************************************************** ter_res = res ;***********************Terrain**************************** ter_res at cnMinLevelValF = 0 ter_res at cnMaxLevelValF = 3000 ter_res at cnLevelSpacingF = 250 ter_res at cnFillPalette = "OceanLakeLandSnow" ; choose colormap ter_res at mpFillOn = False ;**************************SST***************************** res_base = res res_base at cnFillOn = True ; turn on color fill res_base at cnLinesOn = False ; turn off contour lines res_base at lbLabelStride = 1 ; every 4th label
res_base at lbLabelAutoStride = True res_base at cnLevelSelectionMode = "ManualLevels" res_base at cnMinLevelValF = 296 res_base at cnMaxLevelValF = 303 res_base at cnLevelSpacingF = 1 res_base at cnLineLabelsOn = False ; turn off contour lines res_base at tiMainString = "Draw land ON TOP of contours" ; title res_base at cnFillDrawOrder = "Predraw" ; draw contours firs
;**************Create the two plots************************
ter_plot = gsn_csm_contour_map(wks,ter,ter_res) sst_plot = gsn_csm_contour(wks,ts,res_base)
;*************Overlay the sst plot on the terrain plot***** overlay(sst_plot,ter_plot)
;---Drawing the terrain plot will also draw dbz plot draw(ter_plot) frame(wks)
;---Remove the dbz plot from terrain plot so we can re-overlay it on a new plot NhlRemoveOverlay(ter_plot,sst_plot,False)
;---Recreate the terrain plot with a fully opaque labelbar ter_res at lbOverrideFillOpacity = True ; don't apply opacity to labelbar colors ; (NCL V6.4.0 and later) ter_plot = gsn_csm_contour_map(wks,ts,ter_res) ;--Re-overlay the dbz plot on the new terrain plot. overlay(ter_plot,sst_plot)
;---Drawing the terrain plot will also draw dbz plot draw(ter_plot) frame(wks)
maximize_output(wks,True)
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190208/0cff4c22/attachment.html>
More information about the ncl-talk
mailing list