<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Michael,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Putting time values on the X axis in a nicely formatted way requires setting three "tmXB" resources:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"> res@tmXBMode = "Explicit"</div><div class="gmail_default" style="font-size:small"> res@tmXBValues = ...</div>
<div class="gmail_default" style="font-size:small"> res@tmXBLabels = ...</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">
The "tmXBValues" needs to be an array of values where you want tickmark labels, and the "tmXBLabels" needs to be an array of the same size containing the labels you want.</div><div class="gmail_default" style="font-size:small">
<br></div><div class="gmail_default" style="font-size:small">The array of values have to correspond to the time values representing your X axis, and not index values. Time values can come in many different formats, and that's why it was suggested you use "cd_calendar" to convert them to a format that's easy to process.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">You may be able to get by without having to use "cd_calendar", and instead you can use "time_axis_labels", which will set those three resources for you. Please see:</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style><a href="http://www.ncl.ucar.edu/Applications/time_labels.shtml">http://www.ncl.ucar.edu/Applications/time_labels.shtml</a><br>
</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">The first example shows how to set the tickmark labels by setting those three resources, and the second example shows how to do it using time_axis_labels.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you have further questions about this, it would help if you provided a "printVarSummary" of your time array, and a description of what kind of labels you want on the X axis.</div>
<div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"><br></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 8, 2014 at 3:16 AM, Hemming, Michael <span dir="ltr"><<a href="mailto:michael.hemming@mpimet.mpg.de" target="_blank">michael.hemming@mpimet.mpg.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<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 ("<a href="http://sector.nc" target="_blank">sector.nc</a>", "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 ("<a href="http://con.nc" target="_blank">con.nc</a>", "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>
;<a href="http://www.ncl.ucar.edu/Applications/Scripts/lat_time_3.ncl" target="_blank">http://www.ncl.ucar.edu/Applications/Scripts/lat_time_3.ncl</a><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>
</div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>