'nrow limit when creating a raster using terra function rast
I'm trying to create a raster using the following data frame (without NAs), with the latitude, longitude and values extracted from a HDF4 file generated by SeaDAS:
> dim(df)
[1] 10538622 3
> head(df)
x y z
1 -61.38239 -30.91730 -0.015534
2 -61.38239 -30.91730 -0.015534
3 -61.38239 -30.91730 -0.015534
4 -61.38239 -30.91730 -0.015534
5 -61.37815 -30.91839 -0.015534
6 -61.37815 -30.91839 -0.015534
but I get the following error:
> ras = rast(df, type = "xyz", crs = prj, digits = 6)
Error in matrix(NA, nrow = ncell(r), ncol = nlyr(r)) :
invalid 'nrow' value (too large or NA)
In addition: Warning message:
In matrix(NA, nrow = ncell(r), ncol = nlyr(r)) :
NAs introduced by coercion to integer range
I already tried to reduce the size of the data frame using a bounding box, but even with only 23530 points I still get same error. There are a few points very close to each other (hence the identical points 1, 2, 3 and 4 in the df) and the grid is probably not regular. What could be the issue here?
Thanks, Matheus
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
