mt_bbox: Converts lower-left sinusoidal coordinates to lat-lon sf...

View source: R/coordinate_conversion.R

mt_bboxR Documentation

Converts lower-left sinusoidal coordinates to lat-lon sf bounding box

Description

Converts lower-left sinusoidal coordinates to lat-lon sf bounding box

Usage

mt_bbox(xllcorner, yllcorner, cellsize, nrows, ncols, transform = TRUE)

Arguments

xllcorner

lower left x coordinate as provided by mt_subset

yllcorner

lower left y coordinate as provided by mt_subset

cellsize

cell size provided by mt_subset

nrows

cell size provided by mt_subset

ncols

cell size provided by mt_subset

transform

transform the bounding box from sin to lat long coordinates, TRUE or FALSE (default = TRUE)

See Also

sin_to_ll, mt_subset

Examples



# Download some test data
subset <- mt_subset(product = "MOD11A2",
                        lat = 40,
                        lon = -110,
                        band = "LST_Day_1km",
                        start = "2004-01-01",
                        end = "2004-03-31",
                        progress = FALSE)

# convert sinusoidal to lat / lon
lat_lon <- sin_to_ll(subset$xllcorner, subset$yllcorner)

# bind with the original dataframe
subset <- cbind(subset, lat_lon)

# convert to bounding box
bb <- apply(subset, 1, function(x){
  mt_bbox(xllcorner = x['xllcorner'],
          yllcorner = x['yllcorner'],
          cellsize = x['cellsize'],
          nrows = x['nrows'],
          ncols = x['ncols'])
})

head(bb)


MODISTools documentation built on Sept. 17, 2023, 1:07 a.m.