Learn R Programming

modiscloud (version 0.14)

byteint2bit_list: Convert a list of byte integer (0-255) to a table of 8 bits per row

Description

MODIS HDFs converted to tifs result in each pixel having a integer value from 0 to 255. byteint2bit converts this to a string of 8 bits (0/1 values).

Usage

byteint2bit_list(grdr_vals, reverse = TRUE)

Arguments

grdr_vals,
a list of integers between 0 and 255
reverse,
a logical (TRUE/FALSE) indicating whether or not the string of bits should be reversed. Default: TRUE

Value

byte_in_binary_table, a table, each cell has the 8 bits (0/1 values) in the correct order

Details

In the case of MODIS, the bits are read from RIGHT to LEFT, which is unnatural, so by default the function uses rev() to reverse the order of reading.

This function is just the mapply (multiply apply) version of byteint2bit

Note: the reversal means that, when interpreting the two 2-bit strings in the MODIS image, the interpretation of 01 and 10 is reversed from in the MODIS documentation.

References

Ackerman S, Frey R, Strabala K, Liu Y, Gumley L, Baum B and Menzel P (2010). "Discriminating clear-sky from cloud with MODIS algorithm theoretical basis document (MOD35)." MODIS Cloud Mask Team, Cooperative Institute for Meteorological Satellite Studies, University of Wisconsin - Madison. .

GoldsmithMatzkeDawson2013

See Also

extract_bit

byteint2bit

Examples

Run this code
grdr_vals = c(0,1,2,253,254,255)
byteint2bit_list(grdr_vals, reverse=TRUE)

Run the code above in your browser using DataLab