load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" begin ;********************************************************** ; open file and read required data ;********************************************************** nlat = 37 klev = 23 ntim = 16314 ;bytes = ntim*klev*nlat*4 ; 4 is 4 bytes per float ;print(bytes) x = fbindirread("ERA40Tzm.dat", 0, (/ntim,klev,nlat/), "float" ) x@long_name = "Temperature" x@units = "K " x!0 = "time" x!1 = "lev" x!2 = "lat" yrStrt = 1958 yrLast = 2002 TIME = yyyymmdd_time(yrStrt, yrLast, "integer") ; array of times TIME!0 = "time" TIME@units = "yyyymmdd" TIME&time = TIME printVarSummary(TIME) ; [TIME | 16436] not 16314 ; ??????? time = TIME(0:ntim-1) printVarSummary(time) ;; ?????? x&time@units = "hours since 1958-01-01 00:00:00" ; cd_inv_calendar ; array of levels lev = (/100, 200, 300, 500, 700, 1000, 2000, 3000, 5000, 7000, 10000, 15000,\\ 20000, 25000, 30000, 40000, 50000, 60000, 70000, 77500, 85000, 92500,\\ 100000/) lev!0 = "lev" lev@long_name = "pressure" lev@units = "Pa" lev&lev = lev printVarSummary(lev) ; array of latitudes lat = fspan(90,0,nlat) lat!0 = "lat" lat@long_name = "latitude" lat@units = "degrees_north" lat&lat = lat printVarSummary(lat) ; assign corrdinate variables x&time = time x&lev = lev x&lat = lat printVarSummary(x) system("/bin/rm -f test.nc") ; remove any pre-existing file ncdf = addfile("test.nc" ,"c") ; open output netCDF file ncdf->temp=x end