Hi guys i need help to read block data from binary..
The format is

Byte position, Content, Format
1 - 4, Block Length, I * 4
5 - 12, Sensor Name, C * 8
13 - 20, Satellite Name, C * 8
21 - 24, Latitude, R * 4

Im trying to read himawari satellite data (SATAID)...can u help me please to open this SATAID file?...thankyu

First, you need a HEX editor to see what it is you are dealing with. I looked at one sample file on their site and it has the following initial bytes.

16 01 00 00 57 56 EA F3 48 FF 69 6D 61 77 61 2D 38 W V H i m a w a - 8
32 00 AA 04 00 14 04 00 0F 04 00 07 04 00 03 AA 04
48 00 02 04 00 32 04 00 24 04 00 B4 A8 F1 F0 08 0D 2 $
64 18 01 37 04 00 39 04 00 0A FC 04 00 F1 F0 00 07 7 9
80 0B 00 00 34 DE 4D 00 0A D7 23 3D 54 01 5A 06 D7 4 M # = T Z
96 00 00 D7 5D 00 0D 15 04 00 00 AB 82 42 0E 00 43 ] B C
112 6C 03 48 73 00 A0 39 C0 70 03 7E 01 48 43 FE 14 l H s 9 p ~ H C
128 00 48 01 F0 8C 01 97 0D A7 0D 04 01 23 B2 84 3C H # <
144 FF 2D AE 0C 43 02 D2 20 4C 5C AC 0D D7 0D 31 2E - C L \ 1 .
Your format says the satellite name is bytes 13 to 20, but this example it is 23 to 32 with an anomolus FF included. If the first 4 bytes were a long, then the number is huge whether it is big endian or not. Therefore, you need to get it right or determine if there is a header that has to be dealt with.

In general, I first identify the actual format, then create some typed variables. For example, following your list one would be:

     Type BlockData
         BlockLength as long
         SensorName as string*8
         Satellitename as string*8
         latitude as single
         longitude as single

end type`

Then open the file as binary

dim Blocks as blockdata
Open filename$ for binary as SATAID

get #SATAID,,Blocks

then parse that out. I expect you will need to fetch the block data byte by byte so you need to know what form it is in. You need to know the record size, and the contents of the records. If the block records are fixed length, then make another typed variable for that.

Darn, the form messed up the dump.

    0            53 5A 44 44 88 F0 27 33 41 00 00 FC 58 00 BF 00         S Z D D     ' 3 A       X       
     16           01 00 00 57 56 EA F3 48 FF 69 6D 61 77 61 2D 38               W V     H   i m a w a - 8 
     32           00 AA 04 00 14 04 00 0F 04 00 07 04 00 03 AA 04                                         
     48           00 02 04 00 32 04 00 24 04 00 B4 A8 F1 F0 08 0D                 2     $                 
     64           18 01 37 04 00 39 04 00 0A FC 04 00 F1 F0 00 07             7     9                     
     80           0B 00 00 34 DE 4D 00 0A D7 23 3D 54 01 5A 06 D7               4   M       # = T   Z     
     96           00 00 D7 5D 00 0D 15 04 00 00 AB 82 42 0E 00 43               ]                 B     C 
     112          6C 03 48 73 00 A0 39 C0 70 03 7E 01 48 43 FE 14         l   H s     9   p   ~   H C     
     128          00 48 01 F0 8C 01 97 0D A7 0D 04 01 23 B2 84 3C           H                     #     < 

144 FF 2D AE 0C 43 02 D2 20 4C 5C AC 0D D7 0D 31 2E - C L \ 1

Thank a lot @loranguy...i've been try but its give another result..can i send the manual sataid (pdf) to your email so you can see the sataid data format. ?.i really need to open this file...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.