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