<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hello,<br>
<br>
I am creating panel plots using gsn_csm_contour. The data I use has been chosen from a 4d matrix prior to plotting. The metadata is correct for longitude but not for the time axis. I would like to show the time in years, 1-100.
<br>
<br>
time metadata:<br>
<br>
tho = hours, 365_day<br>
potT = days, preleptic_gregorian<br>
<br>
<br>
Here is my code:<br>
<br>
<br>
<span style="background-color: rgb(255, 255, 153);">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<br>
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
<br>
begin<br>
<br>
;##########################################################################<br>
;##########################################################################<br>
;-------------------------Temperature Profile------------------------------<br>
;--------------------------------------------------------------------------<br>
;##########################################################################<br>
;##########################################################################<br>
<br>
;----------Load in data<br>
<br>
;MPIOM<br>
<br>
data12 = addfile ("sector.nc", "r")<br>
tho = data12->tho<br>
<br>
<br>
variables = getfilevarnames(data12)<br>
<br>
print(" ")<br>
print(" MPIOM temperature data Information:")<br>
print(" ")<br>
print(variables)<br>
printVarSummary(tho)<br>
<br>
;ICON<br>
<br>
noshupw = addfile ("con.nc", "r")<br>
potT = noshupw->t_acc<br>
potT&lon = potT&lon-360 ; Fix the longitudes to be < 360<br>
<br>
<br>
;variables = getfilevarnames(noshupw)<br>
print(" ")<br>
print("ICON temperature data information:")<br>
print(" ")<br>
print(variables)<br>
printVarSummary(potT)<br>
<br>
<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
<br>
;--------------Hovmuller T comparison plots<br>
<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
;--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%--%<br>
<br>
;http://www.ncl.ucar.edu/Applications/Scripts/lat_time_3.ncl<br>
<br>
;*********************************************<br>
; manipulate data for plotting<br>
;*********************************************<br>
<br>
dm = rm_single_dims(tho({depth|7},{lon|-30:-30},lat|:,time|:)) <br>
di = rm_single_dims(potT({depth|7},{lon|-30:-30},lat|:,time|:)) <br>
<br>
dm30S = rm_single_dims(tho({depth|7},lon|:,{lat|-30:-30},time|:)) <br>
di30S = rm_single_dims(potT({depth|7},lon|:,{lat|-30:-30},time|:)) <br>
<br>
dmeq = rm_single_dims(tho({depth|7},lon|:,{lat|0:0},time|:)) <br>
dieq = rm_single_dims(potT({depth|7},lon|:,{lat|0:0},time|:)) <br>
<br>
dm30N = rm_single_dims(tho({depth|7},lon|:,{lat|30:30},time|:)) <br>
di30N = rm_single_dims(potT({depth|7},lon|:,{lat|30:30},time|:)) <br>
<br>
<br>
printVarSummary(dm)<br>
printVarSummary(di)<br>
printVarSummary(dm30S)<br>
printVarSummary(di30S)<br>
<br>
;------Plotting<br>
<br>
wks = gsn_open_wks("x11", "T)<br>
<br>
res = True<br>
res@cnFillOn = True<br>
<br>
plot = new(2,graphic)<br>
<br>
res@gsnDraw = False ; don't draw<br>
res@gsnFrame = False ; don't advance frame<br>
<br>
resP = True ; modify the panel plot<br>
resP@gsnMaximize = True <br>
res@tiMainFontHeightF = 0.02<br>
resP@txFontHeightF = 0.015<br>
resP@txString = "Temperature at the surface with time at a longitude of 30W"<br>
<br>
res@tiMainString = "M" <br>
plot(0) = gsn_csm_contour(wks,dm,res)<br>
<br>
res@tiMainString = "I" <br>
plot(1) = gsn_csm_contour(wks,di,res)<br>
<br>
;gsn_panel(wks,plot,(/1,2/),resP) <br>
<br>
;----------------------------surface plot<br>
<br>
<br>
wks = gsn_open_wks("x11", "T_HOVMULLER_MPIOM_ICON_surface_30N")<br>
<br>
res = True<br>
res@cnFillOn = True<br>
<br>
plot1 = new(2,graphic)<br>
<br>
res@gsnDraw = False ; don't draw<br>
res@gsnFrame = False ; don't advance frame<br>
<br>
<br>
resP@gsnMaximize = True <br>
res@tiMainFontHeightF = 0.02<br>
resP@txFontHeightF = 0.015<br>
resP@txString = "Temperature at the surface with time at a latitude of 30N"<br>
res@lbLabelBarOn = False <br>
res@cnLevelSelectionMode = "ManualLevels" <br>
res@cnMinLevelValF = 3.<br>
res@cnMaxLevelValF = 7.<br>
res@cnLevelSpacingF = 0.2 <br>
res@cnSpanFillPalette = True<br>
resP@gsnPanelLabelBar = True <br>
<br>
res@tiMainString = "M <br>
plot1(0) = gsn_csm_contour(wks,dm30N,res)<br>
<br>
res@tiMainString = "I <br>
plot1(1) = gsn_csm_contour(wks,di30N,res)<br>
<br>
gsn_panel(wks,plot1,(/1,2/),resP) <br>
<br>
<br>
<br>
<br>
<span style="background-color: rgb(255, 255, 255);">I have been told I can use cd_calendar but this involves creating a new variable 'time' which I would like to avoid. Another option was to change the tick labels but I am not sure how to do this using gsn_csm_contour.
<br>
<br>
thanks,<br>
Michael<br>
</span></span><br>
</div>
</body>
</html>