[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with ASSOC,/PACKED



Greetings

I've run across a bug(?) using ASSOC,/PACKED 
This appears under v5.3 for Win9x, and v5.2 on
SGIs.  

If anyone has spare time, could you look
at the following demonstration script to see if
I'm doing anything obviously wrong.  Tests
on other architectures or versions would also
be welcome.




;2000/02/29		Brian Jackel		University of Calgary	
bjackel@phys.ucalgary.ca
;
;This IDL script demonstrates a problem with ASSOCiated I/O,
;probably due to a largeish (4516 byte) structure.
   
   
   PRINT,!version
      

   PRINT,'Start with a small test structure '
   test= {TEST_STRUCTURE, utime:0.0, data:FLTARR(75) }
   HELP,/STR,test
   PRINT,' '
         
   PRINT,'Write it to a file'
   data= REPLICATE({TEST_STRUCTURE},10)
   data.utime= FINDGEN(10)
   OPENW,1,'test.dat'
   WRITEU,1,data
   CLOSE,1
   PRINT,' '
   
   PRINT,'Check out the times, should be 0,1,2...'
   dat= {TEST_STRUCTURE}
   OPENR,1,'test.dat'
   READU,1,dat & PRINT,dat.utime   
   READU,1,dat & PRINT,dat.utime      
   READU,1,dat & PRINT,dat.utime   
   CLOSE,1
   PRINT,' '
     

   PRINT,'Try using ASSOC,/PACKED    (should give same result, does)
   OPENR,1,'test.dat'
   dat= ASSOC(1,{TEST_STRUCTURE},/PACKED)
   PRINT,(dat[0]).utime
   PRINT,(dat[1]).utime
   PRINT,(dat[2]).utime   
   CLOSE,1
   PRINT,' '



   PRINT,'Make a bigger structure '
   windii_data= {WINDII_DATA, emission_rate:0.0,
sigma_emission_rate:0.0, $
                            wind_speed:0.0, sigma_wind_speed:0.0,      
$
                            temperature:0.0, sigma_temperature:0.0}
                             
   windii_l2fd_redgreen= {WINDII_L2FD_REDGREEN,    $
                          juldate:0.0, utime:0.0, dtime:FLTARR(2), $
                          altitude:FLTARR(75), latitude:FLTARR(75), $
                          longitude:FLTARR(75), $
                          red:REPLICATE({WINDII_DATA},75), $
                          green:REPLICATE({WINDII_DATA},75) } 
                          
   HELP,/STR,{WINDII_L2FD_REDGREEN}
   PRINT,' '

   PRINT,'Write it to a file'
   data= REPLICATE({WINDII_L2FD_REDGREEN},10)
   data.utime= FINDGEN(10)
   OPENW,1,'test.dat'
   WRITEU,1,data
   CLOSE,1
   PRINT,' '
   
 
   PRINT,'Read using standard I/O, times should be 0,1,2,3...'
   OPENR,1,'test.dat'
   dat= {WINDII_L2FD_REDGREEN}
   READU,1,dat & PRINT,dat.utime   
   READU,1,dat & PRINT,dat.utime   
   READU,1,dat & PRINT,dat.utime         
   CLOSE,1
   PRINT,' '


   PRINT,'Use ASSOC,/PACKED   (should be same, isn''t)'
   OPENR,1,'test.dat'
   dat= ASSOC(1,{WINDII_L2FD_REDGREEN},/PACKED)
   PRINT,(dat[0]).utime
   PRINT,(dat[1]).utime
   PRINT,(dat[2]).utime   
   CLOSE,1
   PRINT,' '


END