3

i have some working code that, all of a sudden, shows a lot of warning messages (which it didn't do before). they do not hinder the execution of the code but are very annoying. i have around 2000 tif's i want to convert to rasters. to do so i load them into a list like so:

tif_list<-list.files(pattern = "*.tif$")
tif_list<-lapply(tif_list, raster) 

the first thing i tried was the rgdal suggestion of

options("rgdal_show_exportToProj4_warnings"="none") # using it before loading the library as rgdal suggests
library(rgdal)

this didn't work so next i've tried global disabeling of warnings with options(warn=-1) this also didn't help.

next i tired suppressWarnings(lapply(tif_list, raster)) but again no luck. in a bit of desperation i tried to set all rgdal warnings to false:

set_thin_PROJ6_warnings(FALSE)
set_rgdal_show_exportToProj4_warnings(FALSE)

which of course did not do anything.

i also tried to do set warnings invisible

invisible(capture.output(lapply(tif_list, raster))) # although just not outputting them would be better 

this also didn't do anything and i am running out of ideas.

on a quick side note, 2 things. when i subset the list to less than 4-5 tifs to be converted the warnings don't show. also up to 40 tifs the warnings only show up every 2nd time i run the code.

the warnings look like this:

proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found
proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found
proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found
proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found
proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found
proj_create_from_database: datum not found
proj_create_from_database: ellipsoid not found
proj_create_from_database: prime meridian not found

ps:

i also updated to the last rgdal version 1.5-16

D.J
  • 1,180
  • 1
  • 8
  • 17
  • 1
    I have the same issue. I tried all the proposed suggestions. It is irritating because all previous lines of code are overwritten by the >1000 error messages. – user3386170 Sep 05 '22 at 23:53
  • @user3386170 sorry to say, i never found a way to solve this. since it doesn't actually stop the code from completing it is just really annoying, not catastrophic. would still be happy to learn how to deal with this though! – D.J Sep 06 '22 at 05:29

1 Answers1

1

This is a temporary solution but uninstall/reinstalling rgdal does the trick.

There must be a ceiling on the number of times you can run whatever command produces the warning before it turns into an error, maybe it's on their GitHub page.

  • very nice! back when i was working on this i dug deep into the documentation but it has been 2 years since so it is entirely possible some new info exists. glad you found a solution (if only a temporary one) – D.J Sep 21 '22 at 06:05