dankelley / oce

R package for oceanographic processing
http://dankelley.github.io/oce/
GNU General Public License v3.0
143 stars 42 forks source link

check failure with current rgdal, GDAL 3.0.1 and PROJ 6.2.0 #1604

Closed rsbivand closed 4 years ago

rsbivand commented 5 years ago

I'm seeing a test failure when running check for revdeps for rgdal, but with GDAL 3.0.1 and PROJ 6.2.0. I haven't tried to debug the problem, and do not know whether there is any interaction with these versions.

testthat.Rout.zip

dankelley commented 5 years ago

Thanks, Roger. May I ask a couple of questions, so I can narrow down on the problem by reproducing it locally?

  1. Are you using oce built from the "develop" branch here on github?

  2. I have as below (with R 3.6.0), so obviously this is a lot older version than your setup. Is there a document that will tell me how to install GDAL and RGDAL that will be of the same versions as yours? (I apologize for this question -- I've not been tracking *DAL work lately, because I tend to keep things at the CRAN level, which is where my students will be working.)

> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-4, (SVN revision 833)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
 Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rgdal/gdal
 GDAL binary built with GEOS: FALSE 
 Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
 Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rgdal/proj
 Linking to sp version: 1.3-1 
rsbivand commented 5 years ago
  1. No, CRAN - I run the revdeps semi-automatically, as rgdal has hundreds, so download from CRAN.

  2. rgdal on CRAN, but no user-facing changes from 1.4-4 (only changes to the configure script, there was a logic error exposed when R-devel became 4.0.0).

> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-6, (SVN revision 841)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 3.0.1, released 2019/06/28
 Path to GDAL shared files: /usr/local/share/epsg_csv
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 6.2.0, September 1st, 2019, [PJ_VERSION: 620]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.3-1 

I install PROJ from source, then GDAL from source. CRAN did get Debian PROJ 6.2.0 during an automatic update recently, but their GDAL is I think 2.4.*. In testthat, it is never clear to me where the problem occurred, and I can't see why a change in an external library would affect a plot method, unless maybe projection or transformation is involved.

dankelley commented 5 years ago

@rsbivand I'm making some progress with this. As I think you guessed, the problem you encountered was not really with rgdal; it was that I was not always using requireNamespace() to make oce robust against missing packages. Thanks for the heads-up!!

But I'm also seeing another issue in the oce docs that will crop up when R is updated to 4.x. In some spots of the oce docs, I use the lcc projection, specifying only lon_0 and not lat_1. This used to work, but now it makes an error (see below, which tests for the older R I have on my work machine, and the R-devel I just installed on my home machine). From https://proj.org/operations/projections/lcc.html, I infer that lat_1 is now required. I wonder whether lat_1 was previously defaulting to lat_1=0, as seems to be stated in that webpage? (Actually, regarding that webpage, I don't quite see how a required argument can have a default ... maybe this is a remnant from a previous documentation entry?)

Of course, my procedure will be to add the lat_1 to the oce documentation examples, but I thought you (or someone you know) might like to know about a possible problem that other proj users might have, if they similarly were previously assuming that the lcc projection could work if lat_1 is not supplied.

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"

Platform: x86_64-apple-darwin15.6.0 (64-bit)

> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-4, (SVN revision 833)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.1.3, released 2017/20/01
 Path to GDAL shared files: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rgdal/gdal
 GDAL binary built with GEOS: FALSE 
 Loaded PROJ.4 runtime: Rel. 4.9.3, 15 August 2016, [PJ_VERSION: 493]
 Path to PROJ.4 shared files: /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rgdal/proj
 Linking to sp version: 1.3-1 
> rgdal::project(cbind(61,36),proj="+proj=lcc +lat_1=40",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
        [,1]    [,2]
[1,] 5064337 6308587
> rgdal::project(cbind(61,36),proj="+proj=lcc +lat_1=40 +lon_0=100",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
         [,1]    [,2]
[1,] -3411700 5202644
> rgdal::project(cbind(61,36),proj="+proj=lcc +lon_0=100",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
         [,1]    [,2]
[1,] -3395650 5032368

R Under development (unstable) (2019-10-05 r77257) -- "Unsuffered Consequences"

Platform: x86_64-apple-darwin15.6.0 (64-bit)

> library(rgdal)
Loading required package: sp
rgdal: version: 1.4-6, (SVN revision 841)
 Geospatial Data Abstraction Library extensions to R successfully loaded
 Loaded GDAL runtime: GDAL 2.4.2, released 2019/06/28
 Path to GDAL shared files: /usr/local/Cellar/gdal/2.4.2_2/share/gdal
 GDAL binary built with GEOS: TRUE 
 Loaded PROJ.4 runtime: Rel. 6.2.0, September 1st, 2019, [PJ_VERSION: 620]
 Path to PROJ.4 shared files: (autodetected)
 Linking to sp version: 1.3-1 
> rgdal::project(cbind(61,36),proj="+proj=lcc +lat_1=40",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
        [,1]    [,2]
[1,] 5092749 1369609
> rgdal::project(cbind(61,36),proj="+proj=lcc +lat_1=40 +lon_0=100",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
         [,1]     [,2]
[1,] -3413385 314536.2
> rgdal::project(cbind(61,36),proj="+proj=lcc +lon_0=100",
+                inv=FALSE, legacy=TRUE, allowNAs_if_not_legacy=TRUE)
Error in rgdal::project(cbind(61, 36), proj = "+proj=lcc +lon_0=100",  : 
  conic lat_1 = -lat_2
Execution halted
dankelley commented 4 years ago

An update on r-sig-geo --

Message: 1 Date: Wed, 18 Mar 2020 14:12:11 +0100 From: Roger Bivand Roger.Bivand@nhh.no To: r-sig-geo@r-project.org Subject: [R-sig-Geo] R spatial follows GDAL and PROJ development Message-ID: alpine.LFD.2.21.2003181410290.2563188@reclus.nhh.no Content-Type: text/plain; charset="us-ascii"; Format="flowed"

A new blog: "R spatial follows GDAL and PROJ development" has been published: https://www.r-spatial.org/r/2020/03/17/wkt.html.

Those maintaining packages using sf or sp/rgdal, and authors of scripts using them should read the blog and be prepared to take rapid action when sf 0.9 is released and built using PROJ >= 6 and GDAL >= 3. An early release of rgdal (>= 1.5, probably 1.6.0, is also to be expected).

Roger

-- Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: Roger.Bivand@nhh.no https://orcid.org/0000-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en

dankelley commented 4 years ago

See https://stat.ethz.ch/pipermail/r-sig-mac/2020-June/013599.html for a way to get a prebuilt rgdal with a newer underlying gdal library.

dankelley commented 4 years ago

As a followup on my https://github.com/dankelley/oce/issues/1604#issuecomment-643602470 regarding the newly-provided updates to rgal and sf, I installed rgdal (1.5-11) and sf (0.9-3) with

options(repos="https://www.stats.ox.ac.uk/pub/RWin")
install.packages('rgdal', type = 'binary')
install.packages('sf', type = 'binary')

and found that oce builds and checks with no NOTEs (apart from file size), WARNINGs or ERRORs.

rsbivand commented 4 years ago

@dankelley Thanks! Could you please confirm that this was with 10.15 Catalina?

dankelley commented 4 years ago

Yes, it is the "develop" branch of oce, tested on macOS Catalina Version 10.15.6 Beta (19G49c).

dankelley commented 4 years ago

I've lost track of this, but I think it's been fixed for months now (see below -- the startup from a session that worked without difficulties) so I'm closing the issue

> library(oce)
Loading required package: gsw
Loading required package: testthat
Loading required package: sf
Linking to GEOS 3.8.1, GDAL 3.1.1, PROJ 6.3.1
rsbivand commented 4 years ago

Thanks, oce passing for me with current sp, sf and raster, development rgdal (submitted to CRAN), and PROJ 7.1.0 and GDAL 3.1.2.