prioritizr / wdpar

Interface to the World Database on Protected Areas
https://prioritizr.github.io/wdpar
GNU General Public License v3.0
37 stars 5 forks source link

upcoming sf breaks wdpar #51

Closed edzer closed 2 years ago

edzer commented 2 years ago

Hi Jeffrey, this happens here:

Package: wdpar
Check: tests
New result: ERROR
    Running ‘testthat.R’ [2s/2s]
  Running the tests in ‘tests/testthat.R’ failed.
  Complete output:
    > # load packages
    > library(testthat)
    > library(wdpar)
    Loading required package: sf
    Linking to GEOS 3.10.3, GDAL 3.5.0, PROJ 9.0.1; sf_use_s2() is TRUE
    > 
    > # enable parallel testing
    > Sys.unsetenv("R_TESTS")
    > 
    > # run tests
    > test_check("wdpar")
    [ FAIL 1 | WARN 0 | SKIP 27 | PASS 19 ]

    ══ Skipped tests ═══════════════════════════════════════════════════════════════
    • On CRAN (27)

    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Failure (test_wdpa_dissolve.R:20:3): works ──────────────────────────────────
    `y` not equal to `y2`.
    Component "geometry": Component 1: Component 1: Mean relative difference: 0.9538462

    [ FAIL 1 | WARN 0 | SKIP 27 | PASS 19 ]
    Error: Test failures
    Execution halted

It seems the polygon is identical, but ordered differently; this may be caused by an update in GEOS. You could use st_equals() as an alternative to check for geometrical equality.

jeffreyhanson commented 2 years ago

Hi @edzer,

Thank you very much for bringing this to my attention! I'll work on submitting an update to CRAN to address this. Just so that I'm aware of the timelines, when were you planning on submitting the sf update to CRAN?

jeffreyhanson commented 2 years ago

Sorry, I just wanted to ask if this issue is a possible duplicate of #50? I installed the latest version of sf from the GitHub repo, and the test passes on my computer (see below for spatial and session info). So my guess would be that this issue is related to an update to the GEOS library? In #50, the fix involves using st_equals() like you suggest. Sorry if I'm missing something obvious.


Linking to GEOS 3.9.0, GDAL 3.2.2, PROJ 7.2.1; sf_use_s2() is TRUE
R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 21.10

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] wdpar_1.3.2.3  sf_1.0-8       testthat_3.1.4 devtools_2.4.3 usethis_2.1.6 

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.8.3       countrycode_1.4.0  lattice_0.20-45    binman_0.1.2      
 [5] prettyunits_1.1.1  class_7.3-20       ps_1.7.1           assertthat_0.2.1  
 [9] rprojroot_2.0.3    utf8_1.2.2         R6_2.5.1           e1071_1.7-11      
[13] httr_1.4.3         pillar_1.7.0       rlang_1.0.3        progress_1.2.2    
[17] curl_4.3.2         rstudioapi_0.13    callr_3.7.0        desc_1.4.1        
[21] RSelenium_1.7.7    wdman_0.2.5        proxy_0.4-27       pingr_2.0.1       
[25] compiler_4.1.3     pkgconfig_2.0.3    askpass_1.1        pkgbuild_1.3.1    
[29] openssl_2.0.2      tidyselect_1.1.2   tibble_3.1.7       XML_3.99-0.10     
[33] fansi_1.0.3        crayon_1.5.1       dplyr_1.0.9        withr_2.5.0       
[37] rappdirs_0.3.3     bitops_1.0-7       brio_1.1.3         grid_4.1.3        
[41] lwgeom_0.2-8       lifecycle_1.0.1    DBI_1.1.3          magrittr_2.0.3    
[45] semver_0.2.0       units_0.8-0        KernSmooth_2.23-20 cli_3.3.0         
[49] cachem_1.0.6       fs_1.5.2           remotes_2.4.2      sp_1.5-0          
[53] xml2_1.3.3         ellipsis_0.3.2     generics_0.1.2     vctrs_0.4.1       
[57] tools_4.1.3        glue_1.6.2         purrr_0.3.4        hms_1.1.1         
[61] processx_3.6.1     pkgload_1.3.0      fastmap_1.1.0      caTools_1.18.2    
[65] sessioninfo_1.2.2  classInt_0.4-7     memoise_2.0.1    
edzer commented 2 years ago

Yes, that should fix it! Timeline: I'm in the submission process, so if things run smooth a couple of days.

jeffreyhanson commented 2 years ago

Ok great - I'll submit the updated version of wdpar to CRAN tomorrow.

jeffreyhanson commented 2 years ago

Just to let you know, I submitted the update yesterday and received notification that it's on it's way to CRAN.

edzer commented 2 years ago

Thanks!