3

I have several hundred raster files (NDVI) of the same area dating back to the 1980’s, as well as daily rainfall observations from a nearby weather-station over the same period. The raster files are in the same folder and named by date, YYYY-MM-DD (I can re-name these if it will simplify things). I want to look at the relationship between rainfall and change in vegetation index over time at various points in that landscape using R, but I don’t know how to process the data efficiently.

Ideally the raster files could all be called from a single object, like a rasterstack, in which was also recorded the year and Julian day number (ie 1 to 365/6) for each image. I could then extract information from rasters from specific time periods or from the whole series, and / or relate change in vegetation index to specific rainfall events (which data I already have in Julian day and year in a data frame).

I can bring the raster files into R, named as they are in the original folder and stored in a list object, from which I can then make a rasterstack, but this doesn’t attribute them a date. Can I append a RAT to each raster when it is processed into the list, and automatically add year and Julian day attributes?

Can anyone suggest appropriate structures / functions to perform these tasks?

  • Any reason you can't store the raster file names as the list object names and query the list using yourlist["dateString"]? – JMT2080AD Aug 9 '16 at 0:05
  • Thanks. I could do that. But in the end I think I'll have to make large RasterBrick and convert the names (which are dates) of each to a date with as.Date( ). I can then extract data, and in the resulting data frames convert those dates to Julian days, or days since an origin. I could then look at the relationship between rain events in one data frame and VI in another if both frames work on the same dating system. Cumbersome but should work. – Daniel Aug 10 '16 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.