reading data from .ldf file [message #36557] |
Fri, 26 September 2003 11:07 |
srj300s
Messages: 1 Registered: September 2003
|
Junior Member |
|
|
I am a new user of IDL and I am trying to read data records and
separate data from junk in an ldf file.
What is the best way to separate the data records?
Each data record is 32776 bytes.
each record consists of 1 event.
each event has n parameters with a data point for each parameter.
I have managed to clean up the non data points using array
manipulations and row deletions. (shown below below)
The points I am removing show up in the same row of 2d array.
32767 4095
32767 4095
problem is that there are 4095's that I need to keep.
;From this point I am getting rid of non data points
;separate fixedarray into parameters only
parameterarray = fixedarray(0:0, 0:368007)
;separate fixed array into data points only
data_array = fixedarray(1:1, 0:368007)
index = where(parameterarray gt 32766)
result = parameterarray gt 32766
newarr = [data_array - result]
;newarr is the result of subtracting the 1 from result, from the
data_array
; this procedure marks all 4095 values by changing them to 4094
;indexes parameter array and deletes rows where gt 32766 (i.e. 32767)
index = where(parameterarray gt 32766)
delrow = where(parameterarray gt 32766)
dims = size(parameterarray, /dimensions)
nrows = dims[1]
index = replicate(0L, nrows)
index[delrow] = 1L
keeprow = where(index eq 0)
new_array = parameterarray[*, keeprow] ;puts parameterarray into 1D
column
;indexes data_array and deletes rows where eq 4094
index = where(newarr eq 4094)
delrow = where(newarr eq 4094)
dims = size(newarr, /dimensions)
nrows = dims[1]
index = replicate(0L, nrows)
index[delrow] = 1L
keeprow = where(index eq 0)
neuarr = newarr[*, keeprow] ;puts neuarr into 1D column
;final_array is now constructed into 2 columns using new_array and
neuarr
;all parameters and data without the corresponding 32767 and 4095
values that are not needed.
final_array = [new_array, neuarr]
end
Is there a better way to do this that makes it easeier to separate the
records?
|
|
|