Saturday, 11 April 2015

Relative Radiometric Normalization of multisensor Landsat Level 2 images using R


For my time series analysis, i need to use images of the three Landsat sensors (TM, ETM+ and OLI). I chose the already atmospheric corrected surface reflectance/Level-2 products. Due to the radiometric differences between the sensors, i still have to normalize them (i think) as a pre-processing step.


When i wanted to do this in R using a regression method via the relnorm-Function (landsat-package), i got the following Error Code despite the images having exactly the same values for dimensions and extent:


Error in array(x, c(length(x), 1L), if (!is.null(names(x))) list(names(x),  : 
length of 'dimnames' [1] not equal to array extent


I use the following code to clip and normalize identical bands of the TM-product of different dates. The images don't contain any clouds, thus no mask is used:


library(landsat)
library(lmodel2)
library(RStoolbox)
library(raster)

ma <- raster("D:/Working_Directory/LT05_L1TP_144051_20041216_20161127_01_T1_sr_band1.tif")

to <- raster("D:/Working_Directory/LE07_L1TP_144051_19991109_20170216_01_T1_sr_band1.tif")


shp <- readOGR("D:/Working_Directory/transect.shp")

#Clipping both bands:
clipped_ma <- crop(ma, extent(shp))
clipped_ma <- mask(clipped_ma, shp)
clipped_to <- crop(to, extent(shp))
clipped_to <- mask(clipped_to, shp)

#Trying to use the relnorm-function (no mask, OLS-method):
normalized <- relnorm(master=clipped_ma, tofix=clipped_to, method = "OLS", nperm = 0)


What is wrong with the code or the data(-format), that is causing the aforementioned Error?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...