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

Home » Public Forums » archive » Spatial and temporal image correlation
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: Spatial and temporal image correlation [message #85554 is a reply to message #85543] Thu, 15 August 2013 12:44 Go to previous messageGo to previous message
Phillip Bitzer is currently offline  Phillip Bitzer
Messages: 223
Registered: June 2006
Senior Member
Besides the aforementioned use of file_search and not using CD, let me add the following about your loop:

1) Generally speaking, I like to open the file I need, read it in, and free the lun for file immediately before doing any processing. This especially goes while you are debugging your code. The reason is so you don't have any "hanging" luns that aren't freed properly.

2) In addition, you are making file a float array for the data in the file. Is that the case, or is it integers? If it *is* floats, it's generally not a good idea to check for equality between floats (see http://www.idlcoyote.com/code_tips/comparearray.html for a discussion). I'll assume below -9999 is your missing value, and all good data is definitely greater than -9990.0. This may not really affect you here, but at some point checking if two floats are equal will get you in trouble.

3) You should use square brackets to access array elements (I see you do that once, so it may be a typo in the OPENR call). Although not strictly required, this will help you down the line and help you differentiate between arrays and functions. The use of the compiler option idl2 (see http://www.exelisvis.com/docs/COMPILE_OPT.html) is highly recommended by several notable IDL programmers.

4) Be sure to check the count keyword before assigned the null values to NaN. In IDL 7 and below, if there are no null values, the code as you've written it will throw an error. In IDL 8, if there are no null values, your code will assign the last element to NaN.

Since you're starting out in IDL, I reccomend you check out this page:http://www.idlcoyote.com/code_tips/mostcommon.html

So, I would modify the loop slightly to this:

FOR j=0,numFiles-1 DO BEGIN
OpenR, lun, theseFiles[j], /Get_Lun
File = fltarr(620, 500)
ReadU, lun, File
Free_Lun, lun
JustNumbers= where(File lt -9990.0, count)
IF count NE 0 THEN File[JustNumbers]=!VALUES.F_NAN
*
* ;do more processing
*
*

ENDFOR

Good luck!
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL routines for Rayleigh optical depth/US Standard Atmospheres?
Next Topic: Map issue wth IDL8 new graphics: conformal or equal-area maps in rectangular shape

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

Current Time: Wed Oct 08 17:03:37 PDT 2025

Total time taken to generate the page: 0.00610 seconds