TransWikia.com

Plotting Bare Soil Line on landsat data in RStudio?

Geographic Information Systems Asked by Waseem Ali on November 9, 2021

I am using RStudio with landsat package for computing and plotting the Bare Soil Line (BSL) on landsat tif image running on my HP Pavilion i7 laptop. The codes for running the BSL() function is as under:

b3 <- as.data.frame(raster("LT51500371993170ISP00_B3.TIF", na.rm=TRUE))
b4 <- as.data.frame(raster("LT51500371993170ISP00_B4.TIF", na.rm=TRUE))

bsl.1993 <- BSL(b3, b4, "quantile", ulimit=0.99, llimit=0.005)

I have received the error message when I write the code without na.rm=TRUE as by default argument is FALSE for na.rm. After using na.rm=TRUE I received the same message as under. But one thing I want to mention here although my system is 64 bit machine with 8GB RAM and running R-studio 32 bit version when I execute the code for whole tile of landsat RAM reaches up to approximatively 7GB, it gives the message to running the memory low message after 5 minutes of the execution then the same message appeared the second time as under:

Error in quantile.default(ratio43, llimit) : 
 missing values and NaN's not allowed if 'na.rm' is FALSE

Please suggest me the solution to solve this matter and how do I improve the low memory. I have also running the linux machine on VMware Workstation.

One Answer

You need to scale your data between for values 0-255. The BSL function is adapted to work with Landsat data, which is scaled for these values. Not sure if this is helpful to you or not, just apply this scale function to your images and let me know what results you get.

function(x, x.min = old.min, x.max = old.max, new.min = 0, new.max = 255) {
if(is.null(x.min)) x.min = min(x)
if(is.null(x.max)) x.max = max(x)
new.min + (x - x.min) * ((new.max - new.min) / (x.max - x.min))}

Answered by Afana A on November 9, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP