将栅格从投影坐标系转换为地理坐标系时最小化数据丢失的最佳方法

Best approach to minimize data loss when converting raster from projected to geographic coordinate system

我在 PCS 中有一个大约 1° 分辨率的全球光栅文件(范围是 90 到 -60 度纬度和 180 到 -180 度经度),我想以 2° 分辨率转换为 GCS,但目前的方法我使用的导致数据失真。原始栅格包含分类值,但同样的问题将适用于连续值。我想知道是否有更好的方法来做到这一点。

#create raster in PCS - CEA projection
x <- raster(ncol=360, nrow=142, xmn=-17367529, xmx=17367529, ymn=-6356742, ymx=7348382)
projection(x) <- "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0"
values(x)=runif(51120, 1, 99)
# my target raster format
y <- raster(ncol=180, nrow=75, xmn=-180, xmx=180, ymn=-60, ymx=90)
projection(y) <- "+proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,0,0"
values(y)=runif(13500, 1, 99)
#downscale to match my target raster resolution
x2deg=raster::aggregate(x,fact=2)
#when I try to project I get the first error
x2deg.gcs = projectRaster(x2deg, y)

Error in if (maxy == miny) { : missing value where TRUE/FALSE needed In addition: Warning message: In rgdal::rawTransform(projfrom, projto, nrow(xy), xy[, 1], xy[, : 48 projected point(s) not finite

#So I slightly cut the extent and get the desired result
extent(x2deg) <- c(xmin= -17367529, xmax= 17367529, ymin= 0.999*(-6356742), ymax= .999*(7348382))
x2deg.gcs = projectRaster(x2deg, y)

我是否应该使用不同的因子缩小栅格中的 ncol 和 nrows x?我知道我必须做一些不均匀的插值才能从 142 行到 75 行,但是例如 aggregate 不在参数 frac 中取分数。也许还有另一个包可以更好地处理这个问题,例如 rgdal?

这与 terra

配合使用效果更好
library(terra)
x <- rast(ncol=360, nrow=142, xmin=-17367529, xmax=17367529, ymin=-6356742, ymax=7348382)
crs(x) <- "+proj=cea +lon_0=0 +lat_ts=30 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"
values(x) <- 1:ncell(x)

y <- rast(ncol=180, nrow=75, xmin=-180, xmax=180, ymin=-60, ymax=90)
crs(y) <- "+proj=longlat +datum=WGS84"

p <- project(x, y)