Rafnuss / GeoPressureR

Global positioning by atmospheric pressure
https://raphaelnussbaumer.com/GeoPressureR
GNU General Public License v3.0
7 stars 1 forks source link

Error reading geotiff from url with raster::brick() on ubuntu #9

Closed Rafnuss closed 2 years ago

Rafnuss commented 2 years ago

Running a simple request of geopressure_map on a ubuntu machine returns the following error:

Generate requests:

Requests generated successfully for 1 stationary periods (1, )

Send requests:

[==================================================] 1 / 1 
Download geotiff:

[                                                  ] 0 / 1 
Error in .rasterObjectFromFile(x, objecttype = "RasterBrick", ...): Cannot create a RasterLayer object from this file. (file does not exist)
Traceback:

1. geopressure_map(pressure, extent)
2. future::value(f[[i_u]])
3. value.Future(f[[i_u]])
4. signalConditions(future, exclude = getOption("future.relay.immediate", 
 .     "immediateCondition"), resignal = TRUE)

This error comes from reading the line: https://github.com/Rafnuss/GeoPressureR/blob/29dc1e76604d962beab374b1158d298dbde1ce7a/R/geopressure.R#L182

If I run it separately i get more information on the error:

Error in .local(.Object, ...): An error occurred while creating a virtual connection to the DAP server:
Error while reading the URL: https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/772ae2eefc3bebadd6131ff354c024cb-ea5496300e42cb031021bb837f34f37d:getPixels.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.

Traceback:

1. GDALinfo(uris[i_u])
2. GDAL.open(fname, silent = silent, allowedDrivers = allowedDrivers, 
 .     options = options)
3. new("GDALReadOnlyDataset", filename, silent = silent, allowedDrivers = allowedDrivers, 
 .     options = options)
4. initialize(value, ...)
5. initialize(value, ...)
6. .local(.Object, ...)

I couldn't find a good solution, it seems to come from the driver dods. See https://trac.osgeo.org/gdal/ticket/2696. I have tried to set Sys.setenv(GDAL_SKIP="DODS") but this wouldn't work.

Rafnuss commented 2 years ago

Only solution found was to manually download the file and then read it. https://github.com/Rafnuss/GeoPressureR/blob/d7c6e918dca60694027332dfe5b5ef232e8fbb6b/R/geopressure.R#L182-L184