From: nlcheng <cnl88_at_nyahnyahspammersnyahnyah>
Date: Sat Nov 05 2011 - 05:43:13 MDT

I want to convert the time of beijing to global time ,like this
yymmddhh: 2011 03 18 07 to 2011 03 17 23

I have upload my script and data .You can put them in one directory and ncl read44-55write55.ncl

part of my script is below ,but it put out the same data ,like this
2011 03 18 07 to 2011 3 18 7
just the same and there is no error.hope for your help! thank you very much

;************************************************
;************************************************
begin
fname = "nlcheng44chuance_test.txt"
strs =new(6336,"string")

mmm = data(:,1)
nts = dimsizes(mmm)
yy=new(nts,"integer")
mm=new(nts,"integer")
dd=new(nts,"integer")
hh=new(nts,"integer")
do nt=0,nts-1
yy(nt) = data(nt,0)
mm(nt) = data(nt,1)
dd(nt) = data(nt,2)

hh(nt) = data(nt,3)

if ((hh(nt) .gt. 8) .and. (hh(nt) .eq. 8 ) ) then

hh(nt) = hh(nt) -8

if ((hh(nt) .lt. 8) .and. (hh(nt) .gt. 0 ) .and. (hh(nt) .eq. 0 ).and. (dd(nt) .ne. 1)) then
hh(nt) = hh(nt) +16
dd(nt) = dd(nt) -1

if ((hh(nt) .lt. 8 ) .and. (hh(nt) .gt. 0 ) .and.( hh(nt) .eq. 0 ) .and. (dd(nt) .eq. 1)) then
hh(nt) = hh(nt) +16
dd(nt) = 31
mm(nt) = mm(nt) -1

end if
end if
end if

vals = sprintf("%4.0f",yy(nt)) + " "+ sprintf("%2.0f",mm(nt)) + " "+sprintf("%2.0f",dd(nt)) + " " + sprintf("%2.0f",hh(nt))
strs(nt) = vals
asciiwrite("nlcheng55chuance_test.txt",strs)

end do
end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sat Nov 5 05:43:34 2011

This archive was generated by hypermail 2.1.8 : Tue Nov 08 2011 - 15:54:50 MST