Description Usage Arguments Details Value Author(s) References See Also Examples
In many MODIS products, the information for each pixel is stored in a byte, which represents numbers between 0 and 255. A byte is made up of 8 bits, and is a base 2 representation of the number. In the MODIS cloud product, each bit encodes information; see documentation of the MODIS cloud product in question.
1 | extract_bit(intval, bitnum)
|
intval |
An integer between 0 and 255 |
bitnum |
The bit number to return, between 1 and 8 |
This function takes a byte and extracts the bits. The
bits are in whatever order they are in the byte. If
reading in the reverse direction is needed, the user
should use rev
.
bitval
The value of the bit (0 or 1).
Nicholas J. Matzke matzke@berkeley.edu
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. <URL: http://modis-atmos.gsfc.nasa.gov/_docs/MOD35_ATBD_Collection6.pdf>.
GoldsmithMatzkeDawson2013
1 2 3 4 | intval = 123
extract_bit(intval, bitnum=1)
extract_bit(intval, bitnum=2)
extract_bit(intval, bitnum=8)
|
Loading required package: date
Loading required package: sp
Loading required package: sfsmisc
Loading required package: raster
Loading required package: rgdal
rgdal: version: 1.5-18, (SVN revision 1082)
Geospatial Data Abstraction Library extensions to R successfully loaded
Loaded GDAL runtime: GDAL 3.0.4, released 2020/01/28
Path to GDAL shared files: /usr/share/gdal
GDAL binary built with GEOS: TRUE
Loaded PROJ runtime: Rel. 6.3.1, February 10th, 2020, [PJ_VERSION: 631]
Path to PROJ shared files: /usr/share/proj
Linking to sp version:1.4-4
To mute warnings of possible GDAL/OSR exportToProj4() degradation,
use options("rgdal_show_exportToProj4_warnings"="none") before loading rgdal.
[1] 1
[1] 1
[1] 0
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.