Hi Kai .... Try a combination of
http://www.ncl.ucar.edu/Document/Functions/Built-in/ut_calendar.shtml
http://www.ncl.ucar.edu/Document/Functions/Built-in/ut_inv_calendar.shtml
time1 = f->time ; "days since 1998-10-01 00:00"
time2 = g->time ; "hours since 2000-03-01 00:00
date2 = ut_calendar(time2, 0) ; datex(:,6) [array]
year = *floattointeger* <http://www.ncl.ucar.edu/Document/Functions/Built-in/floattointeger.shtml>(utc_date(:,0)) ; Convert to integer for ut_inv_calendar
month = *floattointeger* <http://www.ncl.ucar.edu/Document/Functions/Built-in/floattointeger.shtml>(date2(:,1))
day = *floattointeger* <http://www.ncl.ucar.edu/Document/Functions/Built-in/floattointeger.shtml>(date2(:,2))
hour = *floattointeger* <http://www.ncl.ucar.edu/Document/Functions/Built-in/floattointeger.shtml>(date2(:,3))
minute = *floattointeger* <http://www.ncl.ucar.edu/Document/Functions/Built-in/floattointeger.shtml>(date2(:,4))
second = date2(:,5) ; must be float or double
; note "time1"
TIME2 = *ut_inv_calendar*(year,month,day,hour,minute,second,time1_at_units, 0)
print(time1+" "+ time2+" "+TIME2)
or,
print(sprintf("%12.2f",time1)+" " \
+sprintf("%12.2f",time2)+" " \
+sprintf("%12.2f",TIME2) )
Good Luck
D
=======================
Kai Zhang wrote:
> Dear all,
>
> I have two netcdf data files which use different time coordinates. One file is
>
> time:units = "days since 1998-10-01 00:00" and the other file is
>
> time:units = "hours since 2000-03-01 00:00".
>
> Is there a simple or well-developed method to convert the time
> coordinate in second netcdf data to the same time coordinate in the
> first data?
>
> Thanks!
>
> Best regards, Kai
> _______________________________________________
> 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 Thu May 14 2009 - 09:34:21 MDT
This archive was generated by hypermail 2.2.0 : Tue May 26 2009 - 10:17:16 MDT