load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRF_contributed.ncl" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Model Ouputs ;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; DATADir = "./" FILES = systemfunc (" ls -1 " + DATADir + "wrfout_* ") numFILES = dimsizes(FILES) print("numFILES = " + numFILES) ;======= fS = addfiles (FILES, "r") ListSetType (fS, "cat") ; concatenate (=default) ;ListSetType (fS, "join") ; another option lat = wrf_user_getvar(fS[0],"XLAT",0) lon = wrf_user_getvar(fS[0],"XLONG",0) dimJ=dimsizes(lat) ;dust_tot = new((/numFILES,dimJ(1),dimJ(0)/),"float") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;Here we calculate the desired variables for every time available do loop;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; it = -1 FirstTime = True fn=-1 n1=0 n2=1 fStep=2 pres = wrf_user_getvar(fS,"pres",it) tk = wrf_user_getvar(fS,"tk",it) Rspe=287.058 density=pres/(Rspe*tk) ;lat = wrf_user_getvar(fS,"XLAT",it) ;lon = wrf_user_getvar(fS,"XLONG",it) dust1 = wrf_user_getvar(fS,"DUST_1",it) dust2 = wrf_user_getvar(fS,"DUST_2",it) dust3 = wrf_user_getvar(fS,"DUST_3",it) dust4 = wrf_user_getvar(fS,"DUST_4",it) dust5 = wrf_user_getvar(fS,"DUST_5",it) level=0 dust_J = dim_sum_n((/dust1,dust2,dust3,dust4,dust5/),0)*density dust_tot = dust_J(:,level,:,:) dimx = dimsizes(dust_tot) nlat = dimx(2) mlon = dimx(1) npts = nlat*mlon do ifil = 0,numFILES-1 if (ifil.eq.n2) then dust_avg = dim_avg_n(dust_J(n1:n2,level,:,:),0) print(" average of file|" + n1 + "| and file|" + n2 + "| calculated...") n1=n1+2 n2=n2+2 end if if (FirstTime) then ; NCL fname = "All_Dust_Jack20151123.txt" data = new(npts,"string") end if ; NCL npt=-1 do ml =0,mlon-1 do nl=0,nlat-1 npt = npt+1 if (FirstTime) then data(npt) = sprinti("%05i ",(npt+1)) data(npt) = data(npt) + sprintf("%7.3f ", lat(ml,nl)) data(npt) = data(npt) + sprintf("%7.3f ", lon(ml,nl)) end if data(npt) = data(npt) + sprintf("%7.3f ", dust_tot(ifil,ml,nl)) if (ifil.eq.n2-2) then data(npt) = data(npt) + sprintf("%7.3f ", dust_avg(ml,nl)) end if end do ; do-loop lat end do ; do-loop lon FirstTime=False end do asciiwrite (fname, data)