could not convert date correctly

From: huiping yan <yanhp2009_at_nyahnyahspammersnyahnyah>
Date: Thu Dec 27 2012 - 11:28:14 MST

Hi there,

I want to generate date for some variables but the results seems not
correct. And wonder if anyone could help me.

The scripts are:

;;;;;;;;;;;;;;;;;; generate time;;;;;;;;;;;;;;;;;;;;;;

time=ispan(0,24-1,1)*1/24.

time@units="days since 2011-05-01 00:00:0.0"

time@long_name = "time" ;

time@calendar = "noleap" ;

time@bounds = "time_bnds"

ut=cd_calendar(time,0) ;;; converts to time(size[TIME], 6) => YYYY, MM, DD,
HH, MM, SS

print(ut(:,0)+" "+ut(:,1)+" "+ut(:,2)+" "+ut(:,3)+" "+ut(:,4)+" "+ut(:,5))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Then the output are “

(0) 2011 5 1 0 0 0

(1) 2011 5 1 1 0 0.000107288

(2) 2011 5 1 2 0 0.000214577

(3) 2011 5 1 3 0 0

(4) 2011 5 1 4 0 0.000429153

……


The hours of the time should be 1,2,.. 23, but they could not be generated
correctly.

 However when I changed the script:

time=ispan(0,24-1,1).

time@units="hours since 2011-05-01 00:00:0.0"

time@long_name = "time" ;

time@calendar = "noleap" ;

time@bounds = "time_bnds"

ut=cd_calendar(time,0) ;;; converts to time(size[TIME], 6) => YYYY, MM, DD,
HH, MM, SS;

Then the result is right. It seems weird. Does anyone have ideas?

The ncl version I use is 6.0.0.

The system is Linux (x86_64 GNU/Linux).

Thanks,

Huiping

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Dec 27 11:28:33 2012

This archive was generated by hypermail 2.1.8 : Fri Jan 04 2013 - 15:32:29 MST