2.3 MtkField

class MtkField
fieldname Field from grid.

>>> f = MtkFile('../Mtk_testdata/in/MISR_AM1_GRP_ELLIPSOID_GM_P037_O029058_AA_F03_0024.hdf').grid('BlueBand').field('Blue Radiance')

data_type
Data type of field.

>>> f.data_type
'uint16'

field_name
Field name.

>>> f.field_name
'Blue Radiance'

fill_value
Fill value.

>>> f.fill_value
65515

read( region)
Read data from field by specifying a MtkRegion. Returns a MtkDataPlane.

>>> r = MtkRegion(37, 50, 55)
>>> f.read(r)
<MisrToolkit.MtkDataPlane object at 0x18a0400>

Note: The MtkField read method always return a 2-D data plane buffer. Some fields in the MISR data products are multi-dimensional. In order to read one of these fields, the slice to read needs to be specified. A bracket notation on the fieldname is used for this purpose. For example RetrAppMask[0][5].

Additional dimensions can be determined using MtkGrid field_dims method or by referencing MISR Data Product Specification (DPS) Document. The actually definition of the indices are not described in the MISR product files and thus not described by the MISR Toolkit. These will have to be looked up in the MISR DPS. All indices are 0-based.

read( start_block, end_block)
Reads native fields and returns a 3-D NumPy array for the block range. The blocks are not assembled and are just stacked on top of each other. The CoordQuery functions can be used to map or convert geographic coordinates into block, line and sample which correspond to the data returned by this function.

This function is provided as an alternative to reading blocks one at a time using a MtkRegion.

>>> f.read(50, 55)
array([[[65515, 65515, 65515, ..., 65515, 65515, 65515],
        [65515, 65515, 65515, ..., 65515, 65515, 65515],
        [65515, 65515, 65515, ..., 65515, 65515, 65515],
        ...,
        [65515, 65515, 65515, ..., 65515, 65515, 65515],
        [65515, 65515, 65515, ..., 65515, 65515, 65515],
        [65515, 65515, 65515, ..., 65515, 65515, 65515]]], dtype=uint16)

Note: The block index returned by the CoordQuery functions are 1-based and are referenced to the entire MISR path. The 3-D array returned by this method is referenced to your 1-based start block and Python uses 0-based indexing, so adjust the block index accordingly.