Import Blocked Binary

Use the Database > Import > Blocked Binary menu option (IMPORTBB GX) to import blocked binary data into a Geosoft database. This can also be used to import RMS data.
See the Application Notes below for more information on the blocked-binary data format and the blocked-binary import template file format (*.i2).

Import Blocked Binary dialog options

Binary data file

Input data file name

Script Parameter: IMPORTBB.DATA

Binary file template

Import template file name (.I2 assumed)

Script Parameter: IMPORTBB.TEMPLATE

Optional line name

Optional Line name, blank for no line.

Script Parameter: IMPORTBB.LINE

Optional flight number

Optional flight number.

Script Parameter: IMPORTBB.FLIGHT

Date (YYYY/MM/DD)

Optional date.

Script Parameter: IMPORTBB.DATE

Fiducial channel

If specified, the first value in this channel will be set as the starting fiducial value for all the channels imported.

Script Parameter: IMPORTBB.FID

Application Notes

Blocked Binary Data Format

Many types of data are stored in a fixed-block binary format — a binary file consisting of a specific quantity of data. The total number of bytes or quantity of data defines a data storage unit called a block. A blocked binary file has the following format:

image\img00017b.jpg

Data is organized systematically within each block, so that specifying the offset (in bytes) from the start of the block and the total length (in bytes) can retrieve it. When compared with the variable-record format, fixed format may require more storage space; however, it is more efficient for rapidly accessing and retrieving stored information.

A blocked binary file has the following basic binary structure:

[file header] "FileHeader" bytes long
[data block] "BlockSize" bytes long
[data block] repeated any number of times

Each [data block] has the following structure:

[block header] "BlockHeader" bytes long
[data record] "RecordSize" bytes long
[data record] repeated "RecordsPerBlock" times

Each [data record] has the following structure:

[main record data] holds once-per-record data
[sub-record data] starts at "SubRecord start" offset in the [data record].
[sub-record data] each sub-record holds "Subrecord length" bytes.etc repeated
[sub-record data] "SubRecord number" times.

Data is extracted from the [main record data] and [sub-record data] and placed in the database.

IMPORTBB requires a template file, which describes the contents and format of the blocked binary file and the database channels in which the data will be placed.

If the "Specify coordinate system on import" setting is set to "Yes" in the General Settings, and if no coordinate system is defined in the current X and Y channels, the "Georeference Database Channels" dialog is called so that the projection can be set on the X and Y.

This GX will extract data from a fixed block format and store it in a Geosoft database.

Blocked Binary Import Template File Format (*.i2)

The template file is an ASCII file that describes the contents of the blocked binay file to be imported into a Geosoft database. The template may contain any number of comment lines that proceed the start of the template parameter settings, which begins with the line [IMPORT BINARY]. Lines that follow this contain keywords and parameter settings as follows:

LINEMODE New/Replace

"New" to create new line versions if the lines exist in the database. This is the default. "Replace" to replace lines if they exist. The line with the highest version number will be replaced.

FILEHEADER bytes

The number of bytes of header information to skip at the start for the file. If not specified, the first data block is assumed to start at the beginning of the file.

BLOCKSIZE bytes

The number of bytes per block. This entry is required.

BLOCKHEADER bytes

The number of bytes of header information to skip at the start for each block. If not specified, the first data record is assumed to start at the beginning of the block.

RECORDSIZE bytes

The number of bytes in each data record. This entry is required. The BLOCKSIZE and RECORDSIZE can be the same if data blocks contain an exact multiple of data records (no padding), in which case each block is considered to contain one record. However, some equipment will produce data blocks that contain a certain number of data records plus unused padding, which require a separate BLOCKSIZE and RECORDSIZE definition.

RECORDSPERBLOCK number

The number of data records in each block. Data records need not fill a data block. Information past the end of the last record in a block and before the end of the block is ignored. See comments included in the RECORDSIZE description.

LINENUMBER start,length,read_format,scale,base

The location, size and format of the line number in a [data record]. See "Data Parameters" below. If a line already exists in the database, the version number will be incremented until a unique line is created.

FLIGHT start,length,read_format,scale,base

The location, size and format of the flight number in a [data record]. See "Data Parameters" below.

DATE start,length,read_format,scale,base

The location, size and format of the flight date in a [data record]. See "Data Parameters" below. Followed by main channel definitions.

Followed by main channel definitions. This pair of lines is repeated for each channel in the [main record data].

DATA start,length,read_format,scale,base,dummy

The location, size and format of a data channel to be imported. See "Data Parameters" below. Every DATA line must be immediately followed by a CHAN line, which describes the channel in which to place the data.

CHAN name,type,channel_format,width,decimals,registry

The channel name and channel characteristics for the preceding "Data". The CHAN definition is required on the line immediately following the DATA line. See "Parameters required by each CHAN line" below.

Repeated sub-records

If the record contains more highly sampled sub-records, this line identifies the start, length and number of sub-records in the data record:

SUBRECORD start,length,number

Start

the offset of the start of the first sub-record from the start of a record.

Length

the number of bytes in each sub-record.

Number

the number of sub-records.

The SUBRECORD definition is followed by sub-record channel definitions. This pair of lines is repeated for each channel in the [sub-record data]. The format is identical to the [main record data] definitions except that the start location of each data item is with respect to the start of each sub-record.

DATA start,length,read_format,scale,base,dummy

CHAN name,type,channel_format,width,decimals,registry

Parameters required by each LINENUMBER, FLIGHT, DATE and DATA line:

Start

The byte offset of the data item relative to the start of each line. The first byte is at offset 0.

For array data to be placed in an Array Channel (see "name" in the "channel" definition line), data is assumed to begin at "start" and occupy consecutive values in the data line. All array items must have the same "length". The length is the size of one element, and 'n' consecutive elements will be read to satisfy one row (element) of the array channel, where 'n' is the array channel element dimension.

Length

the size of the item in bytes.

Read_format

NORMAL

Normally formatted number ("213", "-1.62") or a literal ASCII string.

EXP

Exponentially formatted number (-1.62e+00)

TIME

"HHxMMxSS.ss" x can be any non-numeric character

TIME_1

"HHxMMSSss"

TIME_2

"HHMMSS"

DATE

"YYYYxMMxDD" x can be any of "/ ,.:\-"

"YYYYMMDD"

"YYxMMxDD"

"YYMMDD"

DATE_1

"DDxMMxYYYY" x can be any of "/ ,.:\-"

"DDMMYYYY"

"DDxMMxYY"

"DDMMYY"

DATE_2

"MMxDDxYYYY" x can be any of "/ ,.:\-"

"MMDDYYYY"

"MMxDDxYY"

"MMDDYY"

DATE_3

"YYMM DD"

GEO

Geographic "DEGxMMxSS.ss" x can be any of "/ ,.:\"

HEX

hex integer

BYTE

binary 8-bit integer

SHORT

binary signed 16-bit integer (LSB first)

SHORTS

binary signed 16-bit integer (MSB first, Motorola)

SHORTI

same as SHORT, but bits inverted.

LONG

binary signed 32-bit integer (LSB first)

LONGS

binary signed 32-bit integer (MSB first, Motorola)

LONGI

same as LONG, but bits inverted

FLOAT

binary 32-bit IEEE floating point (LSB first)

FLOATS

binary 32-bit IEEE floating point (MSB first)

DOUBLE

binary 64-bit IEEE floating point (LSB first)

 

DOUBLES

binary 64-bit IEEE floating point (MSB first)

Y2K note: Dates that use a 2-digit year are assumed to be 19xx if xx is >= 50, 20xx if xx < 50. This conforms to: "DISC PD2000 1:1998 Year 2000 Conformity Requirements" (www.bsi.org.uk/disc/year2000/2000.html).

scale

a multiplying factor that is applied to the in-coming numeric data before it is placed in a database channel. The default is 1.

base

a base value that is added to the data after applying the scale. The default is 0.

dummy

the value in the data that is used to indicate missing or dummy values.

Parameters required by each CHAN line:

name

The name of a database channel in which to place the data. If the channel does not already exist, it will be created using the parameters that follow. Names may not begin with any of the "0123456789+-*/%|" characters.

To create an Array channel, specify number of values per element in braces following the name. For example, EM{512} will create an array channel that has 512 values per element. The array data is assumed to begin at "start" (from the DATA definition) and occupy consecutive values in the data record. All array elements must have the same "length".

Type

the channel data types:

SHORT

signed 16-bit integer.

USHORT

unsigned 16-bit integer.

LONG

signed 32-bit integer.

FLOAT

32-bit floating point number.

DOUBLE

64-bit floating point number.

ASCII

text of size "width".

chan_format

format used to display channel elements:

NORMAL

normally formatted number ("213", "-1.62").

EXPONENT

exponentially formatted number (-1.62e+00)

TIME

time "HH:MM:SS.ss"

DATE

date "YYYY/MM/DD"

GEO

geographic "DEG.MM.SS.ssss"

Width

Width of the channel display field.

Decimals

Number of decimals to display.

Registry

Semi-colon delimited list of channel registry entries, (i.e name=setting;name=setting; etc.;). If only one token is present, it is assumed to be UNITS=token for compatibility with older I3 files.

Examples

The following example will read an RMS backup formatted binary file. The data is structured as follows:

Name

offset

Length

format

Description

Block prefix

0

3

ASCII

"RmS" string starts each RMS backup format file.

Main data

3

189

 

There are 20 records per block. Each record represents 1 second of data.

Block number

0

8

ASCII

RMS block number, which is repeated in each data record.

file name

8

8

ASCII

Formated "ABCmmddx", where "mmdd" is the month and day, and "x" is the flight number day. We will use "mmddx" as the flight number.

Clock

16

19

ASCII

"YYMM DD HH:MM:SS.ss"

line number

35

5

ASCII

 

Nav preamble

40

1

ASCII

the letter "N".

GPS time

41

8

ASCII

seconds

UTM X

49

10

ASCII

 

UTM Y

59

10

ASCII

 

 

 

 

 

 

Sub-record

69

12

 

There will be 10 sub-records containing mag and altimeter data, which are sampled 10 times a second.

Mag preamble

0

1

ASCII

the letter "M"

Mag data

1

8

ASCII

 

Analogue preamble

9

1

ASCII

the letter "A"

radar altimeter

10

2

SHORTI

inverted bit 16-bit integer scaled between -10.0 and +9.999695. (scale factor 9.999695/32767 = 0.00030518)

 

 

 

 

 

End of record

189

1

ASCII

the character "*" is at the end of each main record

Total record length:190 bytes

Block size: 3803 bytes ( 3 + 20*190 )

The following template will read the Time, X, Y, Mag and Altimeter data from this file:

-------------------------------------------------------------------------

[IMPORT BINARY]

FILEHEADER 0 / no file header

BLOCKSIZE 3803 / 3 + 190*20

BLOCKHEADER 3 / "RmS" block preample

RECORDSIZE 190

RECORDSPERBLOCK 20

LINENUMBER 35,5,normal

FLIGHT 11,5,normal / the "mmddx" part of the flight name

DATE 16,7,date_3 / the "YYMM DD" part of the clock

DATA 24,11,TIME / the "HH:MM:SS.ss" part of the time

CHAN TIME,float,time,12,1

DATA 49,10,normal

CHAN X,double,normal,14,2,units=m

DATA 59,10,normal

CHAN Y,double,normal,14,2,units=m

SUBRECORD 69,12,10

DATA 1,8,normal

CHAN MAG,float,NORMAL,10,1,units=nT

DATA 10,2,SHORTI,0.000305166

CHAN ALT,FLOAT,units=ft