;;;;;;;;;;this script open nc data from CCM;;;;; load "/usr/local/ncl-6.3.0/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "/usr/local/ncl-6.3.0/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "/usr/local/ncl-6.3.0/lib/ncarg/nclscripts/csm/contributed.ncl" f = addfile("/home/regcm/maryam/NCL/pr_AFR-44_CCCma-CanESM2_historical_r1i1p1_CCCma-CanRCM4_r2_day_19960101-20001231.nc","r") pre = f->pr printVarSummary(pre) ;======================================================== dim_pre = dimsizes(pre) ntime = dim_pre(0) nlat = dim_pre(1) nlon = dim_pre(2) time = timeGlobeFo(ntim,"time","time","days since 1949-12-01") lat = latGlobeFo(nlat,"lat","latitude","degrees_north") lon = lonGlobeFo(nlon,"lon","longitude","degrees_east") pre!0 = "time" pre!1 = "lat" pre!2 = "lon" pre&time = time pre&lat = lat pre&lon = lon pre@long_name = "pre" ;======================================================== wks = gsn_open_wks("x11","contour") ; +contour map plot = gsn_csm_contour_map(wks,pre(0,{-180:180},{179:0}),False) exit ;''''''''''''''''''''''''''''''''''''''''''''' ;create ascii file;;;;;;;;;;;;;;;; nlat = 194 ; (nlat) nlon = 201 ; (mlon) ntime = 19 pre =random_normal(ntim,nlat,nlon) ; (ntim,nlat,mlon) dimpre = dimsizes(pre) ntim = dimpre(0) nlat = dimpre(1) nlon = dimpre(2) npts = nlat*nlon ; total number of grid points fName = "1.txt" data = new(npts,"string") do nl=0,nlat-1 do nl=0,nlon-1 npt = npt + 1 data(npt) = sprinti("%0.5i", (npt+1) ) data(npt) = data(npt) + sprintf("%7.1f ",lat(nl),lon(nl), pre(ntime,nlat,nlon)) ; data(npt) = data(npt) + sprintf("%7.1f ",lon(ml)) do nt=1,tim-1 data(npt)=data(npt)+sprintf("%10.3f ",pre(ntime,nlat,nlon)) end do end do end do asciiwrite(fName,data)