The ‘grid’ data files are raster image .bin
files, and the associated header files have the extension .hed. These files
are IPower PC Vision binary files written in Ryan McFarland Fortran. They
can be converted to ASCII .GXF files with the DOS program GRIDCONV provided
by Vision software.
The convertion can be carried out via a menu,
or in batch mode using:
GRIDCONV ‘I-Power_Vision filename’
‘GXF_ASCII filename.gxf’ 1 7
(where 1 refers to I-Power Vision and 7 to GXF format). Note:GXF
data cannot be longer than 19 characters.
The .GXF files have a header section followed by data points arranged in rows of 6 fields of fixed length (13 spaces). To import into IDRISI the header must be removed with a word processor (or Windows WRITE, or DOS EDIT in W95), and the 6 column rows converted to a single column ascii .IMG file, using the QBASIC program gxf2id.bas. The number of columns and rows in the .HED header file, the resolution, min and max data values, and the limits of the image boundaries should be written into the IDRISI image .DOC file.
DATA
In this exercise the IPower Files used are:
ek_at.bin, and ek_at.hed = (files provided
by Dighem Ltd); these files contain potassium values, and the image parameters
are: 281 columns; 308 rows; DUMMY cell values = -32768; PTSEPARATION 25
metres; UTMX min ORIGIN 517400.000000; UTMX max 524425; UTMY max ORIGIN
7034525.000000; UTMYmin 7026825; ZMINIMUM 0; ZMAXIMUM 15 (% K values)
[Note: 281*308=86548 cells (the 281st column is
column 280 if the first column is 0 as in the IDRISI notation; 14476 lines*6
columns = 86856 - 308 blank cells (that is rows with only 5 columns) =
86548
281 columns * 25 m = 7025 + 517400 (Xmin) = 524425 (Xmax); 308 rows
* 25m = -7700 + 7034525 (Ymax) = 7026825 (Ymin)]
AND
ekat.gxf = ak_at.bin converted to GXF format
with embedded header
ekat.img = ekat.gxf with header removed with
Windows Word
ekat2.img = IDRISI ascii file with data in
a single column; ekat2.doc = IDRISI .DOC file
for ekat2.img
ekat3.img = real binary IDRISI file; ekat3.doc
= IDRISI .DOC file for ekat3.img
(data values are real from 0 to 14.054).
PROCEDURE
Change to the subdirectory c:\gridcon2 and
convert the ek_at.bin file to ekat.gxf (a row sorted ascii file with 6
columns of fixed length (13 spaces)) by running the GRIDCONV software OR
running the GRIDCONV BATCH PROGRAM outlined above. In the menu, highlight
‘Select Input Grid Format’ (press ENTER), then select the ‘IPower PC Vision
binary files written in Ryan McFarland Fortran’ as the input format (ENTER).
Select the file ek_at.hed as the file to input. Highlight ‘Select Output
file format’ (ENTER) and select GXF ASCII as the output file format.
Enter the output file name (ekat.gxf). Run the ‘DO CONVERSION’ option in
the menu. When the conversion is finished, select ‘Quit Program’ to leave
GRIDCONV.
Strip the header data from the ekat.gxf file
using a Word Processor (or Windows Write, etc; the file is too large for
‘EDIT’) and save as ekat.img. Locations beyond the boundaries of the data
collection zone are given dummy values of -32768.000 (13 spaces).
Run ekat.img in the GWBASIC\QBASIC program
gxf2id.bas (the program is written out on the next page; e.g. the command
gwbasic gxf2id ‘ENTER’runs the program) to create the file ekat2.img; the
data will be read from left to right descending row by row, and ouptut
in a single column (IDRISI format) file named ekat2.img. Ignore any apparent
error messages re the end of file that appear on running this program.
(NOTE: if the IDRISI CRLF module in FILE, IMPORT, GENERAL CONVERSION TOOLS,
with options set to ‘CR/LF end of record markers for fixed length file’,
and a ‘Record length for output file’ value set to 13, the file generated
will have the second column appended to the 1st, and the 3rd to the 2nd,
etc rather than row appended to row. This is NOT what we require.)
Copy ekat2.img to ekat3.img. (This step is not absolutely necessary, it is done only to temporarily retain an ASCII version of the image file - the ASCII file ekat3.img will be converted to a binary image once it is run in IDRISI)
Create an IDRISI ekat3.doc file (click FILE, DOCUMENT and enter ekat3.doc as the file name, with ‘Data type’ = real; ‘File type’ = ASCII; data value minimum = 0, data maximum = 15, and the maximum and minimum limits of the image, as contained in the header of the Vision file. Enter the UTM zone as UTM - 14n and metres.
Display the image ekat3.img, with DISPLAY; the ASCII image file will be converted to an IDRISI binary file. Check the distribution of K values with HISTOGRAM.
Note: to see the variation in the lower values by density slicing of the image, which has K values varying from 0 to 15, set the maximum data value in the image .doc file to a lower value or use a palette that emphasizes the lower values. Write a DISPLAY macro with the minimum and maxiumu K values set as parameter variables (%1, %2).
GWBASIC/QBASIC PROGRAM TO CONVERT GXF ASCII FILES TO IDRISI FORMAT
10 REM TO CONVERT .GXF ASCII DATA FILES FROM 6 COLUMN
TO SINGLE COLUMN FILES
1930 A$ = "EKAT.IMG":REM NAME OF GXF FILE WITH HEADER
REMOVED IN WINDOWS WORD
1940 D$ = "C:\GRIDCON2\" + A$
1950 B$ = "EKAT2.IMG":REM NAME OF OUTPUT IDRISI
FILE
1960 J$ = "C:\GRIDCON2\" + B$
2440 OPEN D$ FOR INPUT AS #2
2450 OPEN J$ FOR OUTPUT AS #3
2470 IF EOF(2) THEN 4060
2480 INPUT #2, A, B, C, D, E, F
2485 REM PRINT A; B; C; D; E; F
4040 PRINT #3, A
4041 PRINT #3, B
4042 PRINT #3, C
4043 PRINT #3, D
4044 PRINT #3, E
4045 PRINT #3, F
4050 GOTO 2470
4060 CLOSE 2
4070 CLOSE 3
5000 END
USE ‘SYSTEM ENTER’ TO EXIT GWBASIC
CARRY OUT THIS EXERCISE USING THE U_TH_AT.BIN
FILE