Re: Error using time_axis_labels

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 17 2014 - 11:47:31 MDT

Juki,

You will get these kind of errors if the spacing in your time array is "too irregular". This can happen if you have huge gaps in your time array, making it hard for NCL to determine how to place this on a linear axis.

I don't know what your time values look like, but look at the "cd_convert" function for converting them to different units.

See the second example at:

http://www.ncl.ucar.edu/Document/Functions/Contributed/cd_convert.shtml

If you continue to have problems with this, it would help if you could tell us what the time array looks like, and what units it has.

--Mary

On Mar 11, 2014, at 7:16 PM, juki juki <juky_emc2@yahoo.com> wrote:

> hi Arindam;
>
> I have added the code you suggested:
>
> resTick@ttmValues = (/(/2004,4,10,0,0,0/), \
> (/2004,4,14,0,0,0/), \
> (/2004,4,18,0,0,0/), \
> (/2004,4,22,0,0,0/), \
> (/2004,4,26,0,0,0/), \
> (/2004,4,30,0,0,0/)/)
>
> But the result is the same (see attached file). As I said before the following warning appear while running:
>
> warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for Y axis failed: consider adjusting trYTensionF value
> warning:IrTransInitialize: error creating spline approximation for trYCoordPoints; defaulting to linear
>
> Thanks again;
>
> juki
>
>
>
> On Tuesday, March 11, 2014 5:11 PM, Arindam Chakraborty <arch13@gmail.com> wrote:
> Hi Juki Juki,
> you need not mention all the 100 points there. You need to mention only those time values where you want tick marks. I guess, that cannot be more than 7 to 8.
>
> regards,
>
> --
> Dr Arindam Chakraborty
> CAOS, IISc, Bangalore-12
>
>
> On Tue, Mar 11, 2014 at 1:29 PM, juki juki <juky_emc2@yahoo.com> wrote:
> Dear Arindam;
>
> Thank you for reply. I got the following warning while running:
>
> warning:_NhlCreateSplineCoordApprox: Attempt to create spline approximation for Y axis failed: consider adjusting trYTensionF value
> warning:IrTransInitialize: error creating spline approximation for trYCoordPoints; defaulting to linear
>
> I will take time if I define the tick as:
>
> resTick@ttmValues = (/(/2008,01,01,00,00,00/), ; please make sure you change these dates according to your axis
> (/2008,01,02,00,00,00/),
> (/2008,01,03,00,00,00/)
> /)
> Because the data line is more than hundred.
>
> I send the result as the attached file. Thank you again.
>
> Juki
>
>
> On Tuesday, March 11, 2014 1:30 PM, Arindam Chakraborty <arch13@gmail.com> wrote:
> Hi Juki Juki,
> not appearance of tick marks could be due to more than one reasons. Do you have sufficient space between the axis and the left most margin of the plot area? You can also try using ttmValues to tick at the locations you want exactly. For example:
>
> resTick = True
> resTick@ttmFormat = "%d %c"
> resTick@ttmAxis = "YL"
> resTick@ttmValues = (/(/2008,01,01,00,00,00/), ; please make sure you change these dates according to your axis
> (/2008,01,02,00,00,00/),
> (/2008,01,03,00,00,00/)
> /)
>
> time_axis_labels(data&time, res, resTick )
> ...
>
>
> About your 2nd question, please see how to format tick marks, in ncl resources documentation. You might use tmXBFormat here.
>
>
> regards,
> --
> Dr Arindam Chakraborty
> CAOS, IISc, Bangalore-12
>
>
> On Tue, Mar 11, 2014 at 10:55 AM, juki juki <juky_emc2@yahoo.com> wrote:
> Dear All;
>
> I try to visualize my data to longitude versus time plot (code is given below). I use simple command as time_axis_labels(data&time, res, resTick ). However, the tick for the y axis (time) does not appear. Another question, the longitude (X-axis) is very narrow area (
> 100.225 - 100.475 E). How to make the tick mark visible for such
> narrow longitude ?
>
>
>
>
>
>
>
> Thanks for help
> joeky
>
>
>
>
>
>
>
>
>
>
>
>
>
> ------------------------
> 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/contrib/time_axis_labels.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>
>
> begin
> ; read in data
> ncols = 9 ;
> nrows = 596 ;
> data1 = asciiread ("CPEA2004_Ayu_230.txt", (/nrows,ncols/), "float")
>
> ; For data
>
> yyyy = floattointeger(data1(:,0)+2000);
> mm = floattointeger(data1(:,1));
> dd = floattointeger(data1(:,2));
> hh = floattointeger(data1(:,3));
> mn = floattointeger(fspan(0, 0, 596))
> sd = floattointeger(fspan(0, 0, 596))
>
> data=data1(:,4:8)
>
> if (any(isnan_ieee(data))) then
> value = 1.e20
> replace_ieeenan (data, value, 0)
> data@_FillValue = value
> end if
>
> time=new(dimsizes(yyyy),double)
> time@units = "days since 1800-01-01 00:00:00"
>
> do i=0,dimsizes(yyyy)-1
> time(i)=cd_inv_calendar(yyyy(i), mm(i),dd(i),hh(i),mn(i),sd(i),time@units, 0)
> end do
>
>
> lon = fspan(100.225,100.475, ncols-4)
> lon!0 = "lon"
> lon@units = "degrees_east"
>
>
> data!0 = "time"
> data!1 = "lon"
> data&time = time
> data&lon = lon
> data@long_name = "(a) Tb < 230 K"
> data@units = "K"
>
>
>
> wks = gsn_open_wks ("png", "hovTBB" ) ; open ps file
>
>
> gsn_define_colormap(wks, "cosam") ; choose colormap
> gsn_reverse_colormap(wks)
>
>
> setvalues NhlGetWorkspaceObjectId()
> "wsMaximumSize" : 600000000
> end setvalues
>
> res = True ; plot mods desired
> res@cnFillOn = True ; turn on color fill
> ; res@gsnSpreadColors = False ; use full range of colors
> res@cnLinesOn = False
> res@vpWidthF = 0.2
> res@vpHeightF = 0.4
>
> res@trYReverse = True
>
>
> ; res@tiMainString = "WESTWARD" ; title
> res@cnLevelSelectionMode = "ManualLevels" ; manual contour levels
> res@cnMinLevelValF = 140. ; min level
> res@cnMaxLevelValF = 230 ; max level
> ; res@cnLevelSpacingF = 10 ; contour level spacing
> res@pmLabelBarWidthF = 0.05
> res@pmLabelBarHeightF = 0.4
> res@lbOrientation = "Vertical"
> res@pmLabelBarOrthogonalPosF = -0.03 ; move label bar closer
> res@lbLabelStride = 1
>
> ; res@mpMinLonF = 80.
> ; res@mpMaxLonF = 130.
> res@txFontHeightF = 0.02 ; resize the text
> ; res@lbLabelFontHeightF = 0.02
> ; res@gsnMajorLonSpacing = 10
>
> ; res@gsnSpreadColorStart = -1 ; start with last color
> ; res@gsnSpreadColorEnd = 2 ; end with a beginning color
>
>
>
>
> res@gsnStringFontHeightF = 0.015
> ; now change the size of the tickmark labels
> res@tmXBLabelFontHeightF = 0.015 ; resize tick labels
> res@tmYLLabelFontHeightF = 0.015
> res@lbLabelFontHeightF = 0.015
>
>
> res@gsnLeftString = "Tb < 230 K"
> res@gsnRightString = "K"
> res@gsnRightStringParallelPosF=1.15
>
>
> resTick = True
> resTick@ttmFormat = "%d %c"
> resTick@ttmAxis = "YL"
> resTick@ttmMajorStride = 48
>
> time_axis_labels(data&time, res, resTick )
>
> plot = gsn_csm_hov(wks, data, res)
>
>
> end
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
>
>
>
> <hovTBB.png>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 17 11:47:47 2014

This archive was generated by hypermail 2.1.8 : Fri Mar 21 2014 - 15:49:21 MDT