Skip to content

Possible proj.4-related error coming when specifying CRS for raster

3 messages · Roger Bivand, Alex Zvoleff

#
Hi all,

Recently the glcm package I maintain has started throwing errors on all of the Linux-based CRAN test servers. The errors come when checking the examples included in the package. I have not been able to reproduce these errors locally on Linux (Ubuntu 18.04 running r-release and r-devel) or on Windows 10 (r-release and r-devel). The errors also don't come up on any of the r-hub servers.

Here is an example error from the CRAN test server:
Loading required package: raster
Loading required package: sp
Error in CRS(as.character(projection(crs))) :
  no arguments in initialization list
Calls: raster ... raster -> .local -> raster -> raster -> .local -> CRS
Execution halted

(full output here: https://www.r-project.org/nosvn/R.check/r-devel-linux-x86_64-debian-clang/glcm-00check.html)

The CRAN maintainers suggested I run R CMD check with _R_CHECK_SUGGESTS_ONLY_=FALSE, but that hasn't worked - even when the env variable is set I still don't see the error on my end. Given that, they suggested I reach out here. From the error message I assume the error is something related to proj.4 not being able to interpret the EPSG code (though this would seem odd for 4326). I have tested this locally on proj.4 versions 4.9.3 and 5.2.0, but I can't reproduce the error I am getting from the CRAN server on either version. Has anyone else encountered something like this? If not, any idea whether I am on the right track?

Thanks,
Alex

--
Alex Zvoleff, PhD
Senior Director, Resilience Science
Betty and Gordon Moore Center for Science
Conservation International
2011 Crystal Dr. Suite 500, Arlington, Virginia 22202, USA
Tel: +1-703-341-2749, Skype: azvoleff, http://www.conservation.org<http://www.conservation.org/>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 14620 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20190426/2b209b44/attachment.bin>
#
On Fri, 26 Apr 2019, Alex Zvoleff via R-sig-Geo wrote:

            
"EPSG" must be "epsg"; after making two such changes, I see:

* checking examples ... OK
* checking for unstated dependencies in ?tests? ... OK
* checking tests ...
   Running ?test-all.R?
  ERROR
Running the tests in ?tests/test-all.R? failed.
Last 13 lines of output:
          crs = crs, ...)
   12: raster(xmn = x at xmin, xmx = x at xmax, ymn = x at ymin, ymx = x at ymax, ncols 
= ncols, nrows = nrows,
          crs = crs, ...)
   13: .local(...)
   14: CRS(as.character(projection(crs)))
   15: stop(res[[2]])

   ?? testthat results 
???????????????????????????????????????????????????????????
   OK: 1 SKIPPED: 0 WARNINGS: 0 FAILED: 3
   1. Error: glcm on 3x3 window with 1x1 shift works (@test-glcm.R#21)
   2. Error: glcm on 5x7 window with 2x3 shift works (@test-glcm.R#48)
   3. Error: (unknown) (@test-glcm.R#113)

   Error: testthat unit tests failed
   Execution halted

but myself never use testthat because it always hides the actual errors. 
Your use of roxygen may well also be concealing verbatim "EPSG", which may 
be in the stored data objects in glcm/data:
CRS arguments: +init=EPSG:4326

So a leftover from the previously tolerated use of "EPSG" for "epsg", I 
think.

crs(test_raster) <- "+init=epsg:4326"
save(test_raster, file="test_raster.RData")

gives:

* checking examples ... OK
* checking for unstated dependencies in ?tests? ... OK
* checking tests ...
   Running ?test-all.R?
  OK

Roger

  
    
#
Yep, that looks like it. I've fixed the example CRS strings and the CRS of the stored data and will upload the new version. Thank you for the quick response and help in fixing this!