[ncl-talk] the script runs forever ,how to optimize ?

Saurabh Singh saurabhsingh123op at gmail.com
Mon Oct 13 12:25:35 MDT 2014


hello all

i have a script to extract variables from WRF file at a certain pressure
level
there are around 20 variables that i need to extract , but it takes really
long to run the scrip,i am sending the code for 1 variable please if any
one can help me to optimise it

this scripy tries to extract point data for a wrf file generated every 3
hours and total duration is a year.

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
    load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"

  files = systemfunc("ls -1
 /home/cee1/Music/Build_WRF_and_WPS.V351/WRF_and_WPS_src/WRFV3/test/
em_real/2k/wrfout_d01_2000*") + ".nc"
   a = addfiles(files,"r")
 ;extraction of variables
   time = -1
   p  = wrf_user_getvar(a,"pressure",time) ; total pressure

  rh = wrf_user_getvar(a,"rh",time)   ; calculate RH
  rh850 =wrf_user_intrp3d( rh,p,"h",850,0.,False)
  rh500 =wrf_user_intrp3d( rh,p,"h",500,0.,False)
  rh1000 =wrf_user_intrp3d( rh,p,"h",1000,0.,False)

  rhpoint500 = rh500(:,60,41)
  rhpoint850 = rh850(:,60,41)
  rhpoint1000 = rh1000(:,60,41)

   asciiwrite("rh0.txt",rhpoint500)
   asciiwrite("rh8.txt",rhpoint850)
   asciiwrite("rh13.txt",rhpoint1000)

i have the similar code inside for 19 other variables,please help me to
optimize this script and i just need my output at a single station and 3
pressure levels i.e 500.850 and 1000

-- 
With regards
Saurabh Kumar singh

 *P** : * *Please consider the environment before printing this e-mail*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141014/3ec8953f/attachment.html 


More information about the ncl-talk mailing list