McIDAS Programmer's Manual
GRIDnnnn
Grid files, where nnnn is a user-defined number.
A grid has two components:
- a 64-word header describing the grid projection, grid directory, gridded variable, level parameter, time of the data, etc.
- the actual grid data, which is an n - by m -word matrix
A grid file is a binary file, which may contain a user-defined maximum number of grids. By default, a grid file is created with the ability to store 159 grids unless otherwise specified.
Grid file numbers can be between 1 and 999999. If a grid file number is five or six digits, the file name begins with only GRI or GR. For example, grid file number 12345 has the file name GRI12345, but grid file number 123456 has the file name GR123456.
Grid files do not have to follow this standard naming convention. The file masking option of DSSERVE may be used to access a data file of any name through the ADDE.
The word allocation for grid files is divided into several sections below. The grid file directory is described first, followed by the grid header. The first 33 words and words 40 through 64 of the grid header are the same for all grid types; however, words 34 to 39 are specific to a particular grid type.
For grid file Applications Program Interfaces (APIs), refer to the API functions list at the end of this section.
Grid file directory
|
|
0 - 7
|
32 characters of label information
|
8
|
project number used to create the grid file
|
9
|
date the file was created, yyyddd
|
10
|
maximum number of grids (n) in the grid file
|
10+1
|
word offset, from the beginning of the grid file, where grid 1 starts; if the offset is -1, no grids exist
|
...
|
...
|
10+n
|
word offset for grid n
|
10+ n+1
|
next available address to start writing the next grid
|
Grid header
Each grid header contains 64 words. The offset of the first word in the header is defined by the word offset in Words 10 +1 through 10 + n in the grid file, where n is the grid number.
|
|
1
|
total size; rows * columns (not to exceed the value of MAXGRIDPT in g ridparm.inc)
|
2
|
number of rows
|
3
|
number of columns
|
4
|
Julian date of the data, ccyyddd
|
5
|
time of the data, hhmmss
|
6
|
forecast time for the grid, if applicable
|
7
|
name of the gridded variable, four character ASCII
|
8
|
scale of the gridded variable, specified as a power of 10
|
9
|
units of the gridded variable, four character ASCII
|
10
|
value of the vertical level
1013 = 'MSL'
999 = ' '
0 = 'TRO'
1001 = 'SFC'
(Otherwise, it is displayed as entered.)
|
11
|
scale of the vertical level
|
12
|
unit of the vertical level
|
13
|
gridded variable type:
1 = time difference
2 = time average
4 = level difference
8 = level average
(or any sum of 1, 2, 4 and 8)
|
14
|
used if the grid parameter is a time difference or time average, hhmmss
|
15
|
used if the grid parameter is a level difference or level average; values are the same as Word 9
|
16 - 32
|
reserved
|
33
|
grid origin; identifies the type of program that generated the grid d ata
|
34
|
grid projection type:
1 = pseudo-Mercator
2 = polar stereographic or Lambert conformal
3 = equidistant
4 = pseudo-Mercator (more general)
5 = no navigation
6 = tangent cone
|
35 - 40
|
varies, depending on the grid type; see the GRIDnnnn data file in Chapter 6 for more information
|
41 - 52
|
reserved; filled only if the grid was created by the McIDAS-XCD GRIB decoder
|
49
|
geographic grib number
|
50
|
parameter grib number
|
51
|
model grib number
|
52
|
level grib number
|
53 - 64
|
grid description
|
Remaining header words if grid type = 1 or 4 (pseudo-Mercator)
|
|
35
|
maximum latitude of the grid, degrees*10000
|
36
|
maximum longitude of the grid, degrees*10000
|
37
|
minimum latitude of the grid, degrees*10000
|
38
|
minimum longitude of the grid, degrees*10000
|
If TYPE=1:
|
|
39
|
increment between grid points; same in x/y directions
|
40
|
reserved
|
If TYPE=4:
|
|
39
|
increment between the grid points (latitude)
|
40
|
increment between the grid points (longitude)
|
Remaining header words if grid type = 2 (polar stereographic or Lambert conformal)
|
|
35
|
row number of the North Pole*10000
|
36
|
column number of the North Pole*10000
|
37
|
column spacing at standard latitude, meters
|
38
|
longitude parallel to columns, degrees*10000
|
39 - 40
|
standard latitudes, degrees*10000; set these two equal for polar stereographic
|
Remaining header words if grid type = 3 (equidistant)
|
|
35
|
latitude of (1,1), degrees*10000
|
36
|
longitude of (1,1), degrees*10000
|
37
|
clockwise rotation of column 1 relative to north, degrees*10000
|
38
|
column spacing, in meters
|
39
|
row spacing, in meters
|
Remaining header words if grid type = 5 (no navigation)
Remaining header words if grid type = 6 (tangent cone)
|
|
35
|
row number of the North Pole*10000
|
36
|
column number of the North Pole*10000
|
37
|
column spacing at standard latitude, meters
|
38
|
longitude parallel to columns, degrees*10000
|
39
|
standard latitude, degrees*10000
|
40
|
reserved
|
Reserved header words if grid was created by the McIDAS-XCD GRIB decoder
For more information, refer to the National Centers for Environmental Prediction Office Note 388: GRIB, Edition 1.
|
|
47
|
date grid was filed, yyyddd
|
48
|
time grid was filed, hhmmss
|
49
|
original geographic ID; GRIB projection number (PDS octet 7)
|
50
|
original parameter ID; GRIB parameter number (PDS octet 9)
|
51
|
original process ID or model number (PDS octet 6)
|
52
|
original level type (PDS octet 10)
|
Grid data
|
|
offset + 64
|
beginning of the grid data
|
...
|
...
|
offset + 64 + (rows*columns) - 1
|
end of the grid data
|
API functions
|
|
mcgdir
|
opens a connection to read a grid file directory
|
mcgdrd
|
reads a grid file directory
|
mcgfdrd
|
reads a grid file header
|
mcgget
|
opens a connection to read a grid
|
mcgridf
|
reads a grid in Fortran (column-major) order
|
mcgridc
|
reads a grid in C (row-major) order
|
mcgput
|
opens a connection to write a grid
|
mcgoutf
|
writes a grid in Fortran (column-major) order
|
mcgoutc
|
writes a grid in C (row-major) order
|
igquit
|
deletes a grid file
|
m0gsort
|
gets grid selection parameters from the command line
|