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

Home » Public Forums » archive » Fill Missing values with NaN
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: Fill Missing values with NaN [message #94672 is a reply to message #94666] Fri, 11 August 2017 05:31 Go to previous message
Matthew Argall is currently offline  Matthew Argall
Messages: 286
Registered: October 2011
Senior Member
The example below works well with integer times. For floats, you should define "alltimes" as the beginning of the sampling interval and "times" as the center of the sampling interval. This is in-part because of how Value_Locate works and in-part because of the discreteness of floating point values.

;Time Arrays
time = [1, 4, 7, 8]
alltimes = IndGen(10)

;Data Arrays
dens = [80, 60, 30, 50]
densnew = Replicate( !Values.D_NaN, N_Elements(alltimes) )

;Locate "time" within "alltimes"
iTime = Value_Locate(alltimes, time)

;Fill the new density array
densnew[iTime] = dens

;Result
print, densnew, FORMAT='(10(f5.2, 2x))'
NaN 80.00 NaN NaN 60.00 NaN NaN 30.00 50.00 NaN
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: plot solid circle on image
Next Topic: IDL LSODE double precision

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

Current Time: Wed Oct 08 11:35:14 PDT 2025

Total time taken to generate the page: 0.00396 seconds