R/classRaster_is.na.R

'is.na.ursaRaster' <- function(x) 
{
   if (is.na(x$con$posZ[1]))
      val <- rep(NA,prod(x$dim))
   else
      val <- rep(NA,x$dim[1]*length(x$con$posZ))
   val[which(is.na(c(x$value)))] <- 1L
   x$value[] <- val
   if (!is.na(ignorevalue(x)))
      ignorevalue(x) <- 127L
   rm(val)
   .gc()
   x
}
'is.infinite.ursaRaster' <- function(x) 
{
   if (is.na(x$con$posZ[1]))
      val <- rep(NA,prod(x$dim))
   else
      val <- rep(NA,x$dim[1]*length(x$con$posZ))
   val[which(is.infinite(c(x$value)))] <- 1L
   x$value[] <- val
   if (!is.na(ignorevalue(x)))
      ignorevalue(x) <- 127L
   rm(val)
   .gc()
   x
}
'is.nan.ursaRaster' <- function(x) 
{
   if (is.na(x$con$posZ[1]))
      val <- rep(NA,prod(x$dim))
   else
      val <- rep(NA,x$dim[1]*length(x$con$posZ))
   val[which(is.nan(c(x$value)))] <- 1L
   x$value[] <- val
   if (!is.na(ignorevalue(x)))
      ignorevalue(x) <- 127L
   rm(val)
   .gc()
   x
}
'is.na<-.ursaRaster' <- function(x,value)
{
   x$value[is.na(x$value)] <- value
   x
}

Try the ursa package in your browser

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

ursa documentation built on Oct. 17, 2023, 5:11 p.m.