Re-projecting raster in R: gives warning that projected point(s) not finite?
Short answer: it's fine, and you can thank raster
for proceeding to completion instead of failure, and for letting you know that some data were lost.
Long answer:
it will depend on the projection, and in this case it's probably just on the "the edges". what the edge is and how it manifests for a given instance of a given projection family is the "depends" part.
You can see that it's not the centre points of the cells that are lost:
tpoints <- rgdal::project(coordinates(rastertest.longlat), "+proj=eck4")
sum(is.na(tpoints))
#[1] 0
But it probably is the corners, and possibly the edges of very cell. This perhaps shows that raster projects based on the extent of cells, not just their centre points.
rgdal::project(as.matrix(expand.grid(x = c(-180, 0, 180), y = c(-90,0, 90))), "+proj=eck4")
I admit I expected that to be where the missing values come from, so maybe projectRaster
is extending out a little further north and south? Set values there for latitude outside the -90/90 range and you start getting the warning. I'll follow up if I get a chance to explore more.
Finally, you should probably use an explicit ellipsoid or datum parameter, i.e. "+proj=eck4 +ellps=WGS84".
This is not a full answer to my original question, in terms of all the gritty details, but it does provide the interested reader somewhere to go.
In general data is lost and distorted during reprojection of rasters from longlat to equal area projections. This can be problematic for global analysis. If you can get your data in vector format, it is better to reproject using that format instead.
Here is one reference on the general problem. And here another on trying to quantify the loss. Hope that helps.