GRIB2 - DATA REPRESENTATION TEMPLATE 5.41

Grid point data - Portable Network Graphics (PNG) Format

Created 02/14/2006

Note:  For most templates, details of the packing process are described in Regulation 92.9.4.


Octet No. Contents
12-15
Reference value (R) (IEEE 32-bit floating-point value)
16-17
Binary scale factor (E)
18-19
Decimal scale factor (D)
20
Number of bits required to hold the resulting scaled and referenced data values. (i.e. The depth of the grayscale image.) (see Note 2)
21
Type of original field values (see Code Table 5.1)


Notes:

(1) The intent of this template is to scale the grid point data to obtain desired precision, if appropriate, and then subtract out reference value from the scaled field as is done using Data Representation Template 5.0. After this, the resulting grid point field can be treated as an image and is then encoded into the PNG format. To unpack the data field, the PNG stream is decoded back into an image, and the original field is obtained from the image data as described in regulation 92.9.4, Note (4).

(2) PNG does not support all bit-depths in an image, so it is necessary to define which depths can be used and how they are to be treated. For grayscale images, PNG supports depths of 1, 2, 4, 8 or 16 bits. Red-Green-Blue (RGB) color images can have depths of 8 or 16 bits with an optional alpha sample. Valid values for octet 20 can be:

1, 2, 4, 8, or 16 - treat as a grayscale image

24 - treat as RGB color image (each component having 8 bit depth)

32 - treat as RGB w/alpha sample color image (each component having 8 bit depth)

(3) The order of the data points should remain as specified in the scanning mode flags (Flag Table 3.4) set in the appropriate Grid Definition Template, even though the PNG standard specifies that an image is stored starting at the top left corner and scans across each row from left to right starting with the top row. Users should set the image width to Ni (or Nx) and the height to Nj (or Ny) if bit 3 of the scanning mode flag equals 0 (adjacent points in i (x) order), when encoding the "image." If bit 3 of the scanning mode flags equals 1 (adjacent points in j (y) order), it may be advantageous to set the image width to Nj (or Ny) and the height to Ni (or Nx).

(4) This template should not be used when the data points are not available on a rectangular grid, such as occurs if some data points are bit-mapped out or if section 3 describes a quasi-regular grid. If it is necessary to use this template on such a grid, the data field can be treated as a one dimensional image where the height is set to 1 and the width is set to the total number of data points specified in octets 6-9.

(5) Negative values of E or D shall be represented according to Regulation 92.1.5.


Back