ericpante/marmap

getNOAA.bathy() returning an error

Closed this issue · 6 comments

I started having some issues with the latest version of marmap and getNOAA.bathy(). I ran the example getNOAA.bathy code and it's returning an error that I see in my own codes.

getNOAA.bathy(lon1=-20,lon2=-90,lat1=50,lat2=20, resolution=10)
Querying NOAA database ...
This may take seconds to minutes, depending on grid size
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'as.matrix': could not find symbol "values" in environment of the generic function

It seems to be working as expected on both my machine and on all sorts of configs on CRAN servers. The marmap "results page" on CRAN doesn't show any error/warning/message or note. So I suspect a dependency problem on your end. Have you tried updating rgdal and raster to their latest versions?

Yes I have the latest versions of rgdal and raster, but still getting the same error. Here's my session info

getNOAA.bathy(lon1=-20,lon2=-90,lat1=50,lat2=20, resolution=10)
Querying NOAA database ...
This may take seconds to minutes, depending on grid size
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'x' in selecting a method for function 'as.matrix': could not find symbol "values" in environment of the generic function

sessionInfo()
R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

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

other attached packages:
[1] rgdal_1.5-27 raster_3.5-2 sp_1.4-5 marmap_1.0.6

loaded via a namespace (and not attached):
[1] Rcpp_1.0.7 pillar_1.6.2 compiler_4.1.1 plyr_1.8.6 tools_4.1.1
[6] bit_4.0.4 ncdf4_1.17 memoise_2.0.0 RSQLite_2.2.8 lifecycle_1.0.0
[11] tibble_3.1.4 gtable_0.3.0 lattice_0.20-44 pkgconfig_2.0.3 rlang_0.4.11
[16] DBI_1.1.1 fastmap_1.1.0 terra_1.4-9 dplyr_1.0.7 stringr_1.4.0
[21] generics_0.1.0 vctrs_0.3.8 bit64_4.0.5 grid_4.1.1 tidyselect_1.1.1
[26] glue_1.4.2 R6_2.5.1 fansi_0.5.0 adehabitatMA_0.3.14 blob_1.2.2
[31] ggplot2_3.3.5 purrr_0.3.4 reshape2_1.4.4 magrittr_2.0.1 scales_1.1.1
[36] codetools_0.2-18 ellipsis_0.3.2 assertthat_0.2.1 shape_1.4.6 colorspace_2.0-2
[41] utf8_1.2.2 stringi_1.7.4 munsell_0.5.0 cachem_1.0.6 crayon_1.4.1

Are there any other dependency packages I should update?

I've been doing some testing on a windows machine but was unable to reproduce your bug. In fact, everything went as is it is supposed to. The config of the tested machine was very close to yours so I have no idea of why you get this error. I would suggest a full reinstall of R/RStudio, but without any guarantee that it will work.

Could you please keep me posted if you manage to solve this?

 library(marmap)
Registered S3 methods overwritten by 'adehabitatMA':
  method                       from
  print.SpatialPixelsDataFrame sp  
  print.SpatialPixels          sp  

Attachement du package : ‘marmap’

L'objet suivant est masqué depuis ‘package:grDevices’:

    as.raster

> 
> a <- getNOAA.bathy(lon=-20, lon2=-90, lat1=50,lat2=20,resolution = 10)
Querying NOAA database ...
This may take seconds to minutes, depending on grid size
Building bathy matrix ...
> 
> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252   
[3] LC_MONETARY=French_France.1252 LC_NUMERIC=C                  
[5] LC_TIME=French_France.1252    

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

other attached packages:
[1] marmap_1.0.6

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.7          pillar_1.6.4        compiler_4.1.0     
 [4] plyr_1.8.6          tools_4.1.0         bit_4.0.4          
 [7] ncdf4_1.17          memoise_2.0.0       RSQLite_2.2.8      
[10] lifecycle_1.0.1     tibble_3.1.5        gtable_0.3.0       
[13] lattice_0.20-44     pkgconfig_2.0.3     rlang_0.4.12       
[16] DBI_1.1.1           rgdal_1.5-27        fastmap_1.1.0      
[19] terra_1.4-11        dplyr_1.0.7         stringr_1.4.0      
[22] raster_3.5-2        generics_0.1.0      vctrs_0.3.8        
[25] bit64_4.0.5         grid_4.1.0          tidyselect_1.1.1   
[28] glue_1.4.2          R6_2.5.0            fansi_0.5.0        
[31] sp_1.4-5            adehabitatMA_0.3.14 blob_1.2.2         
[34] ggplot2_3.3.5       purrr_0.3.4         reshape2_1.4.4     
[37] magrittr_2.0.1      scales_1.1.1        codetools_0.2-18   
[40] ellipsis_0.3.2      assertthat_0.2.1    shape_1.4.6        
[43] colorspace_2.0-2    utf8_1.2.2          stringi_1.7.5      
[46] munsell_0.5.0       cachem_1.0.6        crayon_1.4.1

Yes, will keep you posted.

I re-installed the previous version of raster (3.4-13) and getNOAA.bathy() works now.

Good to know, thanks for the update. I close the issue then.