begin a = addfile("slp.mon.mean.nc","r") time = a->time ; time@units = "hours since 1-1-1 00:00:0.0" printVarSummary(time) utc_d = cd_calendar(time,0) ; utc_date(:,0)=years, utc_date(:,1)=months ; utc_date(:,2)=days, utc_date(:,3)=hours ; utc_date(:,4)=minutes, utc_date(:,5)=seconds ym = cd_calendar(time,1) ; YYYYMM of type double ymd = cd_calendar(time,-2) ; YYYYMMDD of type integer ymdh = cd_calendar(time,-3) ; YYYYMMDDHH of type integer yfrac= cd_calendar(time,4) ; YYYY.fraction_of_year or type double ;--------------------------------------------------------------------------------- ; Taking output from cd_calendar (utc_d array from above), convert from ; a UT-referenced date to a mixed Julian/Gregorian date. cd_inv_calendar ; requires input of type integer for the year, month, day, hour, and minute. ; cd_calendar outputs floats when the option is set to 0. Thus, these inputs ; will have to be converted from float to integer. ;--------------------------------------------------------------------------------- year = tointeger(utc_d(:,0)) month= tointeger(utc_d(:,1)) day = tointeger(utc_d(:,2)) hour = tointeger(utc_d(:,3)) minute = tointeger(utc_d(:,4)) time2 = cd_inv_calendar(year,month,day,hour,minute,utc_d(:,5),time@units,0) print("" + time+", "+time2) ; time2 is identical to time end