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

Alan Brammer abrammer at albany.edu
Mon Oct 13 12:44:37 MDT 2014


Can you use the 1d interp routine instead of the 3d routine.  Interpolating
the whole array for one grid point seems unnecessary.
wrf_interp_1d(rh(:,60,41), p(:,60,41), (/500,850,1000/) )

Assuming its the interpolation lines slowing you down.


Good luck,
    ~Alan

On Mon, Oct 13, 2014 at 2:25 PM, Saurabh Singh <saurabhsingh123op at gmail.com>
wrote:

> 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*
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141013/888d562e/attachment.html 


More information about the ncl-talk mailing list