edzer / trajectories

Handling and analyzing trajectory and movement data
31 stars 15 forks source link

trajectories vulnerable to forthcoming changes in sp and rgdal #25

Open rsbivand opened 4 years ago

rsbivand commented 4 years ago

Running revdep checks for current rgdal on R-Forge - see:

https://stat.ethz.ch/pipermail/r-sig-geo/2019-November/027801.html

shows the errors in the attached test log, related to use of PROJ&/GDAL3 and required changes to sp and rgdal. If useful find a regerence to a docker image in this thread:

https://github.com/r-spatial/discuss/issues/28

Changes will occur quite fast, and packages need to be prepared.


R version 3.6.1 (2019-07-05) -- "Action of the Toes"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> Sys.setenv(TZ = "Europe/Berlin")
> # Load required libraries.
> 
> library(sp)
> library(spacetime)
> library(trajectories)
> library(rgdal)
rgdal: version: 1.5-1, (SVN revision 889)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28
 Path to GDAL shared files: /usr/local/share/gdal
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621]
 Path to PROJ.4 shared files: /usr/local/share/proj
 Linking to sp version: 1.3-3 
> 
> # Create test objects. Do not change! Changes to the test objects are likely to
> # have an impact on the test results. It is primarily validated against class
> # and dimension. However, the test functions check for the first dimension only,
> # since, in the majority of cases, a deviation of the second is not necessarily
> # associated with a regression.
> 
> t0 = as.POSIXct(as.Date("2013-09-30", tz = "CET"))
> set.seed(13531) # make sure rbind generates identical sequences on reproduction
> 
> # Person A, track 1.
> 
> x = c(7, 6, 5, 5, 4, 3, 3)
> y = c(7, 7, 6, 5, 5, 6, 7)
> n = length(x)
> t = t0 + cumsum(runif(n) * 60)
> crs = CRS("+proj=longlat +ellps=WGS84")
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> stidf = STIDF(SpatialPoints(cbind(x, y), crs), t, data.frame(co2 = rnorm(n)))
> A1 = Track(stidf)
> 
> # Person A, track 2.
> 
> x = c(7, 6, 6, 7, 7)
> y = c(6, 5, 4, 4, 3)
> n = length(x)
> t = max(t) + cumsum(runif(n) * 60)
> stidf = STIDF(SpatialPoints(cbind(x, y), crs), t, data.frame(co2 = rnorm(n)))
> A2 = Track(stidf)
> 
> # Tracks for person A.
> 
> A = Tracks(list(A1 = A1, A2 = A2))
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> 
> # Person B, track 1.
> 
> x = c(2, 2, 1, 1, 2, 3)
> y = c(5, 4, 3, 2, 2, 3)
> n = length(x)
> t = max(t) + cumsum(runif(n) * 60)
> stidf = STIDF(SpatialPoints(cbind(x, y), crs), t, data.frame(co2 = rnorm(n)))
> B1 = Track(stidf)
> 
> # Person B, track 2.
> 
> x = c(3, 3, 4, 3, 3, 4)
> y = c(5, 4, 3, 2, 1, 1)
> n = length(x)
> t = max(t) + cumsum(runif(n) * 60)
> stidf = STIDF(SpatialPoints(cbind(x, y), crs), t, data.frame(co2 = rnorm(n)))
> B2 = Track(stidf)
> 
> # Tracks for person B.
> 
> B = Tracks(list(B1 = B1, B2 = B2))
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> 
> # Tracks collection.
> 
> Tr = TracksCollection(list(A = A, B = B))
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> 
> all = list(A1, A2, B1, B2, A, B, Tr)
> 
> # Test methods.
> 
> checkClass = function(list, class) {
+   stopifnot(all(sapply(list, function(x) class(x)[1] == class)))
+ }
> 
> checkDim = function(list, dim) {
+   for(i in seq_along(list)) {
+       element = list[[i]]
+       if(class(element)[1] %in% c("data.frame", "xts", "STIDF", "SpatialPointsDataFrame"))
+           stopifnot(dim(element)[1] == dim[i])
+       else if(class(element)[1] == "Line")
+           stopifnot(dim(element@coords)[1] == dim[i])
+       else if(class(element)[1] == "Lines")
+           # For simplification purposes, the number of Line elements (= number
+           # of Tracks) is validated.
+           stopifnot(length(element@Lines) == dim[i])
+       else if(class(element)[1] %in% c("SpatialLines", "SpatialLinesDataFrame"))
+           # For simplification purposes, the sum of the number of Line
+           # elements (= total number of Tracks) is validated.
+           stopifnot(sum(sapply(element@lines, function(x) length(x@Lines))) == dim[i])
+       else
+           warning(paste("Validation against dimension of class '", class(element)[1], "' is not yet supported.", sep = ""))   
+   }
+ }
> 
> # Check coercion to segments.
> 
> res = lapply(all, function(x) as(x, "segments"))
> checkClass(res, "data.frame")
> dim = c(6, 4, 5, 5, 10, 10, 20)
> checkDim(res, dim)
> 
> # Check coercion to data frame.
> 
> res = lapply(all, function(x) as(x, "data.frame"))
> checkClass(res, "data.frame")
> dim = c(7, 5, 6, 6, 14, 14, 28)
> checkDim(res, dim)
> 
> # Check coercion to Line, Lines, SpatialLines and SpatialLinesDataFrame.
> 
> res = lapply(all[1:4], function(x) as(x, "Line"))
> checkClass(res, "Line")
> dim = c(7, 5, 6, 6)
> checkDim(res, dim)
> 
> res = lapply(all[1:6], function(x) as(x, "Lines"))
> checkClass(res, "Lines")
> dim = c(1, 1, 1, 1, 2, 2)
> checkDim(res, dim)
> 
> res = lapply(all, function(x) as(x, "SpatialLines"))
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
4: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
5: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
6: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
7: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> checkClass(res, "SpatialLines")
> dim = c(1, 1, 1, 1, 2, 2, 4)
> checkDim(res, dim)
> 
> res = lapply(all[5:length(all)], function(x) as(x, "SpatialLinesDataFrame"))
Warning messages:
1: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
3: In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> checkClass(res, "SpatialLinesDataFrame")
> dim = c(2, 2, 4)
> checkDim(res, dim)
> 
> # Check coercion to xts.
> 
> res = lapply(all, function(x) as(x, "xts"))
> checkClass(res, "xts")
> dim = c(7, 5, 6, 6, 12, 12, 24)
> checkDim(res, dim)
> 
> # Check coercion to STIDF.
> 
> res = lapply(all, function(x) as(x, "STIDF"))
There were 15 warnings (use warnings() to see them)
> checkClass(res, "STIDF")
> dim = c(7, 5, 6, 6, 12, 12, 24)
> checkDim(res, dim)
> 
> # Check coercion to SpatialPointsDataFrame.
> 
> res = lapply(all, function(x) as(x, "SpatialPointsDataFrame"))
There were 15 warnings (use warnings() to see them)
> checkClass(res, "SpatialPointsDataFrame")
> dim = c(7, 5, 6, 6, 12, 12, 24)
> checkDim(res, dim)
> 
> # Check proj4string methods.
> 
> stopifnot(all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")))
Error: all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")) is not TRUE
Execution halted
edzer commented 4 years ago

Thanks. I tried to reproduce these warnings (and error) in a docker container running GDAL 3.0.2 and PROJ 6.2.1 and rgdal 1.5-2. I don't see the warnings you got, but get several of this kind:

< Warning messages:
< 1: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) :
<   NULL source CRS comment, falling back to PROJ string
< 2: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) :
<   NULL target CRS comment, falling back to PROJ string

Was that to be expected?

``` * using log directory '//spacetime.Rcheck' * using R version 3.6.0 (2019-04-26) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: ASCII * checking for file 'spacetime/DESCRIPTION' ... OK * this is package 'spacetime' version '1.2-2' * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package 'spacetime' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK* using log directory '//spacetime.Rcheck' * using R version 3.6.0 (2019-04-26) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: ASCII * checking for file 'spacetime/DESCRIPTION' ... OK * this is package 'spacetime' version '1.2-2' * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package 'spacetime' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking sizes of PDF files under 'inst/doc' ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... 38,40c38,40 < rgeos version: 0.5-2, (SVN revision 621) < GEOS runtime version: 3.8.0-CAPI-1.13.1 < Linking to sp version: 1.3-2 --- > rgeos version: 0.3-28, (SVN revision 572) > GEOS runtime version: 3.6.2-CAPI-1.10.2 4d2925d6 > Linking to sp version: 1.3-1 58c58 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 60,65c60,65 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-2 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 70c70 < Source: "/usr/local/lib/R/site-library/maptools/shapes/sids.shp", layer: "sids" --- > Source: "/home/edzer/R/x86_64-pc-linux-gnu-library/3.5/maptools/shapes/sids.shp", layer: "sids" 97c97 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 99,104c99,104 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-2 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 106,114d105 < Warning messages: < 1: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL source CRS comment, falling back to PROJ string < 2: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL target CRS comment, falling back to PROJ string < 3: In spTransform(m, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL source CRS comment, falling back to PROJ string < 4: In spTransform(m, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL target CRS comment, falling back to PROJ string OK * checking for unstated dependencies in vignettes ... OK * checking package vignettes in 'inst/doc' ... OK * checking running R code from vignettes ... 'stgvis.Rmd' ... OK 'jss816.Rnw' using 'UTF-8' ... OK 'sto.Rnw' using 'UTF-8' ... OK 'stpg.Rnw' using 'UTF-8' ... OK 'stsubs.Rnw' using 'UTF-8' ... OK OK * checking re-building of vignette outputs ... NOTE Error(s) in re-building vignettes: --- re-building 'stgvis.Rmd' using knitr Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis' Welcome to googleVis version 0.6.4 Please read Google's Terms of Use before you start using the package: https://developers.google.com/terms/ Note, the plot method of googleVis will by default use the standard browser to display its output. See the googleVis package vignettes for more details, or visit https://github.com/mages/googleVis. To suppress this message use: suppressPackageStartupMessages(library(googleVis)) --- finished re-building 'stgvis.Rmd' --- re-building 'jss816.Rnw' using Sweave Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Checking rgeos availability: TRUE Warning: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read rgdal: version: 1.5-2, (SVN revision (unknown)) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 Path to GDAL shared files: /usr/local/share/gdal GDAL binary built with GEOS: FALSE Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] Path to PROJ.4 shared files: /usr/local/share/proj Linking to sp version: 1.3-2 Warning in spTransform(pts, utm29) : NULL source CRS comment, falling back to PROJ string Warning in spTransform(pts, utm29) : NULL target CRS comment, falling back to PROJ string Warning in spTransform(m, utm29) : NULL source CRS comment, falling back to PROJ string Warning in spTransform(m, utm29) : NULL target CRS comment, falling back to PROJ string Warning in krigeST(values ~ 1, wind.data, pred.grd, 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. Loading required package: ade4 Loading required package: adehabitatMA Loading required package: CircStats Loading required package: MASS Loading required package: boot Attaching package: 'boot' The following object is masked from 'package:lattice': melanoma Attaching package: 'adehabitatLT' The following object is masked from 'package:zoo': is.regular Loading required package: plyr Attaching package: 'plyr' The following object is masked from 'package:adehabitatLT': id The following object is masked from 'package:adehabitatMA': join The following object is masked from 'package:maps': ozone Warning: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'jss816.Rnw' failed with diagnostics: Running 'texi2dvi' on 'jss816.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'jss816.Rnw' --- re-building 'sto.Rnw' using Sweave Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'sto.Rnw' failed with diagnostics: Running 'texi2dvi' on 'sto.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'sto.Rnw' --- re-building 'stpg.Rnw' using Sweave Warning: undefined slot classes in definition of "ST_PG": con(class "PostgreSQLConnection") Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'stpg.Rnw' failed with diagnostics: Running 'texi2dvi' on 'stpg.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'stpg.Rnw' --- re-building 'stsubs.Rnw' using Sweave Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'stsubs.Rnw' failed with diagnostics: Running 'texi2dvi' on 'stsubs.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'stsubs.Rnw' SUMMARY: processing the following files failed: 'jss816.Rnw' 'sto.Rnw' 'stpg.Rnw' 'stsubs.Rnw' Error: Vignette re-building failed. Execution halted * checking PDF version of manual ... WARNING LaTeX errors when creating PDF version. This typically indicates Rd problems. * checking PDF version of manual without hyperrefs or index ... ERROR Re-running with no redirection of stdout/stderr. Hmm ... looks like a package You may want to clean up by 'rm -Rf /tmp/RtmpBySKLh/Rd2pdf12f42a041bb5' * DONE Status: 1 ERROR, 1 WARNING, 1 NOTE * checking for unstated dependencies in examples ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking sizes of PDF files under 'inst/doc' ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... 38,40c38,40 < rgeos version: 0.5-2, (SVN revision 621) < GEOS runtime version: 3.8.0-CAPI-1.13.1 < Linking to sp version: 1.3-2 --- > rgeos version: 0.3-28, (SVN revision 572) > GEOS runtime version: 3.6.2-CAPI-1.10.2 4d2925d6 > Linking to sp version: 1.3-1 58c58 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 60,65c60,65 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-2 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 70c70 < Source: "/usr/local/lib/R/site-library/maptools/shapes/sids.shp", layer: "sids" --- > Source: "/home/edzer/R/x86_64-pc-linux-gnu-library/3.5/maptools/shapes/sids.shp", layer: "sids" 97c97 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 99,104c99,104 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-2 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 106,114d105 < Warning messages: < 1: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL source CRS comment, falling back to PROJ string < 2: In spTransform(pts, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL target CRS comment, falling back to PROJ string < 3: In spTransform(m, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL source CRS comment, falling back to PROJ string < 4: In spTransform(m, CRS("+proj=utm +zone=29 +datum=WGS84")) : < NULL target CRS comment, falling back to PROJ string OK * checking for unstated dependencies in vignettes ... OK * checking package vignettes in 'inst/doc' ... OK * checking running R code from vignettes ... 'stgvis.Rmd' ... OK 'jss816.Rnw' using 'UTF-8' ... OK 'sto.Rnw' using 'UTF-8' ... OK 'stpg.Rnw' using 'UTF-8' ... OK 'stsubs.Rnw' using 'UTF-8' ... OK OK * checking re-building of vignette outputs ... NOTE Error(s) in re-building vignettes: --- re-building 'stgvis.Rmd' using knitr Creating a generic function for 'toJSON' from package 'jsonlite' in package 'googleVis' Welcome to googleVis version 0.6.4 Please read Google's Terms of Use before you start using the package: https://developers.google.com/terms/ Note, the plot method of googleVis will by default use the standard browser to display its output. See the googleVis package vignettes for more details, or visit https://github.com/mages/googleVis. To suppress this message use: suppressPackageStartupMessages(library(googleVis)) --- finished re-building 'stgvis.Rmd' --- re-building 'jss816.Rnw' using Sweave Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Checking rgeos availability: TRUE Warning: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read rgdal: version: 1.5-2, (SVN revision (unknown)) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 Path to GDAL shared files: /usr/local/share/gdal GDAL binary built with GEOS: FALSE Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] Path to PROJ.4 shared files: /usr/local/share/proj Linking to sp version: 1.3-2 Warning in spTransform(pts, utm29) : NULL source CRS comment, falling back to PROJ string Warning in spTransform(pts, utm29) : NULL target CRS comment, falling back to PROJ string Warning in spTransform(m, utm29) : NULL source CRS comment, falling back to PROJ string Warning in spTransform(m, utm29) : NULL target CRS comment, falling back to PROJ string Warning in krigeST(values ~ 1, wind.data, pred.grd, 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. Loading required package: ade4 Loading required package: adehabitatMA Loading required package: CircStats Loading required package: MASS Loading required package: boot Attaching package: 'boot' The following object is masked from 'package:lattice': melanoma Attaching package: 'adehabitatLT' The following object is masked from 'package:zoo': is.regular Loading required package: plyr Attaching package: 'plyr' The following object is masked from 'package:adehabitatLT': id The following object is masked from 'package:adehabitatMA': join The following object is masked from 'package:maps': ozone Warning: readShapePoly is deprecated; use rgdal::readOGR or sf::st_read Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'jss816.Rnw' failed with diagnostics: Running 'texi2dvi' on 'jss816.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'jss816.Rnw' --- re-building 'sto.Rnw' using Sweave Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'sto.Rnw' failed with diagnostics: Running 'texi2dvi' on 'sto.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'sto.Rnw' --- re-building 'stpg.Rnw' using Sweave Warning: undefined slot classes in definition of "ST_PG": con(class "PostgreSQLConnection") Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'stpg.Rnw' failed with diagnostics: Running 'texi2dvi' on 'stpg.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'stpg.Rnw' --- re-building 'stsubs.Rnw' using Sweave Loading required package: zoo Attaching package: 'zoo' The following objects are masked from 'package:base': as.Date, as.Date.numeric Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Warning in system2(command, args, env = env, stdout = outfile, stderr = errfile, : error in running command Error: processing vignette 'stsubs.Rnw' failed with diagnostics: Running 'texi2dvi' on 'stsubs.tex' failed. Messages: sh: 1: /usr/bin/texi2dvi: not found --- failed re-building 'stsubs.Rnw' SUMMARY: processing the following files failed: 'jss816.Rnw' 'sto.Rnw' 'stpg.Rnw' 'stsubs.Rnw' Error: Vignette re-building failed. Execution halted * checking PDF version of manual ... WARNING LaTeX errors when creating PDF version. This typically indicates Rd problems. * checking PDF version of manual without hyperrefs or index ... ERROR Re-running with no redirection of stdout/stderr. Hmm ... looks like a package You may want to clean up by 'rm -Rf /tmp/RtmpBySKLh/Rd2pdf12f42a041bb5' * DONE Status: 1 ERROR, 1 WARNING, 1 NOTE ```
rsbivand commented 4 years ago

The waarnings, yes certainly - they seem to come from pre-cooked objects (say from data()) where the "CRS" object is used as-is rather than regenerated as it would be if read with rgdal. If regenerated, the WKT2 comment would be added and would be used, but the warning is seen when there is no comment() and transformation falls back onto the PROJ string for proj_create().

Could you destill the voluminous details to see whether you find the error I found? I cannot confirm that you are using my fork sp 1.3-3 - install R-Forge rgdal first, then my github fork sp which requires rgdal >= 1.5-1?

edzer commented 4 years ago

Thanks! With the sp fork, I get a clean check:

``` Step 46/47 : RUN R CMD check --no-manual --no-vignettes spacetime_1.2-2.tar.gz ---> Running in 2b49f7a53e11 * using log directory '//spacetime.Rcheck' * using R version 3.6.0 (2019-04-26) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: ASCII * using options '--no-manual --no-vignettes' * checking for file 'spacetime/DESCRIPTION' ... OK * this is package 'spacetime' version '1.2-2' * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package 'spacetime' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking contents of 'data' directory ... OK * checking data for non-ASCII characters ... OK * checking data for ASCII and uncompressed saves ... OK * checking sizes of PDF files under 'inst/doc' ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... OK * checking for unstated dependencies in 'tests' ... OK * checking tests ... Running 'basic.R' Comparing 'basic.Rout' to 'basic.Rout.save' ... OK Running 'over.R' Comparing 'over.Rout' to 'over.Rout.save' ... OK Running 'raster.R' Comparing 'raster.Rout' to 'raster.Rout.save' ... OK Running 'rw.R' Comparing 'rw.Rout' to 'rw.Rout.save' ...38,40c38,40 < rgeos version: 0.5-2, (SVN revision 621) < GEOS runtime version: 3.8.0-CAPI-1.13.1 < Linking to sp version: 1.3-2 --- > rgeos version: 0.3-28, (SVN revision 572) > GEOS runtime version: 3.6.2-CAPI-1.10.2 4d2925d6 > Linking to sp version: 1.3-1 Running 'stconstruct.R' Comparing 'stconstruct.Rout' to 'stconstruct.Rout.save' ...58c58 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 60,65c60,65 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-3 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 70c70 < Source: "/usr/local/lib/R/site-library/maptools/shapes/sids.shp", layer: "sids" --- > Source: "/home/edzer/R/x86_64-pc-linux-gnu-library/3.5/maptools/shapes/sids.shp", layer: "sids" Running 'subsetting.R' Comparing 'subsetting.Rout' to 'subsetting.Rout.save' ... OK Running 'wind.R' Comparing 'wind.Rout' to 'wind.Rout.save' ...97c97 < rgdal: version: 1.5-2, (SVN revision (unknown)) --- > rgdal: version: 1.3-3, (SVN revision 759) 99,104c99,104 < Loaded GDAL runtime: GDAL 3.0.2, released 2019/10/28 < Path to GDAL shared files: /usr/local/share/gdal < GDAL binary built with GEOS: FALSE < Loaded PROJ.4 runtime: Rel. 6.2.1, November 1st, 2019, [PJ_VERSION: 621] < Path to PROJ.4 shared files: /usr/local/share/proj < Linking to sp version: 1.3-3 --- > Loaded GDAL runtime: GDAL 2.2.3, released 2017/11/20 > Path to GDAL shared files: /usr/share/gdal/2.2 > GDAL binary built with GEOS: TRUE > Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493] > Path to PROJ.4 shared files: (autodetected) > Linking to sp version: 1.3-1 OK * checking for unstated dependencies in vignettes ... OK * checking package vignettes in 'inst/doc' ... OK * checking running R code from vignettes ... SKIPPED * checking re-building of vignette outputs ... SKIPPED * DONE Status: OK ```
rsbivand commented 4 years ago

This is after correcting the error I found, right? Or can you not reproduce the error? If not, a change I made last night to accommodate plotKML may have cut in.

edzer commented 4 years ago

This was with fresh (Today) installs from github (sp) and r-forge (rgdal).

rsbivand commented 4 years ago

But had you changed the affected package from the CRAN release? Can you reproduce the error I found (non-identical crs strings - I guess 6.2.0 inserts +no_defs:

> CRS("+proj=longlat +ellps=WGS84")
CRS arguments: +proj=longlat +ellps=WGS84 +no_defs 
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
edzer commented 4 years ago

I checked the CRAN release. No errors here, but I can reproduce the ones you report at https://github.com/r-spatial/gstat/issues/56.

rsbivand commented 4 years ago

No taxidata anywhere. Re-running on my work machine by ssh, still ill at home. Error in tests still present. Further LaTeX errors (extra non-basic LaTeX packages missing). Error in:

* checking tests ...
  Running ‘tracks.R’
 ERROR
Running the tests in ‘tests/tracks.R’ failed.
Last 13 lines of output:
  > checkDim(res, dim)
  > 
  > # Check coercion to SpatialPointsDataFrame.
  > 
  > res = lapply(all, function(x) as(x, "SpatialPointsDataFrame"))
  There were 15 warnings (use warnings() to see them)
  > checkClass(res, "SpatialPointsDataFrame")
  > dim = c(7, 5, 6, 6, 12, 12, 24)
  > checkDim(res, dim)
  > 
  > # Check proj4string methods.
  > 
  > stopifnot(all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")))
  Error: all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")) is not TRUE
  Execution halted

Go to tests/track.R, do until all created:

> sapply(all, proj4string)
[1] "+proj=longlat +ellps=WGS84 +no_defs" "+proj=longlat +ellps=WGS84 +no_defs"
[3] "+proj=longlat +ellps=WGS84 +no_defs" "+proj=longlat +ellps=WGS84 +no_defs"
[5] "+proj=longlat +ellps=WGS84 +no_defs" "+proj=longlat +ellps=WGS84 +no_defs"
[7] "+proj=longlat +ellps=WGS84 +no_defs"
> unique(sapply(all, proj4string))
[1] "+proj=longlat +ellps=WGS84 +no_defs"
> stopifnot(all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")))
Error: all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")) is not TRUE

What is difficult here? Re-do after re-installing rgdal with Tom's mess from yesterday:

> unique(sapply(all, proj4string))
[1] "+proj=longlat +ellps=WGS84 +no_defs"
> stopifnot(all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")))
Error: all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")) is not TRUE

If you are running this on the correct basis, you cannot pass the test, because:

> crs = CRS("+proj=longlat +ellps=WGS84")
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
> crs
CRS arguments: +proj=longlat +ellps=WGS84 +no_defs 
> comment(crs)
[1] "GEOGCRS[\"unknown\",DATUM[\"Unknown based on WGS84 ellipsoid\",ELLIPSOID[\"WGS 84\",6378137,298.257223563,LENGTHUNIT[\"metre\",1],ID[\"EPSG\",7030]]],PRIMEM[\"Greenwich\",0,ANGLEUNIT[\"degree\",0.0174532925199433],ID[\"EPSG\",8901]],CS[ellipsoidal,2],AXIS[\"longitude\",east,ORDER[1],ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9122]]],AXIS[\"latitude\",north,ORDER[2],ANGLEUNIT[\"degree\",0.0174532925199433,ID[\"EPSG\",9122]]]]"

that is, crs in the test is not being created using sp 1.3-3 (my fork). Do debug(CRS) to see where it goes. You seem to be branching back to:

Browse[2]> rgdal::checkCRSArgs("+proj=longlat +ellps=WGS84")
[[1]]
[1] TRUE

[[2]]
[1] "+proj=longlat +ellps=WGS84"

Which of:

packageVersion("rgdal") < "1.5.1"

or

!rgdal::new_proj_and_gdal()

is TRUE for you?

The test in trajectories can only pass if both are TRUE, I think, and your declared setting should send the PROJ string to rgdal::checkCRSArgs_ng(), not rgdal::checkCRSArgs().

edzer commented 4 years ago

It was something else, but I found the problem now.

rsbivand commented 4 years ago

I'm not sure that it is easy to check for equality without pushing the test string out through the same runtime normalisation procedure, something like:

slot(crs, "projargs") == slot(CRS("+proj=longlat +ellps=WGS84"), "projargs")

which then uses the runtime CRS in play (old and new should both work) - that is do not test just string values without passing them through the constructor (same for st_crs()). We still have a problem with coverage and tests (a fetish IMO) if the CRS/crs are stored in an rda/rds object, so not generated with the same runtime representation.

rsbivand commented 4 years ago

This also works:

> comment(crs) == comment(CRS("+proj=longlat +ellps=WGS84"))
[1] TRUE
Warning message:
In showSRID(uprojargs, format = "PROJ", multiline = "NO") :
  Discarded datum Unknown_based_on_WGS84_ellipsoid in CRS definition
edzer commented 4 years ago

Looks like renaming all +ellps= to +datum=, and skipping literal proj4string identicals, did the job. Will try gstat next.

rsbivand commented 4 years ago

Won't this only work for +datum=WGS84? We know that only WGS84, NAD83 and NAD27 are permitted at present; I don't know that this will continue unconditionally. I feel that to avoid having to come back to this each time PROJ tightens PROJ string handling, we can't rely on what may work now. We know that importFromProj4() is asymmetric re. exportToProj4(), and I've also found that proj_create() is picky (does not like +init= in the instantiation string).

I agree that we need to skip literal proj4string identicals.I don't yet see a clear path to testing equality.

rsbivand commented 4 years ago
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ... ERROR
  Running ‘tracks.R’
Running the tests in ‘tests/tracks.R’ failed.
Last 13 lines of output:
  > checkDim(res, dim)
  > 
  > # Check coercion to SpatialPointsDataFrame.
  > 
  > res = lapply(all, function(x) as(x, "SpatialPointsDataFrame"))
  There were 15 warnings (use warnings() to see them)
  > checkClass(res, "SpatialPointsDataFrame")
  > dim = c(7, 5, 6, 6, 12, 12, 24)
  > checkDim(res, dim)
  > 
  > # Check proj4string methods.
  > 
  > stopifnot(all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")))
  Error: all(sapply(all, function(x) proj4string(x) == "+proj=longlat +ellps=WGS84")) is not TRUE
  Execution halted

with GDAL 3.0.4 and PROJ 6.3.0

rsbivand commented 4 years ago

Current github master resolves error.