Hi Robert,

Thanks for the response. I have done a bit more reading but am still struggling to understand: if I set the datum (NAD83) and the resolution of the NDVI data to match that of the prism data is that not sufficient for compatible projections? Does the datum not provide the origin? The extent is what I am now trying to adjust (e.g. the NDVI data is for all of North America, the PRISM data is for the US only). Or do you mean something else by extent?
 
The prism data has a prj file that reads: 

GEOGCS["NAD83",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

Thanks again for the help!

Julie

 



On Tuesday, January 14, 2014 8:11:01 PM, Robert J. Hijmans <r.hijmans@gmail.com> wrote:
 
Julie,
You raise an important question that is often overlooked. While it is
possible to use resample as you suggest; you would want to avoid it
because it leads to loss of data quality (although in practice this is
often minimal and irrelevant).

You state that you "project it to the same geographic coordinate
system as PRISM precip. data". But that is an incomplete statement for
raster data. What you need to do is to project the NDVI data to the
raster definition used by PRISM. That includes the coordinate system,
but also the origin (or extent) and resolution of that raster. I do
not think MRT supports setting these parameters; in which case you
should not use it. You can use GDAL instead. On Linux this can be done
with rgdal; on windows you can use FWTools instead, or perhaps the new
gdalUtils package?

Robert

On Mon, Jan 13, 2014 at 3:39 PM, Julie Lee-Yaw <julleeyaw@yahoo.ca> wrote:
> Hi
>
> Using a combination of the scripts provided here (by Babak N.): http://r-gis.net/?q=ModisDownload and the MODIS reproject tool, I've finally managed to download NDVI data for North America and project it to the same geographic coordinate system as PRISM precip. data (e.g. http://www.prism.oregonstate.edu) for the same time period.
>
> I now want to stack these two rasters. My NDVI layer has a greater extent than the PRISM layer so I crop the former by the latter using:
>
> croppedNDVI<-crop(NDVI,prism)
>
>
> But when I look at the resulting raster, I see that the extent still doesn't line up. I think this is an issue with cells of the two rasters being "off" centre from each other. I can use the following to get them to align:
>
> adjustNDVI<-resample(croppedNDVI,prism)
>
>
> Now I can stack the "adjustNDVI" and "prism" layers as the extents match. But I am wondering whether this is valid? Why were the initial rasters misaligned in the first place given that I specified the same resolution and geographic coordinate system/datum when I processed the MODIS file? I'm grateful for any clarification!
>         [[alternative HTML version deleted]]
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
	[[alternative HTML version deleted]]

