#######################################################
# Load a TIF
#######################################################
# Code excluded from CRAN check because it depends on modiscdata
## Not run:
# library(devtools)
# # The modiscdata (MODIS c=cloud data=data) package is too big for CRAN (60 MB); so it is available on github:
# # https://github.com/nmatzke/modiscdata
# # If we can't get install_github() to work, try install_url():
# # install_github(repo="modiscdata", username="nnmatzke")
# install_url(url="https://github.com/nmatzke/modiscdata/archive/master.zip")
# library(modiscdata)
# tifsdir = system.file("extdata/2002tif/", package="modiscdata")
# tiffns = list.files(tifsdir, pattern=".tif", full.names=TRUE)
# tiffns
#
# library(rgdal) # for readGDAL
#
# # numpixels in subset
# xdim = 538
# ydim = 538
#
#
# # Read the grid and the grid metadata
# coarsen_amount = 1
# xdim_new = xdim / floor(coarsen_amount)
# ydim_new = ydim / floor(coarsen_amount)
#
# fn = tiffns[1]
# grd = readGDAL(fn, output.dim=c(ydim_new, xdim_new))
#
# grdproj = CRS(proj4string(grd))
# grdproj
# grdbbox = attr(grd, "bbox")
# grdbbox
#
# #######################################################
# # Extract a particular pair of bits for all the pixels in the grid
# #######################################################
# bitnum = 2
# grdr_vals_bitstrings = get_bitgrid_2bits(grd, bitnum)
# length(grdr_vals_bitstrings)
# grdr_vals_bitstrings[1:50]
# ## End(Not run)
Run the code above in your browser using DataLab