Commit e770b051 authored by agebhard's avatar agebhard
Browse files

wrong types (double <-> integer corrected. interpp.new.R still crashes!

parent 9cb2d2b1
"interp.new"<-function(x, y, z, xo = seq(min(x), max(x), length = 40),
yo = seq(min(y), max(y), length = 40),
ncp = NULL, extrap = FALSE, duplicate = "error", dupfun = NULL)
yo = seq(min(y), max(y), length = 40), linear=F,
ncp = NULL, extrap = FALSE, duplicate = "error",
dupfun = NULL)
{
if(!(all(is.finite(x)) && all(is.finite(y)) && all(is.finite(z))))
stop("missing values and Infs not allowed")
......@@ -13,7 +14,11 @@
stop("use interp.old().")
}
}
if(linear){
cat("linear interpolation not yet implemented with interp.new().\n")
stop("use interp.old().")
}
drx <- diff(range(x))
dry <- diff(range(y))
if(drx == 0 || dry == 0)
......@@ -59,8 +64,14 @@
storage.mode(zo) <- "double"
miss <- !extrap #if not extrapolating use missing values
extrap <- matrix(T, nx, ny)
if(extrap & ncp == 0)
warning("Cannot extrapolate with linear option")
if(!is.null(ncp)){
if(extrap & ncp == 0)
warning("Cannot extrapolate with linear option")
}
else {
if(extrap & linear)
warning("Cannot extrapolate with linear option")
}
ans <- .Fortran("sdsf3p",
as.integer(1),
# as.integer(ncp),
......@@ -74,8 +85,8 @@
y = as.double(yo),
z = zo,
ier = integer(1),
integer(36 * n),
double(25 * n),
double(36 * n),
integer(25 * n),
extrap = as.logical(extrap)
)
temp <- ans[c("x", "y", "z", "extrap")]
......
......@@ -71,8 +71,8 @@
x = as.double(xo),
y = as.double(yo),
z = zo,
integer(17 * n),
double(25 * n),
double(17 * n),
integer(25 * n),
extrap = as.logical(extrap))
temp <- ans[c("x", "y", "z", "extrap")]
if(miss)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment