[ncl-talk] Overlay Climatology temperature as contour line
Anahita Amiri Farahani
aamir003 at ucr.edu
Mon Sep 9 19:48:45 MDT 2019
Hi all,
I want to overlay climatology temperature on the potential temperature, but
it does not work. Here is my 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"
ana=addfile("pop_T_AFR_cam4.nc","r")
temp1_cam4=ana->temp1
temp1_diff_cam4=ana->temp1_diff
delete(ana)
ana=addfile("pop_parameters_T.nc","r")
lev_diff = ana->lev_diff
z_max = ana->z_max
lev = ana->lev
tlon_eq = ana->tlon_eq
z_t = ana->z_t
ulon=ana->ulon
y_eq=ana->y_eq
delete(ana)
;****** PLOT *******
wks = gsn_open_wks("eps","T_EQ_100_149")
res = True
res at gsnDraw = False
res at gsnFrame = False
res at sfYArray = z_t(:z_max)
res at sfXArray = tlon_eq
res at cnFillOn = True
res at cnFillPalette = "BlRe" ; set color map
res at cnLinesOn = False ; turn off countour lines
res at gsnDraw = False ; do not draw the plot
res at gsnFrame = False ; do not advance the frame
res at cnRasterSmoothingOn = True
res at cnLevelSelectionMode = "explicitLevels"
res at cnLevels = lev
res at tiYAxisString = "Depth (m)"
res at tiYAxisFontHeightF = .025
res at lbTitleString = "K" ; title string
res at lbTitlePosition = "Right" ; title position
res at lbTitleFontHeightF= .025 ; make title smaller
res at lbTitleDirection = "Across" ; title direction
res at tiMainString = "CAM4 potential temperature response" ; add
title
res at tmXBLabelsOn = True
res at tmXBMode = "explicit"
res at tmXBValues = (/ 150, 200, 250 /)
res at tmXBMinorValues = (/ 120, 130, 140, 160, 170, 180, 190, 210, 220, 230,
240, 260, 270, 280 /)
res at tmXBLabels = (/ "150~S~o~N~E", "200~S~o~N~E", "250~S~o~N~E" /)
res at cnLevelSelectionMode = "ManualLevels" ; AutomaticLevels
res at cnMinLevelValF = -3 ; min level
res at cnMaxLevelValF = 3 ; max level
res at cnLevelSpacingF = 0.25 ; interval
plot = gsn_csm_contour(wks,temp1_diff_cam4(:z_max,:),res)
sres = True ; set up a second resource
list
sres at gsnDraw = False ; do not draw the plot
sres at gsnFrame = False ; do not advance the frame
sres at cnLinesOn = True ; turn the contour lines on
sres at cnLineLabelsOn = True ; turn the line labels on
sres at cnLevelSelectionMode = "AutomaticLevels" ; AutomaticLevels
sres at cnLineLabelPlacementMode = "constant"
sres at cnLineLabelBackgroundColor = -1 ; transparent
sres at cnLineThicknessF = 1.5
sres at gsnContourNegLineDashPattern = 1 ; sets negative contours to
dash pattern 1
sres at cnLineLabelFontHeightF = 0.005
sres at cnLineColor = "NavyBlue"
plot_ov = gsn_csm_contour(wks,temp1_cam4(:z_max,:),sres) ; create the
U-wind plot
overlay(plot,plot_ov)
draw(plot) ; draw the temperature plot
(with the climatology temp overlaid)
frame(wks)
delete(wks)
Thanks,
Ana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190909/b7731145/attachment.html>
More information about the ncl-talk
mailing list