comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Interpolate whole array instead of looping through elements
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Interpolate whole array instead of looping through elements [message #94325] Tue, 11 April 2017 09:18 Go to previous message
liam.steele is currently offline  liam.steele
Messages: 13
Registered: September 2015
Junior Member
Hi all,

I have a 4D array (say temperatures) ordered as temp[nlat,nlon,nlev,ntime], where the elements are the number of latitudes, longitudes, vertical levels and times. What I want to do is interpolate the lat/lon data to a specified point or points, but for each level and time. So, at the moment my code would look like:

out_vals = fltarr(nlev, ntime)
for i = 0, ntime-1 do begin
for j = 0, nlev-1 do begin
out_vals[j,i] = bilinear(temp[*,*,j,i],ival,jval)
endfor
endfor

where ival and jval are the points I want to interpolate to. However, there are lots of levels and times, and so the loop procedure can take a while.

Is there any method where one or both of the loops can be removed, and the interpolation can be carried out on the entire array (i.e. on the time and level dimensions at the same time)? I've tried to think of a quicker method, but I'm stumped.

Many thanks,

Liam
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Taylor Diagrams in IDL
Next Topic: Newcomer to IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:43:59 PDT 2025

Total time taken to generate the page: 0.00445 seconds