Closed MxNl closed 3 years ago
Please never use pipes in examples (the first argument is not available for examination) , and at least provide the verbatim error message, and preferably the output of traceback() and sessionInfo() as well as the OS, GRASS version, etc. This should also be posted on https://lists.osgeo.org/mailman/listinfo/grass-stats, because a user may have seen this before. You do not show the size of reference_raster
either, so I have absolutely no idea. Reprex required.
I strongly suspect that reference_raster
is not held in memory, and that coercion to "SpatialGridDataFrame"
fails if it is too big, because it is then in memory, not external. If all *'raster** is being used for is to open a file, read the file directly into the newly created temporary location (but do set the GRASS region carefully). If the failure is before writeRAST()
is reached, the pipeline is a distraction.
Thanks for that quick reply. Finally, I could look into it today. So the error occurs at the conversion to "SpatialGridDataFrame" as you suspected correctly
as(reference_raster, "SpatialGridDataFrame")
Error:
Fehler in if (.NumberOfCells(object@grid) != nrow(object@data)) return("unequal number of objects in full grid and data slot") :
Fehlender Wert, wo TRUE/FALSE nötig ist
Zusätzlich: Warnmeldung:
In attributes(.Data) <- c(attributes(.Data), attrib) :
NAs introduced by coercion to integer range
subsequent traceback()
gives me
11: validityMethod(object)
10: isTRUE(x)
9: anyStrings(validityMethod(object))
8: validObject(.Object)
7: initialize(value, ...)
6: initialize(value, ...)
5: new("SpatialGridDataFrame", grid, data = data)
4: SpatialGridDataFrame(grd, proj4string = .getCRS(r), data = as.data.frame(from))
3: asMethod(object)
2: as(., "SpatialGridDataFrame")
1: reference_raster %>% as("SpatialGridDataFrame")
Should I better write the raster to disk and import it from there?
Thanks - please report the size of reference_raster
, that is rows and columns, its class, and whether integer or double. The error message is from sp, R/Class-SpatialGridDataFrame.R
line 17, and raster R/coerce.R
. Please report as(reference_raster, "GridTopology")
, and dim(reference_raster)
.
Hello,
I am using rgrass7_0.2-5 and standalone winGRASS 7.8.5-2 all installed in default directories with
I start GRASS with
Then I write sf LINESTRINGS and a raster into the GRASS GIS database.
This all works fine except for writing really large objects to GRASS. Currently, the object size of the raster seems to cause the following error as this is the only difference between two runs where one errors out and the other doesn't:
When I write a raster in 1km resolution with an extent of Europe it doesn't crash. When I write it in 100m resolution the error occurs.
Do have any clue what could cause this or how I can prevent that? Thanks a lot!