divergence plot: execution issue

From: Sahidul <sahidul_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 29 2010 - 03:59:49 MDT

Hi NCL help/Users,

I am trying to calculate divergence using WRF output files which are saved
every 1 hour interval. I am having 88 files. The below mentioned script is
working fine; but "it is taking a LOT of Time". please help me to sort this
error. How to execute it faster?

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;this script calculates divergence for diff levels

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/wrf/WRFUserARW.ncl"

begin
datadir = "/WRF/output/2010062200/"
FILES = systemfunc ("ls -1 " + datadir + "wrfout_d02* " )
numFILES = dimsizes(FILES)

        res = True
        res@InitTime = False
        res@Footer = False
        res@cnFillOn = True
        res@cnLinesOn = False
;
        pltres = True
        mpres = True
        mpres@mpNationalLineThicknessF = 1.5
        mpres@mpNationalLineColor = "black"
        mpres@mpGeophysicalLineColor = "black"
        mpres@mpGeophysicalLineThicknessF = 1.5

plevs = (/ 925./)
nlevels = dimsizes(plevs)

do ifil = 0,numFILES-1
   a = addfile(FILES(ifil)+".nc","r")
times = wrf_user_list_times(a)

;;;===========================
day = systemfunc("echo "+times +"|cut -c9-10")
yr = systemfunc("echo "+times +"|cut -c1-4")
mon = systemfunc("echo "+times +"|cut -c6-7")
hr = systemfunc("echo "+times +"|cut -c12-13")

if(mon .eq. "07")then
mon="JUL"
end if
if(mon .eq. "08")then
mon="AUG"
end if
;;;===========================

u = wrf_user_getvar(a,"ua",0)
v = wrf_user_getvar(a,"va",0)
p = wrf_user_getvar(a, "pressure",0)

div = uv2dvG(u,v)
div = div*10e5

do level = 0,nlevels-1 ; LOOP OVER LEVELS

    pressure = plevs(level)
    wks = gsn_open_wks("ps","div_"+pressure+"hPa"+"_"+day+mon+yr+"_"+hr+"Z")
    gsn_define_colormap(wks,"gui_default")

    div_plane = wrf_user_intrp3d(div,p,"h",pressure,0.,False)
    divr = wrf_contour(a,wks,div_plane,res)

   if ( any(pressure.eq.plevs)) then
      plot = wrf_map_overlays(a,wks,divr,pltres,mpres)
   end if

    end do
  end do
end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thanking you,

Sahidul

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Jul 29 03:59:56 2010

This archive was generated by hypermail 2.1.8 : Fri Jul 30 2010 - 13:45:56 MDT