You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used topCor() on 62 stack of TOA Band 5 Landsat 8 image and I provided 62 MTL files which are sort to match the order of 62 stack of TOA Band 5.
But 32 output files of corrected TOA Band 5 are out of range (ie: reflectance value between -134.381 to 203.657. I did the same topCor () for TOA Band 4 Landsat 8 and the 62 output files seem to be in correct reflectance range. Can anyone tell me what when wrong? Advice are very much appreciated. Thanks
My codes are as follows:
dem_kam <-raster("E:/R/DEM/Kam_DEMslopeAspct_rad.tif")
#path to directory with folders
path1 <- "E:/R/C_crrctn/kam_c_crrctn/B5_tif/"
path2 <- "E:/R/C_crrctn/kam_c_crrctn/MTL/"
path3 <- "E:/R/C_crrctn/kam_c_crrctn/B5_C/"
#get file names using list.files() function
toa_stack <-list.files(path1, pattern=".tif$",full.names=T)
#print(path2)
mtl_stack <-list.files(path2,pattern =".txt$",full.names =T)
#Loop over every stack in filelist
for(i in 1:length(toa_stack)) {
print(i)
#stack image i
img <- raster(toa_stack[i])
mtl <- file.path(mtl_stack[i])
print(img)
print(mtl)
#calc corrected B5 for image i
B5_C <- topCor(img, dem = dem_kam, metaData = mtl, method = "C")
I used topCor() on 62 stack of TOA Band 5 Landsat 8 image and I provided 62 MTL files which are sort to match the order of 62 stack of TOA Band 5.
But 32 output files of corrected TOA Band 5 are out of range (ie: reflectance value between -134.381 to 203.657. I did the same topCor () for TOA Band 4 Landsat 8 and the 62 output files seem to be in correct reflectance range. Can anyone tell me what when wrong? Advice are very much appreciated. Thanks
My codes are as follows:
dem_kam <-raster("E:/R/DEM/Kam_DEMslopeAspct_rad.tif")
#path to directory with folders
path1 <- "E:/R/C_crrctn/kam_c_crrctn/B5_tif/"
path2 <- "E:/R/C_crrctn/kam_c_crrctn/MTL/"
path3 <- "E:/R/C_crrctn/kam_c_crrctn/B5_C/"
#get file names using list.files() function
toa_stack <-list.files(path1, pattern=".tif$",full.names=T)
#print(path2)
mtl_stack <-list.files(path2,pattern =".txt$",full.names =T)
#Loop over every stack in filelist
for(i in 1:length(toa_stack)) {
print(i)
#stack image i
img <- raster(toa_stack[i])
mtl <- file.path(mtl_stack[i])
print(img)
print(mtl)
#calc corrected B5 for image i
B5_C <- topCor(img, dem = dem_kam, metaData = mtl, method = "C")
#export raster
writeRaster(B5_C, file.path(path3,names(img)), format="GTiff",
bylayer=TRUE, overwrite=T)
}
The text was updated successfully, but these errors were encountered: