Running ‘allier.R’ [1s/2s]
  Comparing ‘allier.Rout’ to ‘allier.Rout.save’ ... OK
  Running ‘blockkr.R’ [1s/1s]
  Comparing ‘blockkr.Rout’ to ‘blockkr.Rout.save’ ... OK
  Running ‘covtable.R’ [1s/1s]
  Comparing ‘covtable.Rout’ to ‘covtable.Rout.save’ ... OK
  Running ‘cv.R’ [1s/1s]
  Comparing ‘cv.Rout’ to ‘cv.Rout.save’ ...68c68
<  Min.   :4.644   Min.   :0.002371   Min.   :4.727   Min.   :-0.4190976  
---
>  Min.   :4.644   Min.   :0.002371   Min.   :4.727   Min.   :-0.4190977  
  Running ‘cv3d.R’ [1s/1s]
  Comparing ‘cv3d.Rout’ to ‘cv3d.Rout.save’ ...14c14
<  3rd Qu.: 0.161   3rd Qu.:0.240   3rd Qu.: 0.501   3rd Qu.: 0.8508  
---
>  3rd Qu.: 0.161   3rd Qu.:0.240   3rd Qu.: 0.500   3rd Qu.: 0.8508  
17,22c17,22
<  Min.   :-5.1678   Min.   : 1.0   Min.   :0.00678   Min.   :0.0034  
<  1st Qu.:-1.8749   1st Qu.:13.2   1st Qu.:0.23966   1st Qu.:0.2466  
<  Median : 0.2453   Median :25.5   Median :0.48668   Median :0.4525  
<  Mean   : 0.0167   Mean   :25.5   Mean   :0.49966   Mean   :0.4969  
<  3rd Qu.: 2.0201   3rd Qu.:37.8   3rd Qu.:0.74730   3rd Qu.:0.7394  
<  Max.   : 7.3541   Max.   :50.0   Max.   :0.98754   Max.   :0.9872  
---
>  Min.   :-5.168   Min.   : 1.0   Min.   :0.0068   Min.   :0.0034  
>  1st Qu.:-1.875   1st Qu.:13.2   1st Qu.:0.2397   1st Qu.:0.2466  
>  Median : 0.245   Median :25.5   Median :0.4867   Median :0.4525  
>  Mean   : 0.017   Mean   :25.5   Mean   :0.4997   Mean   :0.4969  
>  3rd Qu.: 2.020   3rd Qu.:37.8   3rd Qu.:0.7473   3rd Qu.:0.7394  
>  Max.   : 7.354   Max.   :50.0   Max.   :0.9875   Max.   :0.9872  
24,29c24,29
<  Min.   :0.00164  
<  1st Qu.:0.18646  
<  Median :0.44850  
<  Mean   :0.47142  
<  3rd Qu.:0.72403  
<  Max.   :0.99420  
---
>  Min.   :0.0016  
>  1st Qu.:0.1865  
>  Median :0.4485  
>  Mean   :0.4714  
>  3rd Qu.:0.7240  
>  Max.   :0.9942  
  Running ‘fit.R’ [1s/1s]
  Comparing ‘fit.Rout’ to ‘fit.Rout.save’ ... OK
  Running ‘krige0.R’ [2s/3s]
  Comparing ‘krige0.Rout’ to ‘krige0.Rout.save’ ... OK
  Running ‘line.R’ [1s/2s]
  Comparing ‘line.Rout’ to ‘line.Rout.save’ ... OK
  Running ‘merge.R’ [1s/1s]
  Comparing ‘merge.Rout’ to ‘merge.Rout.save’ ... OK
  Running ‘na.action.R’ [1s/1s]
  Comparing ‘na.action.Rout’ to ‘na.action.Rout.save’ ... OK
  Running ‘rings.R’ [1s/1s]
  Comparing ‘rings.Rout’ to ‘rings.Rout.save’ ... OK
  Running ‘sim.R’ [1s/1s]
  Comparing ‘sim.Rout’ to ‘sim.Rout.save’ ... OK
  Running ‘stars.R’ [8s/10s]
  Running ‘unproj.R’ [3s/4s]
  Comparing ‘unproj.Rout’ to ‘unproj.Rout.save’ ... OK
  Running ‘variogram.R’ [1s/1s]
  Comparing ‘variogram.Rout’ to ‘variogram.Rout.save’ ... OK
  Running ‘vdist.R’ [1s/1s]
  Comparing ‘vdist.Rout’ to ‘vdist.Rout.save’ ... OK
  Running ‘windst.R’ [3s/5s]
Running the tests in ‘tests/stars.R’ failed.
Complete output:
  > Sys.setenv(TZ = "UTC")
  > 
  > # 0. using sp:
  > 
  > suppressPackageStartupMessages(library(sp))
  > demo(meuse, ask = FALSE)
  
  
  	demo(meuse)
  	---- ~~~~~
  
  > require(sp)
  
  > crs = CRS("EPSG:28992")
  
  > data("meuse")
  
  > coordinates(meuse) <- ~x+y
  
  > proj4string(meuse) <- crs
  
  > data("meuse.grid")
  
  > coordinates(meuse.grid) <- ~x+y
  
  > gridded(meuse.grid) <- TRUE
  
  > proj4string(meuse.grid) <- crs
  
  > data("meuse.riv")
  
  > meuse.riv <- SpatialPolygons(list(Polygons(list(Polygon(meuse.riv)),"meuse.riv")))
  
  > proj4string(meuse.riv) <- crs
  
  > data("meuse.area")
  
  > meuse.area = SpatialPolygons(list(Polygons(list(Polygon(meuse.area)), "area")))
  
  > proj4string(meuse.area) <- crs
  > suppressPackageStartupMessages(library(gstat))
  > v = variogram(log(zinc)~1, meuse)
  > (v.fit = fit.variogram(v, vgm(1, "Sph", 900, 1)))
    model      psill    range
  1   Nug 0.05066243   0.0000
  2   Sph 0.59060780 897.0209
  > k_sp = krige(log(zinc)~1, meuse[-(1:5),], meuse[1:5,], v.fit)
  [using ordinary kriging]
  > k_sp_grd = krige(log(zinc)~1, meuse, meuse.grid, v.fit)
  [using ordinary kriging]
  > 
  > # 1. using sf:
  > suppressPackageStartupMessages(library(sf))
  > demo(meuse_sf, ask = FALSE, echo = FALSE)
  > # reloads meuse as data.frame, so
  > demo(meuse, ask = FALSE)
  
  
  	demo(meuse)
  	---- ~~~~~
  
  > require(sp)
  
  > crs = CRS("EPSG:28992")
  
  > data("meuse")
  
  > coordinates(meuse) <- ~x+y
  
  > proj4string(meuse) <- crs
  
  > data("meuse.grid")
  
  > coordinates(meuse.grid) <- ~x+y
  
  > gridded(meuse.grid) <- TRUE
  
  > proj4string(meuse.grid) <- crs
  
  > data("meuse.riv")
  
  > meuse.riv <- SpatialPolygons(list(Polygons(list(Polygon(meuse.riv)),"meuse.riv")))
  
  > proj4string(meuse.riv) <- crs
  
  > data("meuse.area")
  
  > meuse.area = SpatialPolygons(list(Polygons(list(Polygon(meuse.area)), "area")))
  
  > proj4string(meuse.area) <- crs
  > 
  > v = variogram(log(zinc)~1, meuse_sf)
  > (v.fit = fit.variogram(v, vgm(1, "Sph", 900, 1)))
    model      psill    range
  1   Nug 0.05066243   0.0000
  2   Sph 0.59060780 897.0209
  > k_sf = krige(log(zinc)~1, meuse_sf[-(1:5),], meuse_sf[1:5,], v.fit)
  [using ordinary kriging]
  > 
  > all.equal(k_sp, as(k_sf, "Spatial"), check.attributes = FALSE)
  [1] TRUE
  > all.equal(k_sp, as(k_sf, "Spatial"), check.attributes = TRUE)
  [1] "Attributes: < Component \"bbox\": Attributes: < Component \"dimnames\": Component 1: 2 string mismatches > >"  
  [2] "Attributes: < Component \"coords\": Attributes: < Component \"dimnames\": Component 2: 2 string mismatches > >"
  [3] "Attributes: < Component \"coords.nrs\": Numeric: lengths (2, 0) differ >"                                      
  > 
  > # 2. using stars for grid:
  > 
  > suppressPackageStartupMessages(library(stars))
  > st = st_as_stars(meuse.grid)
  > st_crs(st)
  Coordinate Reference System:
    User input: Amersfoort / RD New 
    wkt:
  PROJCRS["Amersfoort / RD New",
      BASEGEOGCRS["Amersfoort",
          DATUM["Amersfoort",
              ELLIPSOID["Bessel 1841",6377397.155,299.1528128,
                  LENGTHUNIT["metre",1]]],
          PRIMEM["Greenwich",0,
              ANGLEUNIT["degree",0.0174532925199433]],
          ID["EPSG",4289]],
      CONVERSION["RD New",
          METHOD["Oblique Stereographic",
              ID["EPSG",9809]],
          PARAMETER["Latitude of natural origin",52.1561605555556,
              ANGLEUNIT["degree",0.0174532925199433],
              ID["EPSG",8801]],
          PARAMETER["Longitude of natural origin",5.38763888888889,
              ANGLEUNIT["degree",0.0174532925199433],
              ID["EPSG",8802]],
          PARAMETER["Scale factor at natural origin",0.9999079,
              SCALEUNIT["unity",1],
              ID["EPSG",8805]],
          PARAMETER["False easting",155000,
              LENGTHUNIT["metre",1],
              ID["EPSG",8806]],
          PARAMETER["False northing",463000,
              LENGTHUNIT["metre",1],
              ID["EPSG",8807]]],
      CS[Cartesian,2],
          AXIS["easting (X)",east,
              ORDER[1],
              LENGTHUNIT["metre",1]],
          AXIS["northing (Y)",north,
              ORDER[2],
              LENGTHUNIT["metre",1]],
      USAGE[
          SCOPE["Engineering survey, topographic mapping."],
          AREA["Netherlands - onshore, including Waddenzee, Dutch Wadden Islands and 12-mile offshore coastal zone."],
          BBOX[50.75,3.2,53.7,7.22]],
      ID["EPSG",28992]]
  > 
  > # compare inputs:
  > sp = as(st, "Spatial")
  > fullgrid(meuse.grid) = TRUE
  > all.equal(sp, meuse.grid["dist"], check.attributes = FALSE)
  [1] "Names: Lengths (5, 1) differ (string compare on first 1)"
  [2] "Names: 1 string mismatch"                                
  > all.equal(sp, meuse.grid["dist"], check.attributes = TRUE, use.names = FALSE)
  [1] "Names: Lengths (5, 1) differ (string compare on first 1)"                                      
  [2] "Names: 1 string mismatch"                                                                      
  [3] "Attributes: < Component 3: Names: 1 string mismatch >"                                         
  [4] "Attributes: < Component 3: Length mismatch: comparison on first 1 components >"                
  [5] "Attributes: < Component 3: Component 1: Mean relative difference: 1.08298 >"                   
  [6] "Attributes: < Component 4: Attributes: < Component 2: names for current but not for target > >"
  [7] "Attributes: < Component 4: Attributes: < Component 3: names for current but not for target > >"
  > 
  > # kriging:
  > st_crs(st) = st_crs(meuse_sf) = NA # GDAL roundtrip messes them up!
  > k_st = if (Sys.getenv("USER") == "travis") {
  + 	try(krige(log(zinc)~1, meuse_sf, st, v.fit))
  + } else {
  + 	krige(log(zinc)~1, meuse_sf, st, v.fit)
  + }
  [using ordinary kriging]
  > k_st
  stars object with 2 dimensions and 2 attributes
  attribute(s):
                  Min.   1st Qu.    Median      Mean   3rd Qu.      Max. NA's
  var1.pred  4.7765547 5.2376293 5.5728839 5.7072287 6.1717619 7.4399911 5009
  var1.var   0.0854949 0.1372864 0.1621838 0.1853319 0.2116152 0.5002756 5009
  dimension(s):
    from  to offset delta x/y
  x    1  78 178440    40 [x]
  y    1 104 333760   -40 [y]
  > 
  > # handle factors, when going to stars?
  > k_sp_grd$cls = cut(k_sp_grd$var1.pred, c(0, 5, 6, 7, 8, 9))
  > st_as_stars(k_sp_grd)
  stars object with 2 dimensions and 3 attributes
  attribute(s):
     var1.pred       var1.var          cls      
   Min.   :4.777   Min.   :0.0855   (0,5]: 316  
   1st Qu.:5.238   1st Qu.:0.1373   (5,6]:1778  
   Median :5.573   Median :0.1622   (6,7]: 962  
   Mean   :5.707   Mean   :0.1853   (7,8]:  47  
   3rd Qu.:6.172   3rd Qu.:0.2116   (8,9]:   0  
   Max.   :7.440   Max.   :0.5003   NA's :5009  
   NA's   :5009    NA's   :5009                 
  dimension(s):
    from  to offset delta              refsys x/y
  x    1  78 178440    40 Amersfoort / RD New [x]
  y    1 104 333760   -40 Amersfoort / RD New [y]
  > if (require(raster, quietly = TRUE)) {
  +  print(st_as_stars(raster::stack(k_sp_grd))) # check
  +  print(all.equal(st_redimension(st_as_stars(k_sp_grd)), st_as_stars(raster::stack(k_sp_grd)), check.attributes=FALSE))
  + }
  stars object with 3 dimensions and 1 attribute
  attribute(s):
                  Min.   1st Qu. Median     Mean  3rd Qu.     Max.  NA's
  var1.pred  0.0854949 0.2116778      2 2.710347 5.237542 7.439991 15027
  dimension(s):
       from  to offset delta              refsys                          values
  x       1  78 178440    40 Amersfoort / RD New                            NULL
  y       1 104 333760   -40 Amersfoort / RD New                            NULL
  band    1   3     NA    NA                  NA var1.pred, var1.var , cls      
       x/y
  x    [x]
  y    [y]
  band    
  [1] TRUE
  > 
  > suppressPackageStartupMessages(library(spacetime))
  > 
  > tm = as.POSIXct("2019-02-25 15:37:24 CET")
  > n = 4
  > s = stars:::st_stars(list(foo = array(1:(n^3), rep(n,3))),
  + stars:::create_dimensions(list(
  +   x = stars:::create_dimension(from = 1, to = n, offset = 10, delta = 0.5),
  +   y = stars:::create_dimension(from = 1, to = n, offset = 0, delta = -0.7),
  +   time = stars:::create_dimension(values = tm + 1:n)),
  +   raster = stars:::get_raster(dimensions = c("x", "y")))
  +   )
  Error in `/.difftime`(diff(range(ud)), mean(ud)) : 
    second argument of / cannot be a "difftime" object
  Calls: <Anonymous> ... <Anonymous> -> regular_intervals -> isTRUE -> /.difftime
  Execution halted
Running the tests in ‘tests/windst.R’ failed.
Complete output:
  > suppressPackageStartupMessages(library(sp))
  > suppressPackageStartupMessages(library(spacetime))
  > suppressPackageStartupMessages(library(gstat))
  > suppressPackageStartupMessages(library(stars))
  > 
  > data(wind)
  > wind.loc$y = as.numeric(char2dms(as.character(wind.loc[["Latitude"]])))
  > wind.loc$x = as.numeric(char2dms(as.character(wind.loc[["Longitude"]])))
  > coordinates(wind.loc) = ~x+y
  > proj4string(wind.loc) = "+proj=longlat +datum=WGS84 +ellps=WGS84"
  > 
  > wind$time = ISOdate(wind$year+1900, wind$month, wind$day)
  > wind$jday = as.numeric(format(wind$time, '%j'))
  > stations = 4:15
  > windsqrt = sqrt(0.5148 * wind[stations]) # knots -> m/s
  > Jday = 1:366
  > daymeans = colMeans(
  + 	sapply(split(windsqrt - colMeans(windsqrt), wind$jday), colMeans))
  > meanwind = lowess(daymeans ~ Jday, f = 0.1)$y[wind$jday]
  > velocities = apply(windsqrt, 2, function(x) { x - meanwind })
  > # match order of columns in wind to Code in wind.loc;
  > # convert to utm zone 29, to be able to do interpolation in
  > # proper Euclidian (projected) space:
  > pts = coordinates(wind.loc[match(names(wind[4:15]), wind.loc$Code),])
  > pts = SpatialPoints(pts)
  > if (require(sp, quietly = TRUE) && require(maps, quietly = TRUE)) {
  + proj4string(pts) = "+proj=longlat +datum=WGS84 +ellps=WGS84"
  + utm29 = "+proj=utm +zone=29 +datum=WGS84 +ellps=WGS84"
  + pts = as(st_transform(st_as_sfc(pts), utm29), "Spatial")
  + # note the t() in:
  + w = STFDF(pts, wind$time, data.frame(values = as.vector(t(velocities))))
  + 
  + library(mapdata)
  + mp = map("worldHires", xlim = c(-11,-5.4), ylim = c(51,55.5), plot=FALSE)
  + sf = st_transform(st_as_sf(mp, fill = FALSE), utm29)
  + m = as(sf, "Spatial")
  + 
  + # setup grid
  + grd = SpatialPixels(SpatialPoints(makegrid(m, n = 300)),
  + 	proj4string = m@proj4string)
  + # grd$t = rep(1, nrow(grd))
  + #coordinates(grd) = ~x1+x2
  + #gridded(grd)=TRUE
  + 
  + # select april 1961:
  + w = w[, "1961-04"]
  + 
  + covfn = function(x, y = x) { 
  + 	du = spDists(coordinates(x), coordinates(y))
  + 	t1 = as.numeric(index(x)) # time in seconds
  + 	t2 = as.numeric(index(y)) # time in seconds
  + 	dt = abs(outer(t1, t2, "-"))
  + 	# separable, product covariance model:
  + 	0.6 * exp(-du/750000) * exp(-dt / (1.5 * 3600 * 24))
  + }
  + 
  + n = 10
  + tgrd = seq(min(index(w)), max(index(w)), length=n)
  + pred = krige0(sqrt(values)~1, w, STF(grd, tgrd), covfn)
  + layout = list(list("sp.points", pts, first=F, cex=.5),
  + 	list("sp.lines", m, col='grey'))
  + wind.pr0 = STFDF(grd, tgrd, data.frame(var1.pred = pred))
  + 
  + v = vgmST("separable",
  +           space = vgm(1, "Exp", 750000), 
  +           time = vgm(1, "Exp", 1.5 * 3600 * 24),
  +           sill = 0.6)
  + wind.ST = krigeST(sqrt(values)~1, w, STF(grd, tgrd), v)
  + 
  + all.equal(wind.pr0, wind.ST)
  + 
  + # stars:
  + df = data.frame(a = rep(NA, 324*10))
  + s = STF(grd, tgrd)
  + newd = addAttrToGeom(s, df)
  + wind.sta = krigeST(sqrt(values)~1, st_as_stars(w), st_as_stars(newd), v)
  + # 1
  + plot(stars::st_as_stars(wind.ST), breaks = "equal", col = sf.colors())
  + # 2
  + stplot(wind.ST)
  + # 3
  + plot(wind.sta, breaks = "equal", col = sf.colors())
  + st_as_stars(wind.ST)[[1]][1:3,1:3,1]
  + (wind.sta)[[1]][1:3,1:3,1]
  + st_bbox(wind.sta)
  + bbox(wind.ST)
  + all.equal(wind.sta, stars::st_as_stars(wind.ST), check.attributes = FALSE)
  + 
  + # 4: roundtrip wind.sta->STFDF->stars
  + rt = stars::st_as_stars(as(wind.sta, "STFDF"))
  + plot(rt, breaks = "equal", col = sf.colors())
  + # 5:
  + stplot(as(wind.sta, "STFDF"))
  + st_bbox(rt)
  + 
  + # 6:
  + stplot(as(st_as_stars(wind.ST), "STFDF"))
  + }
  Error in `/.difftime`(diff(range(ud)), mean(ud)) : 
    second argument of / cannot be a "difftime" object
  Calls: krigeST ... create_dimension -> regular_intervals -> isTRUE -> /.difftime
  In addition: Warning message:
  In krigeST(sqrt(values) ~ 1, w, STF(grd, tgrd), v) :
    The spatio-temporal variogram model does not carry the strongly recommended attribute 'temporal unit'.
   The unit 'secs' has been assumed. krigeST could not check whether the temporal distances between locations and in the variogram coincide.
  Execution halted