[SciPy-User] improving efficiency of script

Neil Berg nberg at atmos.ucla.edu
Mon Nov 1 18:20:29 EDT 2010


Hi Scipy community,

Attached is a script that interpolates hourly 80-meter wind speeds at each grid point.  Interpolation is performed via a cubic spline over the lowest 8 vertical wind speeds and then output the 80-m wind speed.  

Unfortunately, the script is taking about 30 minutes to run for the first month, and then takes longer for each successive month.  This is demonstrated below:

195901_3.nc (January)
ntime= 744  nlat= 54  nlon= 96
1734.268457 s for computation.

195906_3.nc (June)
ntime= 720  nlat= 54  nlon= 96
14578.560365 s for computation.

195912_3.nc (December) 
ntime= 744  nlat= 54  nlon= 96
33484.765078 s for computation.

I don't understand why it takes so much longer for successive months to run; they are all roughly the same time dimension and have exactly the same latitude and longitude dimensions.  Do you have any ideas why this is happening?  Also, do you have any suggestions on how to shorten the length of time it takes to run the script in the first place?  The "tim_idx" for-loop surrounding the interpolation procedure is the dominant factor increasing the run time, but I am stuck on possible ways to shave time off these steps.  

Thank you in advance,

Neil Berg
nberg at atmos.ucla.edu 
___________________
Mac OS X 10.6.4
Python/scipy 2.6.1 
___________________ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101101/5fa57f20/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interpolate_80mws.py
Type: text/x-python-script
Size: 8339 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101101/5fa57f20/attachment.bin>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20101101/5fa57f20/attachment-0001.html>


More information about the SciPy-User mailing list