I thought I could use the data file input and a binary decoder, but I need some help!
I have some raw binary files from a multibeam sonar system, I would like to try and read the header information out of these files.
Here is a small sample file!
There are a couple of different things you can do.
If you know the structure of the file, I highly recommend the FileRawDataFetcher custom transformer.
For example an interpretation specifier of '22, string(9);32,string(7)' would return
_rawdata{0}.value' has value `WLZ=0.566'
_rawdata{1}.value' has value `SMH=105
or
'26, string(5);36,string(3)' would return
`_rawdata{0}.value' has value `0.566'
`_rawdata{1}.value' has value `105'
and you could rename _rawdata{0} to WLZ and _rawdata{1} to SMH
If you don't, assuming the header information you want is all on line one, you could use the DataFile reader, set the Max Features to Read to 1 and then use an AttributeSplitter (,) on the data_file_data, which would return
`_list{0}' has value 'b????I.É3ñÌZ??i??????WLZ=0.566'
`_list{1}' has value `SMH=105'
`_list{2}' has value `STC=0'
etc.
You would need to cleanup the first and last elements of the list
Hi , there are a couple of ways on how to extract data and by viewing the supplied file i would select to the simplest; read it as a csv file and select to read only the first line. Then u would get a complete list of the header data:
The u can select which element to extract or explode all elements to unique features etc.
regards
andre
There are a couple of different things you can do.
If you know the structure of the file, I highly recommend the FileRawDataFetcher custom transformer.
For example an interpretation specifier of '22, string(9);32,string(7)' would return
_rawdata{0}.value' has value `WLZ=0.566'
_rawdata{1}.value' has value `SMH=105
or
'26, string(5);36,string(3)' would return
`_rawdata{0}.value' has value `0.566'
`_rawdata{1}.value' has value `105'
and you could rename _rawdata{0} to WLZ and _rawdata{1} to SMH
If you don't, assuming the header information you want is all on line one, you could use the DataFile reader, set the Max Features to Read to 1 and then use an AttributeSplitter (,) on the data_file_data, which would return
`_list{0}' has value 'b????I.É3ñÌZ??i??????WLZ=0.566'
`_list{1}' has value `SMH=105'
`_list{2}' has value `STC=0'
etc.
You would need to cleanup the first and last elements of the list
Learned something new today, thanks @jdh!
Reply
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.