rOpenGov / fmi

Finnish Meteorological Institute open data API R client
Other
10 stars 7 forks source link

segfault in tutorial raster example #3

Closed javalia closed 8 years ago

javalia commented 9 years ago

I tried to run the raster example presented in tutorial on my R-3.1.2-1.fc20.x86_64 and run into seqfault Here is the output:

library(fmi) Loading required package: R6 fmi - R Tools for Finnish Meteorological Institute Open Data. Copyright (C) 2014 Jussi Jousimo et al.

https://ropengov.github.com/fmi

library(raster) request <- FMIWFSRequest$new(apiKey=apiKey) request$setParameters(request="getFeature",

ogr2ogr -f GML -splitlistfields /tmp/Rtmp2lOIWF/filecbea5e2116 /tmp/Rtmp2lOIWF/filecbe6b36a40d GridSeriesObservation Warning 1: Field name 'validTime|TimePeriod|beginPosition' adjusted to 'validTime_TimePeriod_beginPosition' to be a valid XML element name. Warning 1: Field name 'validTime|TimePeriod|endPosition' adjusted to 'validTime_TimePeriod_endPosition' to be a valid XML element name. Warning 1: Field name 'parameter|NamedValue|value|TimeInstant|timePosition' adjusted to 'parameter_NamedValue_value_TimeInstant_timePosition' to be a valid XML element name. OGR data source with driver: GML Source: "/tmp/Rtmp2lOIWF/filecbea5e2116", layer: "GridSeriesObservation" with 1 features and 16 fields Feature type: wkbPoint with 2 dimensions trying URL 'http://data.fmi.fi/fmi-apikey/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/download?producer=monthly&param=MonthlyMeanTemperature,MonthlyPrecipitation&bbox=15.9689043139365,59.6117693413028,33.0613124198255,70.0798784441389&origintime=1961-01-01T00:00:00Z&starttime=2012-01-01T00:00:00Z&endtime=2012-01-01T00:00:00Z&format=grib2&projection=epsg:4326' Content type 'application/octet-stream' length unknown opened URL .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .......... .. downloaded 5.0 Mb

rgdal: version: 0.9-1, (SVN revision 518) Geospatial Data Abstraction Library extensions to R successfully loaded Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26 Path to GDAL shared files: /usr/share/gdal Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480] Path to PROJ.4 shared files: (autodetected)

* caught segfault * address 0xd, cause 'memory not mapped'

Traceback: 1: .Call("RGDAL_OpenDataset", normalizePath(filename, mustWork = FALSE), TRUE, silent, PACKAGE = "rgdal") 2: .local(.Object, ...) 3: initialize(value, ...) 4: initialize(value, ...) 5: new("GDALReadOnlyDataset", filename, silent = silent) 6: GDAL.open(fname, silent = silent) 7: rgdal::GDALinfo(filename, silent = silent, returnRAT = RAT, returnCategoryNames = RAT) 8: doTryCatch(return(expr), name, parentenv, handler) 9: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10: tryCatchList(expr, classes, parentenv, handlers) 11: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 12: try(rgdal::GDALinfo(filename, silent = silent, returnRAT = RAT, returnCategoryNames = RAT)) 13: .rasterFromGDAL(x, band = band, objecttype, ...) 14: doTryCatch(return(expr), name, parentenv, handler) 15: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 16: tryCatchList(expr, classes, parentenv, handlers) 17: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call)[1L] prefix <- paste("Error in", dcall, ": ") LONG <- 75L msg <- conditionMessage(e) sm <- strsplit(msg, "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && identical(getOption("show.error.messages"), TRUE)) { cat(msg, file = stderr()) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 18: try(r <- .rasterFromGDAL(x, band = band, objecttype, ...), silent = silent) 19: .rasterObjectFromFile(x, objecttype = "RasterBrick", ...) 20: raster::brick(destFile) 21: raster::brick(destFile) 22: private$importRaster(destFile) 23: client$getRaster(parameters = list(splitListFields = TRUE))

Possible actions: 1: abort (with core dump, if enabled) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection:

statguy commented 9 years ago

It appears to be a problem in rgdal or in some other library. Maybe you could contact the rgdal maintainer directly. See the contact details here: http://cran.r-project.org/web/packages/rgdal/index.html.

esaostring commented 9 years ago

Hi!

I do not know if you were able to solve this already, but I am facing exactly the same problem. GDAL is somehow broken, when it comes to handling grib2 -format files. Try getting your data in grib1 -format, and you might have better luck. I am running up-to-date Fedora 21 and 20, and grib2 fails in both of them. At least in Fedora 20, grib1 format is better supported.

[computer]$ gdalinfo input/ennuste.grib | head
Driver: GRIB/GRIdded Binary (.grb)
Files: input/ennuste.grib
Size is 187, 155
Coordinate System is:
GEOGCS["Coordinate System imported from GRIB file",
    DATUM["unknown",
        SPHEROID["Sphere",6367470,0]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433]]
Origin = (19.046997311827955,70.176016233766234)

[computer]$ gdalinfo input/ennuste.grib2 
Segmentation fault (core dumped)
statguy commented 9 years ago

@esaostring what is your GDAL version? Have you tried the latest?

esaostring commented 9 years ago

@statguy my GDAL versions, resulting core dump: First, Fedora 20, up-to-date, causing core dump: Second: OpenSuSE 13.1, (maybe) not up-to-date (I'm afraid to update it due to GDAL problems), working Third: CentOS7, up-to-date, causing core dump:

[Fedora 20]$ gdalinfo --version
GDAL 1.10.1, released 2013/08/26
[Fedora 20]$ gdalinfo input/ennuste.grib2 
Segmentation fault (core dumped)

[OpenSuSE 13.1]> gdalinfo --version
GDAL 1.10.1, released 2013/08/26
[OpenSuSE 13.1]> gdalinfo input/ennuste.grib2
Driver: GRIB/GRIdded Binary (.grb)
Files: input/ennuste.grib2
Size is 187, 155
Coordinate System is:
GEOGCS["Coordinate System imported from GRIB file",
[...]

[CentOS7]$ gdalinfo --version
GDAL 1.11.1, released 2014/09/24
[CentOS7]$ gdalinfo input/ennuste.grib2 
Segmentation fault

There is also a Fedora 21 installation (up to date), with gdal version 1.11.2, and that core dumps also.

By latest you mean 2.0 something, or that latest update found in distributions 1.11.2?

I would not totally blame gdal, but some related libraries perhaps, since OpenSuSE (works) and Fedora 20 (fails) have the same gdal version number.

statguy commented 9 years ago

Are you familiar with the Linux debugging tools, or want to read some tutorial? You may try to find where it segfaults. Anyway, as you seem to have the latest 1.*, you may also report the problem to GDAL maintainer.

esaostring commented 9 years ago

Yes, somewhat familiar. I might proceed with the bug report early next week. Thanks.

statguy commented 9 years ago

Ok thank you. Please keep us updated :)

esaostring commented 9 years ago

Bug reported.

jlehtoma commented 8 years ago

Problem seemed to be Fedora-specific and potentially fixed now, closing this issue.