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

Home » Public Forums » archive » EXPAND.PRO - - - again!
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Expand [message #10618 is a reply to message #733] Tue, 06 January 1998 00:00 Go to previous messageGo to previous message
Kevin Ivory is currently offline  Kevin Ivory
Messages: 71
Registered: January 1997
Member
Kelly Dean wrote:
>
> I am reading some AVHRR LAC data in the Level 1B format. The image
> provides 51 latitude/longitude pairs for each 2048 pixel scan line. They
> are sampled every 40 points starting at point 25 (25, 65, 105,..., 1945,
> 1985, 2025).
>
> I created a simple IDL routine to expand the 51 values to 2048 values
> using FOR loops. I am looking for suggestions to make this more
> efficient.

Look into the 'interpolate' documentation and use 'findgen' instead of the
extrapolation for loops.

I did your job for you: (untested code)

FUNCTION INTER2048, array51
;+
; PURPOSE:
; Interpolate AVHRR LAC data in the Level 1B format to 2048 values.
; The image provides 51 latitude/longitude pairs for each 2048 pixel
; scan line. They are sampled every 40 points starting at point 25
; (25, 65, 105,..., 1945, 1985, 2025).
;-
start = 24
interval = 40
n_pix = 2048
n_in = n_elements(array51) ; should be 51
last = start + (n_in-1) * interval ; this is going to be 2024
array2048 = FLTarr(n_pix)
;
dvalue = (array51(1) - array51(0)) / interval
; extrapolation to the left
array2048(0:start-1) = array51(0) - dvalue * findgen(start)
; interpolation
array2048(start:last-1) = interpolate(array51, findgen(last-start)/interval)
; extrapolation to the right
dvalue = (array51(n_in-1) - array51(n_in-2)) / interval
array2048(last:n_pix-1) = array51(n_in-1) + dvalue * findgen(n_pix-last)

RETURN, array2048
END

--
Kevin Ivory Tel: +49 5556 979 434
Max-Planck-Institut fuer Aeronomie Fax: +49 5556 979 240
Max-Planck-Str. 2 mailto:Kevin.Ivory@linmpi.mpg.de
D-37191 Katlenburg-Lindau, GERMANY http://www.gwdg.de/~kivory2/
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: nonlinregress
Next Topic: Re: Congressional district boundaries

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

Current Time: Tue Dec 02 10:03:46 PST 2025

Total time taken to generate the page: 0.80390 seconds