Could I reset the irregular time coordinate of this netcdf file?

From: gmail <leo.aries.g_at_nyahnyahspammersnyahnyah>
Date: Fri Jan 17 2014 - 07:55:13 MST

Hi, all

       I am reading multiple nc files from CMIP5 using the following code.

; **************************
data_path = "/..../Data/CMIP5/"
model_name = (/"bcc-csm1-1","BNU-ESM","CanESM2","CCSM4","CNRM-CM5","CSIRO-Mk3-6-0","FGOALS-g2","GFDL-CM3","GFDL-ESM2M","GISS-E2-H",\
                  "GISS_E2-R","HadGEM2-ES","IPSL-CM5A-LR","MIROC-ESM","MIROC-ESM-CHEM","MRI-CGCM3","NorESM1-M"/)
simulation = "historical"
varname = "psl"
vn = 3

ntStrt = 188001
ntLast = 200412
x = new((/dimsizes(model_name),2004-1880+1/),"float")
; ************************

do i = 0,dimsizes(model_name)-1
print( " " + model_name(i) )
all_files = systemfunc("ls /..../Data/CMIP5/" + model_name(i) + "/" + simulation + "/")
    
      do j = 0,dimsizes(all_files)-1
            fcha = stringtochar(all_files(j))
            fvar = charactertostring(fcha(0:vn-1))
            if(fvar.eq.varname) then
               data_filename = all_files(j)
               print(" " + data_filename)
            end if
            delete(fvar)
            delete(fcha)
      end do
 
fi = addfile(data_path + model_name(i) + "/" + simulation + "/" + data_filename, "r")
           delete(data_filename)
time = fi->time
yymm = ut_calendar(time,-1)
;print(yymmdd(0:dimsizes(time)-1:12))
yymmdd = ut_calendar(time,-2)
print(yymmdd(11:dimsizes(time)-1:12))
nt1 = ind(yymm.eq.ntStrt)
nt2 = ind(yymm.eq.ntLast)
print(" " + nt1 + " " + nt2 + " " + dimsizes(time))
data = fi->$varname$(nt1:nt2,:,:)
           delete(time)
           delete(yymmdd)
           delete(yymm)

end do

; **********************

However, something wrong occurs when reading the "GISS-E2-H" output data, Here below is part of what I got using "print(yymmdd)"

(744) 19120131
(745) 19120302
(746) 19120401
(747) 19120502
(748) 19120601
(749) 19120702
(750) 19120801
(751) 19120901
(752) 19121001
(753) 19121031
(754) 19121201
(755) 19121231
(756) 19130131
(757) 19130302
(758) 19130402
(759) 19130502
(760) 19130602
(761) 19130702
(762) 19130801
(763) 19130901
(764) 19131001
(765) 19131101
(766) 19131201
(767) 19140101
(768) 19140131
(769) 19140302
(770) 19140402
(771) 19140502
(772) 19140602
(773) 19140702
(774) 19140802
(775) 19140901
(776) 19141001
(777) 19141101
(778) 19141201
(779) 19150101
(780) 19150131
(781) 19150303
(782) 19150402
(783) 19150503
(784) 19150602
(785) 19150702
(786) 19150802
(787) 19150901
(788) 19151002
(789) 19151101
(790) 19151202
(791) 19160101
(792) 19160131
(793) 19160303
(794) 19160402
(795) 19160503
(796) 19160602
(797) 19160703
(798) 19160802
(799) 19160902
(800) 19161002
(801) 19161101
(802) 19161202

¡­¡­.

(1869) 20051123
(1870) 20051223
(1871) 20060123 ; It should be noticed that this value of the time dimension make me scripts listed above meet errors

It seems that the time coordinate of the nc files is irregular. (By the way, the package of the "panoply" can recognize the correct monthly value of the time coordinate and
the last month is 200512, however, the last month is 200601 when using NCL ).
 Could I reset them as the time coordinate of the other CMIP5 output data? For example.

(0) psl_Amon_GFDL-CM3_historical_r1i1p1_186001-200512.nc
Variable: yymmdd
Type: integer
Total Size: 7008 bytes
            1752 values
Number of Dimensions: 1
Dimensions and sizes: [1752]
Coordinates:
Number Of Attributes: 1
  calendar : noleap
(0) 18600116
(1) 18600215
(2) 18600316
(3) 18600416
(4) 18600516
(5) 18600616
(6) 18600716
(7) 18600816
(8) 18600916
(9) 18601016
(10) 18601116
(11) 18601216
(12) 18610116
(13) 18610215
(14) 18610316
(15) 18610416
(16) 18610516
(17) 18610616
(18) 18610716
(19) 18610816
(20) 18610916
(21) 18611016
(22) 18611116
(23) 18611216

¡­..

(1740) 20050116
(1741) 20050215
(1742) 20050316
(1743) 20050416
(1744) 20050516
(1745) 20050616
(1746) 20050716
(1747) 20050816
(1748) 20050916
(1749) 20051016
(1750) 20051116
(1751) 20051216

Thanks!

Lin

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Jan 17 07:55:32 2014

This archive was generated by hypermail 2.1.8 : Sun Jan 19 2014 - 21:56:35 MST