6

I have a large number of MODIS snow rasters which I am cropping with the extent of a shapefile. Currently, I am using spTransform so that my shapefile has the same CRS as the rasters.

This code works perfectly, it returns a new raster with the extent of the shapefile. My question is: is there any reason to avoid this sinusoidal projection? Mathematically, it should preserve area better than another projection. Are there any disadvantages?

Here is my code, for reference.

prj.aea="+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs"

##Import shapefile with WGS84 projection
dsn=getwd() # assumes current dir is folder with shapefile(s) to import
ut.mgmt1=readOGR(dsn=dsn,layer=paste(GEO,sep="")) 
GEO=spTransform(ut.mgmt1,CRS=CRS(prj.aea))

temp = list.files(pattern="*.tif",recursive=FALSE)
####THIS WRITES A NEW, SMALLER RASTER####
for(x in 1:length(temp)){
    r1 = raster(temp[x])
    test = mask(r1,GEO)
    writeRaster(test,file=temp[x],overwrite=TRUE)
}
0

1 Answer 1

8

I have done this with MODIS rasters without problem before, in sinusoidal, you are right, should retain the area over other projections. That being said that is barely and as long as you are chopping out the same area on both, and they are in the same modern style projection i.e. wgs84 or sinusoidal, it shouldn't matter all that much.

If you are extracting the raster values check out the velox package which does the raster extractions through a c programmed package in r, makes everything a heck of a lot faster. I imagine that is the intention.

You seem like the type of person who would enjoy this: enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.