checkcellalignment: function to check if the cells of two objects align with each...

View source: R/checkcellalignment.R

checkcellalignmentR Documentation

function to check if the cells of two objects align with each other

Description

This function checks to see whether individual cells from one object align with those from another. The extents do not have to match or even overlap.

Usage

checkcellalignment(x, y)

Arguments

x, y

grid objects or a list with, as a minimum, the elements: xll, yll, and cellsize.

Details

The function will throw an error if the two objects don't have matching cell alignment. Alignment doesn't have to be absolutely perfect but must be very close; this allows for rounding error when cellsize is not an integer. See all.equal for more on the tolerances.

Value

If the two grids align then the function will return TRUE, otherwise it will throw an error.

See Also

matchextent,gridio2::gridintersect, gridio2::overlay all use this function. gridio2::coincide checks to see if two objects have matching cell alignment and extent.

Examples


a <- list(xll = 0, yll = 0, cellsize = 10, nrow = 100, ncol = 100)
b <- list(xll = 1000, yll = 2000, cellsize = 10, nrow = 50, ncol = 200)
checkcellalignment(a, b)  # TRUE

## Not run: 
c <- list(xll = 1, yll = 0, cellsize = 10, nrow = 100, ncol = 100)
checkcellalignment(a, c)  #  Error in checkcellalignment(a, c) :
                          #    Grids are misaligned in the x direction

## End(Not run)




ethanplunkett/gridprocess documentation built on Feb. 1, 2024, 2:24 a.m.