ericpante / marmap

Import, plot and analyze bathymetric and topographic data
32 stars 7 forks source link

The NOAA server cannot be reached #16

Closed cecilieha closed 3 years ago

cecilieha commented 4 years ago

I've recently run into this error message: 'The NOAA server cannot be reached', when running the a bit of the code that has been working before:

Nordic.map=getNOAA.bathy(-25,70,59,85,res=5,keep=F)

Has the server perhaps been moved again? Thanks for a great package!!

besibo commented 4 years ago

Please, see https://github.com/ericpante/marmap/issues/12 or https://github.com/ericpante/marmap/issues/14. I would also recommend setting keep to TRUE, so that you won't have to re-download bathymetric data you've downloaded before.

marmigues commented 4 years ago

Hi Benoit, Being #16 the most recent open issue. Got the following error message while using getNOAA.bathy:

Error in .local(.Object, ...) : An error occurred while creating a virtual connection to the DAP server: gnutls_handshake() failed: Handshake failed

Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument has length 0

Already saw #12 and #14. Working with R-3.6.3 in linux. Reinstalled from CRAN: rgdal (now 1.5-16), raster (3.3-13) and marmap (1.0.4). Will appreciate any help.

Thanks in advance.

besibo commented 4 years ago

@marmigues Hi. What's the command generating this error? The command Nordic.map=getNOAA.bathy(-25,70,59,85,res=5,keep=F) suggested above by @cecilieha produces the expected output and no error on my side, with the same versions of marmap, rgdal and raster (see capture below), but R-4.0.2 (although marmap 1.0.4 is compatible with older versions of R).

I Googled your error message: Error in .local(.Object, ...) : An error occurred while creating a virtual connection to the DAP server: gnutls_handshake() failed: Handshake failed

It seems to be GDAL related but I can't reproduce it on my machine. If you send me a minimal reproducible example, I might be able to help, but for now, I'm sorry but I think your issue is not caused by marmap but by some weird bug in GDAL on your Linux OS.

Best, Benoit

SessionInfoMarmap
marmigues commented 4 years ago

Thanks for your reply, I get the error with any query to getNOAA.bathy. Here's an example: image So, if this is an OS TSL/SSL related issue, I will not be able to dig into it for a while as I've found a bathy object that I can use with (handy function) subsetBathy for the area of interest. Will keep you posted. Miguel

robertlennox commented 3 years ago

Similar error for me when I try to run this code.. I have updated rgdal, sp, and raster and reinstalled marmap several times trying to get it to work

Nordic.map=getNOAA.bathy(-25,70,59,85,res=5,keep=F) Querying NOAA database ... This may take seconds to minutes, depending on grid size **Error in .local(.Object, ...) : schannel: next InitializeSecurityContext failed: Unknown error (0x80092012) - The revocation function was unable to check revocation for the certificate.

Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero**

besibo commented 3 years ago

Still no problem on my side with marmap 1.0.5.

I still haven't been able to reproduce this behaviour and since the compilation on cran servers (including the execution of examples) does not produce any error (see here), I still think this is not a marmap-related problem. If you can give us more details about your config, maybe we'll find some similarities with @marmigues?

library(marmap)
#> Registered S3 methods overwritten by 'adehabitatMA':
#>   method                       from
#>   print.SpatialPixelsDataFrame sp  
#>   print.SpatialPixels          sp
#> 
#> Attachement du package : 'marmap'
#> The following object is masked from 'package:grDevices':
#> 
#>     as.raster

Nordic.map <- getNOAA.bathy(-25, 70, 59, 85, res = 5, keep = FALSE)
#> Querying NOAA database ...
#> This may take seconds to minutes, depending on grid size
#> Building bathy matrix ...

summary(Nordic.map)
#> Bathymetric data of class 'bathy', with 1140 rows and 312 columns
#> Latitudinal range: 59 to 85 (59 N to 85 N)
#> Longitudinal range: -25 to 70 (25 W to 70 E)
#> Cell size: 5 minute(s)
#> 
#> Depth statistics:
#>    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
#> -5519.0 -1641.0  -218.0  -843.6    46.0  1992.0
#> 
#> First 5 columns and rows of the bathymetric matrix:
#>                      59 59.0836012861736 59.1672025723473 59.2508038585209
#> -25               -2502            -2349            -2407            -2638
#> -24.9165935030729 -2517            -2348            -2427            -2625
#> -24.8331870061457 -2600            -2378            -2506            -2646
#> -24.7497805092186 -2629            -2385            -2511            -2665
#> -24.6663740122915 -2676            -2421            -2498            -2675
#>                   59.3344051446945
#> -25                          -2532
#> -24.9165935030729            -2518
#> -24.8331870061457            -2547
#> -24.7497805092186            -2542
#> -24.6663740122915            -2513

sessionInfo()
#> R version 4.0.3 (2020-10-10)
#> Platform: x86_64-apple-darwin17.0 (64-bit)
#> Running under: macOS Big Sur 10.16
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
#> 
#> locale:
#> [1] fr_FR.UTF-8/en_US.UTF-8/fr_FR.UTF-8/C/fr_FR.UTF-8/fr_FR.UTF-8
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] marmap_1.0.5
#> 
#> loaded via a namespace (and not attached):
#>  [1] styler_1.3.2        shape_1.4.5         tidyselect_1.1.0   
#>  [4] xfun_0.19           adehabitatMA_0.3.14 purrr_0.3.4        
#>  [7] reshape2_1.4.4      lattice_0.20-41     colorspace_2.0-0   
#> [10] vctrs_0.3.5         generics_0.1.0      htmltools_0.5.0    
#> [13] yaml_2.2.1          blob_1.2.1          rlang_0.4.9        
#> [16] R.oo_1.24.0         pillar_1.4.7        glue_1.4.2         
#> [19] DBI_1.1.0           R.utils_2.10.1      sp_1.4-4           
#> [22] bit64_4.0.5         R.cache_0.14.0      lifecycle_0.2.0    
#> [25] plyr_1.8.6          stringr_1.4.0       munsell_0.5.0      
#> [28] gtable_0.3.0        raster_3.4-5        R.methodsS3_1.8.1  
#> [31] codetools_0.2-18    evaluate_0.14       memoise_1.1.0      
#> [34] knitr_1.30          highr_0.8           Rcpp_1.0.5         
#> [37] scales_1.1.1        backports_1.2.0     fs_1.5.0           
#> [40] bit_4.0.4           ggplot2_3.3.2       digest_0.6.27      
#> [43] stringi_1.5.3       dplyr_1.0.2         ncdf4_1.17         
#> [46] grid_4.0.3          rgdal_1.5-19        tools_4.0.3        
#> [49] magrittr_2.0.1      tibble_3.0.4        RSQLite_2.2.1      
#> [52] crayon_1.3.4        pkgconfig_2.0.3     ellipsis_0.3.1     
#> [55] reprex_0.3.0.9001   rmarkdown_2.5       rstudioapi_0.13    
#> [58] R6_2.5.0            compiler_4.0.3
robertlennox commented 3 years ago

Thanks for the quick response.. really struggling to figure this out.. sessionInfo here

`R version 4.0.3 (2020-10-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=Norwegian Bokmål_Norway.1252 [2] LC_CTYPE=Norwegian Bokmål_Norway.1252
[3] LC_MONETARY=Norwegian Bokmål_Norway.1252 [4] LC_NUMERIC=C
[5] LC_TIME=Norwegian Bokmål_Norway.1252

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

other attached packages: [1] ncdf4_1.17 marmap_1.0.5 forcats_0.5.0
[4] stringr_1.4.0 dplyr_1.0.2 purrr_0.3.4
[7] readr_1.4.0 tidyr_1.1.2 tibble_3.0.4
[10] ggplot2_3.3.2 tidyverse_1.3.0 rgdal_1.5-18
[13] SiMRiv_1.0.4 raster_3.4-5 sp_1.4-4

loaded via a namespace (and not attached): [1] lunar_0.1-04 httr_1.4.2
[3] bit64_4.0.5 jsonlite_1.7.1
[5] splines_4.0.3 modelr_0.1.8
[7] assertthat_0.2.1 blob_1.2.1
[9] cellranger_1.1.0 pillar_1.4.7
[11] RSQLite_2.2.1 backports_1.1.10
[13] lattice_0.20-41 glue_1.4.2
[15] digest_0.6.27 rvest_0.3.6
[17] colorspace_1.4-1 Matrix_1.2-18
[19] plyr_1.8.6 pkgconfig_2.0.3
[21] broom_0.7.3 haven_2.3.1
[23] scales_1.1.1 mco_1.15.6
[25] mgcv_1.8-33 generics_0.1.0
[27] ellipsis_0.3.1 withr_2.3.0
[29] cli_2.2.0 magrittr_2.0.1
[31] crayon_1.3.4 readxl_1.3.1
[33] memoise_1.1.0 adehabitatMA_0.3.14 [35] fs_1.5.0 fansi_0.4.1
[37] nlme_3.1-149 xml2_1.3.2
[39] class_7.3-17 tools_4.0.3
[41] hms_0.5.3 lifecycle_0.2.0
[43] munsell_0.5.0 reprex_0.3.0
[45] compiler_4.0.3 e1071_1.7-4
[47] tinytex_0.28 rlang_0.4.8
[49] classInt_0.4-3 units_0.6-7
[51] grid_4.0.3 rstudioapi_0.13
[53] gtable_0.3.0 codetools_0.2-18
[55] DBI_1.1.0 reshape2_1.4.4
[57] R6_2.5.0 lubridate_1.7.9
[59] bit_4.0.4 shape_1.4.5
[61] KernSmooth_2.23-17 stringi_1.5.3
[63] parallel_4.0.3 Rcpp_1.0.5
[65] vctrs_0.3.4 sf_0.9-6
[67] dbplyr_2.0.0 tidyselect_1.1.0
[69] xfun_0.19

`

dankelley commented 3 years ago

I'm finding failure today. I think this is new as of the past few days.

> library(marmap)
> b <- getNOAA.bathy(-63,-62,43,43.5)
Querying NOAA database ...
This may take seconds to minutes, depending on grid size
Error in .local(.Object, ...) : 
  An error occurred while creating a virtual connection to the DAP server:Error while reading the URL: https://gis.ngdc.noaa.gov/arcgis/rest/services/DEM_mosaics/ETOPO1_bedrock/ImageServer/exportImage.ver.
The OPeNDAP server returned the following message:
Not Found: The data source or server could not be found.
        Often this means that the OPeNDAP server is missing or needs attention.
        Please contact the server administrator.

Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : 
  argument is of length zero
besibo commented 3 years ago

Found on NOAA's website:

2021-01-20: Due to scheduled system maintenance, ngdc.noaa.gov services will be unavailable from
Wednesday 2021-01-20 16:00 MT until Friday 2021-01-22 12:00 MT.

Things should be back to normal soon.

dankelley commented 3 years ago

Thanks so much!!

McAllister-NOAA commented 3 years ago

Did the server maintenance end? I am still getting an error similar to above on code that had been working.

Querying NOAA database ...
This may take seconds to minutes, depending on grid size
argument is of length zeroError in get(name, envir = asNamespace(pkg), inherits = FALSE) : 
  object 'repel_boxes' not found
besibo commented 3 years ago

Apparently, NOAA has modified its servers architecture. The way marmap used to download bathymetric data no longer works. I'm currently working on a workaround and will be uploading a new version of the package here and on Cran ASAP.

dankelley commented 3 years ago

In case it's of any interest, the download.topo() file of the oce package (at github.com/dankelley/oce) still works. So, at least, the NOAA server is still working as oce calls it. Here is a sample query made by that code (a long line, will require scrolling this text box):

https://gis.ngdc.noaa.gov/arcgis/rest/services/DEM_mosaics/ETOPO1_bedrock/ImageServer/exportImage?bbox=-64,42.99,-59.99,47.01&bboxSR=4326&size=240,241&imageSR=4326&format=tiff&pixelType=S16&interpolation=+RSP_NearestNeighbor&compression=LZW&f=image
besibo commented 3 years ago

Thank's @dankelley. NOAA's grid extractor has evolved a few months ago but the old system still worked until last week. This old system is now (permanenty) offline and the only way to get bathymetric data is by downloading a geoTIFF file. This is not a problem but getNOOA.bathy() has to be modified so that the new url is used and the geoTIFF downloaded is transformed as a bathy object.

If you want to do that manually, you can for instance do the following:

dat <- raster::rater(x = "https://gis.ngdc.noaa.gov/arcgis/rest/services/DEM_mosaics/ETOPO1_bedrock/ImageServer/exportImage?bbox=-64,42.99,-59.99,47.01&bboxSR=4326&size=240,241&imageSR=4326&format=tiff&pixelType=S16&interpolation=+RSP_NearestNeighbor&compression=LZW&f=image")
clean_bathy <- marmap::as.bathy(dat)

You can find the appropriate url for the area you need here. After selecting a dataset and the area of interest, simply right-click on the "download data" button and copy/paste the link in the raster function as shown above.

I'll update getNOAA.bathy() ASAP but I won't have time to do it today. I'll get back to you here as soon as its done.

dankelley commented 3 years ago

Excellent. No rush on my part, since I tend to use oce::download.topo() in most of my work. Of course, there a lot of marmap users out there who will be very pleased with your plan. Thanks!!

besibo commented 3 years ago

@dankelley Could you please try to re-run the code that was problematic:

library(marmap)
b <- getNOAA.bathy(-63,-62,43,43.5)

Same question for you @McAllister-NOAA. Do you still get error messages?

It is now working as expected on my side with marmap 1.0.5. I don't know what was causing the problem previously: after looking closely at the getNOAA.bathy code, the url used to query NOAA's servers was good all along...

Anyway, if it's working for both of you, I'll close the issue.

dankelley commented 3 years ago

That works for me, with marmap 1.0.5. Thanks.

McAllister-NOAA commented 3 years ago

I was using marmap 1.0.5 before, so it hasn't really changed. But the bug happened when I upgraded to the new Rstudio, so maybe something somewhere else in my installations has messed it up. This is the error I get when using your simplified test code:

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

Attaching package: ‘marmap’

The following object is masked from ‘package:grDevices’:

    as.raster

> b <- getNOAA.bathy(-63,-62,43,43.5)
Querying NOAA database ...
This may take seconds to minutes, depending on grid size
Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : 
  argument is of length zero

I'm using RStudio 1.4.1103 (R version 4.0.3 (2020-10-10); Bunny-Wunnies Freak Out)

besibo commented 3 years ago

@McAllister-NOAA Hum🤔. It has to be something else then. Have you tried updating the rgdal and raster packages as well? And is the problem still the same with the following?

marmap::getNOAA.bathy(-63, -62, 43, 43.5, resolution = 1)
McAllister-NOAA commented 3 years ago

Ok, the issue was the rgdal installation. It is functioning properly now. Thanks!

donojazz commented 1 year ago

I am trying to run your sample code from the R Documentation help "Import bathymetric data from the NOAA server." I have refreshed all the dependent libraries and nothing changed.

This is the error code I get: "Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero"

Assistance is appreciated. JD

besibo commented 1 year ago

@donojazz what command are you typing? Could you please post your sessionInfo()?

donojazz commented 1 year ago

I'll have to try it tomorrow. The code is right from your sample code from the R Documentation. Does that run on your system?

besibo commented 1 year ago

If you're talking about this code

getNOAA.bathy(lon1=-20,lon2=-90,lat1=50,lat2=20, resolution=10) -> a
plot(a, image=TRUE, deep=-6000, shallow=0, step=1000)

Then yes, no problem on my side. But please install the latest marmap version from github with remotes::install_github("ericpante/marmap"). It fixes a bug in getNOAA.bathy() that was introduced when we switched from the now deprecated ETOPO1 database to the new ETOPO 2022 database a few days ago.

marmap v-1.0.8 should be available on CRAN in the next few days.`

donojazz commented 1 year ago

Still will not run. Here is the session info:

sessionInfo() R version 4.2.1 (2022-06-23 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

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

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

other attached packages: [1] sessioninfo_1.2.2 ggnewscale_0.4.8 tidyterra_0.3.0 marmap_1.0.7 forcats_0.5.2 stringr_1.4.1
[7] dplyr_1.0.10 purrr_0.3.5 readr_2.1.3 tidyr_1.2.1 tibble_3.1.8 ggplot2_3.3.6
[13] tidyverse_1.3.2

loaded via a namespace (and not attached): [1] fs_1.5.2 sf_1.0-8 lubridate_1.8.0 bit64_4.0.5 RColorBrewer_1.1-3 [6] httr_1.4.4 rprojroot_2.0.3 tools_4.2.1 backports_1.4.1 utf8_1.2.2
[11] R6_2.5.1 KernSmooth_2.23-20 DBI_1.1.3 colorspace_2.0-3 raster_3.6-3
[16] withr_2.5.0 sp_1.5-0 tidyselect_1.2.0 bit_4.0.4 curl_4.3.2
[21] compiler_4.2.1 cli_3.4.0 rvest_1.0.3 xml2_1.3.3 scales_1.2.1
[26] classInt_0.4-7 proxy_0.4-27 digest_0.6.29 foreign_0.8-82 pkgconfig_2.0.3
[31] dbplyr_2.2.1 fastmap_1.1.0 rlang_1.0.6 readxl_1.4.1 rstudioapi_0.14
[36] RSQLite_2.2.18 shape_1.4.6 generics_0.1.3 adehabitatMA_0.3.15 jsonlite_1.8.3
[41] googlesheets4_1.0.1 magrittr_2.0.3 gdistance_1.6 Matrix_1.4-1 Rcpp_1.0.9
[46] munsell_0.5.0 fansi_1.0.3 lifecycle_1.0.3 terra_1.6-17 stringi_1.7.8
[51] plyr_1.8.7 grid_4.2.1 blob_1.2.3 crayon_1.5.2 lattice_0.20-45
[56] haven_2.5.1 hms_1.1.2 pillar_1.8.1 igraph_1.3.5 reshape2_1.4.4
[61] codetools_0.2-18 reprex_2.0.2 glue_1.6.2 data.table_1.14.2 modelr_0.1.9
[66] vctrs_0.4.1 tzdb_0.3.0 cellranger_1.1.0 gtable_0.3.1 assertthat_0.2.1
[71] cachem_1.0.6 broom_1.0.1 e1071_1.7-11 class_7.3-20 ncdf4_1.19
[76] googledrive_2.0.0 gargle_1.2.1 memoise_2.0.1 units_0.8-0 ellipsis_0.3.2
[81] here_1.0.1

donojazz commented 1 year ago

This is what I am running from R Documentation:

you must have an internet connection. This line queries the NOAA ETOPO 2022 database

for data from North Atlantic, for a resolution of 10 minutes.

getNOAA.bathy(lon1=-20,lon2=-90,lat1=50,lat2=20, resolution=10) -> a plot(a, image=TRUE, deep=-6000, shallow=0, step=1000)

download speed for a matrix of 10 degrees x 10 degrees x 30 minutes

system.time(getNOAA.bathy(lon1=0,lon2=10,lat1=0,lat2=10, resolution=30))

ERROR MESSAGE:

Querying NOAA database ... This may take seconds to minutes, depending on grid size Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero

besibo commented 1 year ago

I don't know what's going on but the problem must comes from your config: it's working just fine on my side and on the CRAN servers.

You should try to uninstall/reinstall R/RStudio and your packages. And you should also switch to the lastest version of marmap (v 1.0.8, see my previous message). This version is currently being deployed on CRAN servers but is not yet available there. It should be there tomorrow or the day after tomorrow at the latest though. If you're in a hurry, install it directly from github.

Please, keep me posted!

Guillefriis commented 1 year ago

I'm having similar issues, with all packages updated, including the marmap v 1.0.8

mang.map <- getNOAA.bathy(lon1 = long.min, lon2 = long.max,

  • lat1 = lat.min, lat2 = lat.max, resolution = 2) Querying NOAA database ... This may take seconds to minutes, depending on grid size Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero
Guillefriis commented 1 year ago

Also working under Ubuntu and with different internet connection:

mang.map <- getNOAA.bathy(lon1 = long.min, lon2 = long.max, lat1 = lat.min, lat2 = lat.max, resolution = 2)

Querying NOAA database ... This may take seconds to minutes, depending on grid size Error in .local(.Object, ...) : An error occurred while creating a virtual connection to the DAP server: Error while reading the URL: https://gis.ngdc.noaa.gov/arcgis/rest/services/DEM_mosaics/DEM_all/ImageServer/exportImage.ver. The OPeNDAP server returned the following message: Bad Request:

Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero

sessionInfo() R version 3.6.2 (2019-12-12) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.6 LTS

Matrix products: default BLAS: /usr/lib/libblas/libblas.so.3.6.0 LAPACK: /usr/lib/lapack/liblapack.so.3.6.0

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C 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 LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] marmap_1.0.8

loaded via a namespace (and not attached): [1] Rcpp_1.0.6 pillar_1.6.0 compiler_3.6.2 plyr_1.8.6 tools_3.6.2 bit_4.0.4
[7] ncdf4_1.17 memoise_2.0.0 RSQLite_2.2.7 lifecycle_1.0.0 tibble_3.1.1 gtable_0.3.0
[13] gdistance_1.3-6 lattice_0.20-44 pkgconfig_2.0.3 rlang_0.4.11 Matrix_1.2-18 igraph_1.2.6
[19] DBI_1.1.1 rgdal_1.6-2 fastmap_1.1.0 dplyr_1.0.5 stringr_1.4.0 raster_3.4-10
[25] generics_0.1.0 vctrs_0.3.8 bit64_4.0.5 grid_3.6.2 tidyselect_1.1.1 glue_1.4.2
[31] R6_2.5.0 fansi_0.4.2 sp_1.5-1 adehabitatMA_0.3.14 blob_1.2.1 ggplot2_3.3.3
[37] purrr_0.3.4 reshape2_1.4.4 magrittr_2.0.1 scales_1.1.1 codetools_0.2-16 ellipsis_0.3.2
[43] assertthat_0.2.1 shape_1.4.5 colorspace_2.0-1 utf8_1.2.1 stringi_1.5.3 munsell_0.5.0
[49] cachem_1.0.4 crayon_1.4.1

besibo commented 1 year ago

The same error message can have various causes, depending on your local config. For instance, the raster package has been causing problems in the past. You have raster_3.4-10, which is not the latest version (the latest stable version is 3.6-3). You should also try to upgrade to a new version of R. The one you're using today is almost 3 years old, and many things have changed in R in the last year.

If this still doesn't work, you should consider starting with a fresh install of R and of all packages. Start by installing R/RStudio in their latest versions, then install marmap (by default, it should install all of its dependencies). And try to use getNOAA.bathy() again. Then, install other packages you might need, one at a time and see if marmap still works.

Again, I cannot solve a problem I can't reproduce. And the problem does not seem to come from the marmap package since:

Guillefriis commented 1 year ago

Still doesn't work.

Since it's working for you, can I ask you to run map.mang <- getNOAA.bathy(26, 158, -40, 40, resolution = 4) for me and send me the .Rdata file? Weird to ask I guess but it's worth a citation :) Thanks!

sessionInfo() R version 4.2.2 (2022-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

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

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

other attached packages: [1] marmap_1.0.8

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 pillar_1.8.1 compiler_4.2.2 plyr_1.8.8 tools_4.2.2
[6] ncdf4_1.19 bit_4.0.4 RSQLite_2.2.18 memoise_2.0.1 lifecycle_1.0.3
[11] tibble_3.1.8 gtable_0.3.1 gdistance_1.6 lattice_0.20-45 pkgconfig_2.0.3
[16] rlang_1.0.6 Matrix_1.5-1 igraph_1.3.5 DBI_1.1.3 cli_3.4.1
[21] fastmap_1.1.0 terra_1.6-17 stringr_1.4.1 raster_3.6-3 vctrs_0.5.0
[26] bit64_4.0.5 grid_4.2.2 glue_1.6.2 R6_2.5.1 fansi_1.0.3
[31] sp_1.5-1 adehabitatMA_0.3.15 ggplot2_3.4.0 reshape2_1.4.4 blob_1.2.3
[36] magrittr_2.0.3 scales_1.2.1 codetools_0.2-18 shape_1.4.6 colorspace_2.0-3
[41] utf8_1.2.2 stringi_1.7.8 munsell_0.5.0 cachem_1.0.6

map.mang <- getNOAA.bathy(26, 158, -40, 40, resolution = 4) Querying NOAA database ... This may take seconds to minutes, depending on grid size Error in if (ncol(x) == 3 & !exists("bathy", inherits = FALSE)) { : argument is of length zero

besibo commented 1 year ago

Hum... very weird...

Anyway, here is the file you requested. Be aware that you can always download bathymetry data directly from NOAA's website as geotiff files (grid extractor here). You can then import and manipulate these files in R with:

dat_ras <- raster::raster(x = "path/to/my/myfile.tiff")
bathy <- marmap::as.bathy(dat_ras)

map.mang.Rdata.zip

fishfeed8 commented 1 year ago

Hum... very weird...

Anyway, here is the file you requested. Be aware that you can always download bathymetry data directly from NOAA's website as geotiff files (grid extractor here). You can then import and manipulate these files in R with:

dat_ras <- raster::raster(x = "path/to/my/myfile.tiff")
bathy <- marmap::as.bathy(dat_ras)

map.mang.Rdata.zip

I am also having the same error problem and have the newest version of r and all 3 packages. Which dataset from the NOAA website you have linked is the same as the getNOAA function? I am trying to plot contour bathymetry lines using the following command: bat <- getNOAA.bathy(lat1 = -27, lat2 = -40, lon1 = 13, lon2 = 30, resolution = 1, keep = T) Thanks!

besibo commented 1 year ago

I'm sorry but I can't download and post here datasets for all marmap users! As stated above, marmap::getNOAA.bathy() is just a convenient way to import ETOPO data that you can manually download as geotiff files using the grid extractor from the NOAA website and manually import within R with the raster and marmap packages (see code above). If getNOAA.bathy()

Finally, it seems that reverting to an older version of raster fixes the issue for some users. Take a look at issue #25