Reputation: 19
I am using the following MODIS DSR 1km product to do some analysis: MCD18A1.A2001001.h15v05.061.2020097222704.hdf
However, I am having trouble converting from SpatialGridDataFrame to Raster, since the pixel size changes...
Here is my script:
Filename <- "ModisProductsOriginal/MCD18A1.A2001001.h15v05.061.2020097222704.hdf"
SDSs <- getSds(Filename)
GMT_1200_DSR_sgdf <- readGDAL(SDSs$SDS4gdal[8], as.is = TRUE)
GMT_1200_DSR_rast <- raster(GMT_1200_DSR_sgdf)
Here are the Warnings:
1: In getProjectionRef(x, OVERRIDE_PROJ_DATUM_WITH_TOWGS84 = OVERRIDE_PROJ_DATUM_WITH_TOWGS84, : Discarded datum Not specified (based on Clarke 1866 spheroid) in Proj4 definition: +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +ellps=clrk66 +units=m +no_defs
2: In showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj = prefer_proj) : Discarded datum Unknown based on Clarke 1866 ellipsoid in Proj4 definition
And here are the results:
I can't find the solution to this problem and I would like to know if this is supposed to happen, if not how can I solve it? Specifying the CRS? When using sinusoidal projection ("+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs") only warnings appear, maybe I am not using the CRS correctly.
Upvotes: 0
Views: 127
Reputation: 47061
What makes you say that pixel size changes? I only see warnings about the CRS. The warning is because the newer versions of the PROJ library do not like PROJ strings that have a datum that is not WGS84.
HDFs with sub-datasets are much easier to handle with terra
.
library(terra)
f <- "ModisProductsOriginal/MCD18A1.A2001001.h15v05.061.2020097222704.hdf"
s <- sds(f)
s8 <- s[8]
# or
r <- rast(f)
Upvotes: 0