R/findmaxasc.r

Defines functions findmaxasc

Documented in findmaxasc

findmaxasc <- function(asc)
{
    if (!inherits(asc,"asc"))
        stop("asc should be of class \"asc\"")
    xyc <- getXYcoords(asc)
    asc2 <- asc
    asc[is.na(asc)] <- -9999

    toto <- .C("findmaxgrid",as.double(t(asc)), as.integer(nrow(asc)),
               as.integer(ncol(asc)), PACKAGE="adehabitat")[[1]]

    toto <- c(matrix(toto, ncol=ncol(asc), byrow=TRUE))
    xy <- expand.grid(xyc$x,xyc$y)
    xyb <- xy[which(toto>0.5),]
    xyb <- xyb[!is.na(join.asc(xyb,asc2)),]
    return(xyb)
}

Try the adehabitat package in your browser

Any scripts or data that you put into this service are public.

adehabitat documentation built on Jan. 28, 2018, 5:02 p.m.