Closed difontaine closed 11 months ago
I realized that I should have specified what versions I'm using. I re-installed ggOceanMaps from the github install, so I'm using version 2.1.13 and I still don't get the bathymetry. And the R version is 4.2.3.
I also want to add – thank you for creating this package!
Hmm...it works in my system with the same file path without ~
. Are you using Windows? Could it be the ~
in your file path? Try:
file.exists(getOption("ggOceanMaps.userpath"))
Thanks for the quick response! No, I'm using a mac. And it seems like the file exists:
file.exists(getOption("ggOceanMaps.userpath")) [1] TRUE
I did also try restarting R after the new ggOceanMaps github install and that didn't change the output. So strange! Maybe I'll try rebooting everything again just in case? thanks
Strange indeed. I get this:
library(ggOceanMaps)
#> Loading required package: ggplot2
#> ggOceanMaps: Setting data download folder to a temporary folder
#> /var/folders/9v/b70pd53x04d3jjmlrbcgp4_w0000gv/T//Rtmpv925jI. This
#> means that any downloaded map data need to be downloaded again when you
#> restart R. To avoid this problem, change the default path to a
#> permanent folder on your computer. Add following lines to your
#> .Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
#> <- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
#> file. '~/ggOceanMapsLargeData' would make it in a writable folder on
#> most operating systems.
options(ggOceanMaps.userpath = "~/Downloads/gebco_2023/GEBCO_2023.nc")
basemap(limits = c(-80, -60,30, 50), bathy.style = "rub")
Created on 2023-11-30 with reprex v2.0.2
Could you try with reprex just in case you had a typo somewhere?
This is the output with reprex!
library(ggOceanMaps)
#> Loading required package: ggplot2
#> ggOceanMaps: Setting data download folder to a temporary folder
#> /var/folders/hw/3m77_44925j0dvws649y30fm0000gn/T//RtmpnnpLGi. This
#> means that any downloaded map data need to be downloaded again when you
#> restart R. To avoid this problem, change the default path to a
#> permanent folder on your computer. Add following lines to your
#> .Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
#> <- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
#> file. '~/ggOceanMapsLargeData' would make it in a writable folder on
#> most operating systems.
options(ggOceanMaps.userpath = "~/Downloads/gebco_2023/GEBCO_2023.nc")
basemap(limits = c(-80, -60,30, 50), bathy.style = "rub")
Created on 2023-11-30 with reprex v2.0.2
Could you paste sessionInfo()
, please?
sessionInfo() R version 4.2.3 (2023-03-15) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Ventura 13.2.1
Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] reprex_2.0.2 ggOceanMaps_2.1.13 ggplot2_3.4.4 oce_1.8-1 gsw_1.1-1
loaded via a namespace (and not attached):
[1] tidyselect_1.2.0 terra_1.7-55 xfun_0.40 sf_1.0-14 lattice_0.21-8
[6] colorspace_2.1-0 vctrs_0.6.4 generics_0.1.3 htmltools_0.5.6 stars_0.6-4
[11] s2_1.1.4 yaml_2.3.7 utf8_1.2.3 rlang_1.1.1 e1071_1.7-13
[16] pillar_1.9.0 glue_1.6.2 withr_2.5.2 DBI_1.1.3 sp_2.0-0
[21] wk_0.7.3 lifecycle_1.0.4 rgeos_0.6-4 munsell_0.5.0 gtable_0.3.4
[26] raster_3.6-23 smoothr_1.0.1 codetools_0.2-19 evaluate_0.21 labeling_0.4.3
[31] knitr_1.43 callr_3.7.3 fastmap_1.1.1 ps_1.7.5 parallel_4.2.3
[36] class_7.3-22 fansi_1.0.5 Rcpp_1.0.11 clipr_0.8.0 KernSmooth_2.23-22
[41] scales_1.3.0 classInt_0.4-10 abind_1.4-5 fs_1.6.3 farver_2.1.1
[46] digest_0.6.33 processx_3.8.2 dplyr_1.1.2 grid_4.2.3 rgdal_1.6-7
[51] cli_3.6.1 tools_4.2.3 magrittr_2.0.3 proxy_0.4-27 tibble_3.2.1
[56] pkgconfig_2.0.3 rmarkdown_2.24 rstudioapi_0.15.0 R6_2.5.1 units_0.8-3
[61] compiler_4.2.3
Hmm...the important packages seem up to date. The last straw, what do you get from sf::sf_extSoftVersion()
sf::sf_extSoftVersion() GEOS GDAL proj.4 GDAL_with_GEOS USE_PROJ_H PROJ "3.10.2" "3.4.2" "8.2.1" "false" "true" "8.2.1"
I have PROJ 9.1, GDAL 3.5 and GEOS 3.11. If nothing else helps, you may try updating those (search on web how). You did download the NetCDF file from here, right, as instructed here: https://mikkovihtakari.github.io/ggOceanMaps/articles/new-features.html#new-bathymetry-system?
Does basemap(limits = c(-80, -60,30, 50), bathy.style = "rcb")
work?
Except that you forgot library(ggOceanMaps)
from reprex::reprex()
, but good news if that works. I am sorry that I do not have better ideas at the moment. I can test on another machine later this week or the next and see whether I manage to reproduce the issue. I bet you are the first who tries this feature apart from me, so a bug somewhere is well possible. Weird that it works on my machine, though.
Thank you! I will try uploading those and see what happens.. but yes using bathy.style = "rcb" works just fine for me. It plots it fine but I get this error when I try to use reprex which is probably just an issue on my end not knowing how to properly use reprex:
reprex() ✖ Install the styler package in order to use
style = TRUE
. ℹ Rendering reprex... Error in parse(text = x, keep.source = TRUE) ::5:7: unexpected '/' 4: 5: https:/ ^
No worries! I really appreciate the help. It's so weird that it works just fine on your machine and not on mine..I'll be curious to hear what happens if you have the chance to run it on another machine and I will also keep you posted on what happens when I update to PROJ 9.1, GDAL 3.5 and GEOS 3.11. Thank you so much!
Not sure if this provides any clues but I ran
basemap(limits = c(-80, -60,30, 50), bathy.style = "rcb")
and I got the plot in the "plot pane" just fine, but then when I do reprex, I get this:
library(ggOceanMaps)
#> Loading required package: ggplot2
#> ggOceanMaps: Setting data download folder to a temporary folder
#> /var/folders/hw/3m77_44925j0dvws649y30fm0000gn/T//RtmpinwSv0. This
#> means that any downloaded map data need to be downloaded again when you
#> restart R. To avoid this problem, change the default path to a
#> permanent folder on your computer. Add following lines to your
#> .Rprofile file: {.ggOceanMapsenv <- new.env(); .ggOceanMapsenv$datapath
#> <- 'YourCustomPath'}. You can use usethis::edit_r_profile() to edit the
#> file. '~/ggOceanMapsLargeData' would make it in a writable folder on
#> most operating systems.
basemap(limits = c(-80, -60,30, 50), bathy.style = "rcb")
#> Cannot find files:
#> /var/folders/hw/3m77_44925j0dvws649y30fm0000gn/T//RtmpinwSv0/dd_rbathy_cont.rda.
#> Do you want download them now?
#> Error in utils::menu(c("Yes", "No"), ""): menu() cannot be used non-interactively
Created on 2023-11-30 with reprex v2.0.2
Great news!!! I am a slacker on my computer and R updates. I was using an older version of R and now that it is updated, the code works perfectly and I get the expected result:
Thank you so much for the assistance.
I am trying to make a map with high resolution bathymetry using the GEBCO_2023.nc file. I unzipped the GEBCO download in my Downloads folder
set options
options(ggOceanMaps.userpath = "~/Downloads/gebco_2023/GEBCO_2023.nc")
check to make sure options are set
make map
basemap(limits = c(-80, -60,30, 50), bathy.style = "rub")
map does not have bathymetry on it – just the coastline. Clearly I'm missing something! Thanks for any help.