This CD-ROM contains global Top-of-the Atmopshere (TOA) images and products derived from Advanced Very High Resolution Radiometer (AVHRR). These products were developed on a Silicon Graphics Inc. (SGI) workstation using the C language as part of the Global Vegetation Index (GVI) project by the Climate Research and Applications Division (CRAD) Land Surface Team of the Office of Research and Applications (ORA). The data on this CD-ROM consists of D-Level products, which are described in the GVI Users Guide (Kidwell, 1994). In order to ensure easy portability across all platforms, the data was scaled to 8-bits or 1-byte. Each uncompressed image is made up of 2500 columns and 904 rows of data, with 0.144 degrees (nominally 0.15 degrees) latitude/longitude resolution, giving a total size of 2260000 bytes/image. The purpose of this section is to read the 2500 x 904 image.
Each image is read by rows, starting with row 1 at 75 N, and ending with row 904 at 55 S. Every row begins at 180 W longtiude, and each sucessive map cell would be 0.144 degrees east of the previous map cell. Therefore, the upper left corner of the image starts at 75 N, 180 W, and ends in the lower right corner of the image, at 55 S, 180 E. The physical range of the data is between 0 and 255, with all ocean values containing the value 0.
Since the binary imagery is character data, you cannot
browse through it. Howver, the character data can be easily
converted into integer values. The following is a list of
FORTRAN and C programs that can be used as a guide for reading
the files. Each of these programs will convert the character
data into integer values. Reading the 8-bit imagery is somewhat
platform specific. The coding is broken down by language and
platform.
NOTE: THE OUTPUT DATA IS BEING WRITTEN TO UNIT=6, THE SCREEN.
The following is a list of programs that should be used based on your platform.
One word of caution with the VAX and DEC ALPHA. Please make sure that the data read from the CD-ROM or whatever media type you are using blocks the data in 2500 byte blocks. Particularly with the VAX and DEC ALPHA machines, there is a tendency to default to 512 byte blocks, which means you will NOT be able to read the data with these programs.
To mount the CD-ROM on a VAX or DEC ALPHA machine, use the following as an example:
mount devicename /media=cd /und=fixed:none:2500)
PROGRAM CONVRT
C
C THIS PROGRAM IS DESIGNED TO READ 8-BIT IMAGE DATA AND
C OUTPUT THE DATA AS ASCII TEXT WITH 2260000 RECORDS. THIS
C WORKS OUT TO 1 RECORD PER PIXEL. UNIT 10 IS THE INPUT FILE
C YOU ARE TRYING TO READ, AND IN THE EXAMPLE, UNIT 6 IS WHERE
C THE OUTPUT IS GOING TO.
C
C **********************************************************
C COMMENTS ABOUT THE FORTRAN READING PROGRAM
C **********************************************************
C
C THE NUMBER OF COLUMNS IS 2500 AND THE NUMBER OF ROWS IS 904.
C THE BLOCKING FACTOR IS 2500 BYTES. YOU'LL NOTICE THAT THE
C RECL (RECORD LENGTH) IS 625. 625 REPRESENTS THE NUMBER OF 4-
C BYTE WORDS PER RECORD. THE DATA WILL BE OUTPUT TO UNIT=6 ONE
C PIXEL AT A TIME. THEREFORE, THE OUTPUT FILE WILL CONTAIN
C 2260000 LINES OR RECORDS IN IT. THE DATA STARTS IN THE UPPER
C LEFT HAND CORNER AT 75N, 180W AND ENDS IN THE BOTTOM RIGHT
C HAND CORNER AT 55S, 180E. EVERY ROW BEGINS AT 180 W
C LONGITUDE, AND EACH SUCCESSIVE MAP CELL IS 0.144ø EAST OF THE
C PREVIOUS CELL. THE OUTPUT DATA RANGE WILL BE BETWEEN 0 AND
C 255. THE OCEAN MAP CELLS ARE ALL ZEROS.
C
C **************************
C DECLARE ALL VARIABLES
C **************************
C
CHARACTER*1 IMAGE(2500)
CHARACTER*8 HEX(2500)
INTEGER DATA(2500)
C
C ********************************
C OPEN FILES TO READ
C ********************************
C
OPEN(UNIT=10,FILE='GVI.DATA',ACCESS='DIRECT',
$RECL=625,FORM='UNFORMATTED',STATUS='UNKNOWN')
DO 10 I=1,904
READ(10,REC=I) IMAGE
DO 15 J=1,2500
WRITE(HEX(J),'(Z2)') IMAGE(J)
READ(HEX(J),'(Z2)') DATA(J)
15 CONTINUE
DO 20 J=1,2500
WRITE(6,'(I4)') DATA(J)
20 CONTINUE
10 CONTINUE
STOP
END
With the CRAY, the following script (cray.sh) should be used
used with the compiled FORTRAN code.
PROGRAM CONVRT
C
C THIS PROGRAM IS DESIGNED TO READ 8-BIT IMAGE DATA AND
C OUTPUT THE DATA AS ASCII TEXT.
C
C **********************************************************
C COMMENTS ABOUT THE FORTRAN READING PROGRAM
C **********************************************************
C
C THE NUMBER OF COLUMNS IS 2500 AND THE NUMBER OF ROWS IS 904.
C THE BLOCKING FACTOR IS 2500 BYTES. YOU'LL NOTICE THAT THE
C RECL (RECORD LENGTH) IS 625. 625 REPRESENTS THE NUMBER OF 4-
C BYTE WORDS PER RECORD. THE DATA WILL BE OUTPUT TO UNIT=6 ONE
C PIXEL AT A TIME. THEREFORE, THE OUTPUT FILE WILL CONTAIN
C 2260000 LINES OR RECORDS IN IT. THE DATA STARTS IN THE UPPER
C LEFT HAND CORNER AT 75N, 180W AND ENDS IN THE BOTTOM RIGHT
C HAND CORNER AT 55S, 180E. EVERY ROW BEGINS AT 180 W
C LONGITUDE, AND EACH SUCCESSIVE MAP CELL IS 0.144ø EAST OF THE
C PREVIOUS CELL. THE OUTPUT DATA RANGE WILL BE BETWEEN 0 AND
C 255. THE OCEAN MAP CELLS ARE ALL ZEROS.
C
C ********************************
C DECLARE ALL VARIABLES
C ********************************
C
CHARACTER IMAGE
C
C
Do J = 1,904
Do I = 1 , 2500
1 READ(10) IMAGE
write(6,*) ichar(IMAGE)
enddo
enddo
STOP
END
The shell script to use with the FORTRAN code is the
following:
#!/bin/sh
assign -R
assign -a gvi.data -sunblocked u:10
cf77 filename
./a.out
exit
where,
assign -R = Reset all assign attributes.
assign -a filename -sunblocked u:10 = data file "filename" has
structure unblocked and has been assigned to unit 10.
cf77 filename = Use the cray FORTRAN 77 compiler on input file
"filename" containing program CONVRT code.
./a.out = The executable
file://fortran.html
Revised: 25 February 1997