I am masking and cropping a rasterstack to a shapefile I made. I have done this previously with another shapefile, this is no problems. However, when I do this with this specific shapefile I get the following error
Error in compareRaster(x) : different extent
I don't fully understand this because I'm comparing a raster to a shapefile and not two rasters. In addition all rasters in the rasterstack have the same extent and I'm masking them to the same shapefile. Finally, I can do the first 8 or so rasters in the raster stack manually, but when I set my loop to the first item, I get the above error. Can someone tell me what is going on?
My code:
praccirc = stack()
for (i in 1:1){
maskraster = raster::mask(pracstack[[i]], delcirc)
maskraster = raster::crop(maskraster,delcirc)
praccirc= stack(janpmdelhi,maskraster)
}
**Error in compareRaster(x) : different extent**
#This works for raster 1 of the raster stack
pracras1 = pracstack[[1]]
pracras1mask = raster::mask(pracras1, delcirc)
pracras1mask = raster::crop(pracras1mask, delcirc)
#additionally this for loop works with this shapefile
pracdel=stack()
for (i in 1:nlayers(pracstack)){
maskraster = raster::mask(pracstack[[i]], delshp)
maskraster = raster::crop(maskraster,delshp)
pracdel= stack(janpmdelhi,maskraster)
}
The Datasets and shapefiles can be found here