Closed bidur closed 6 years ago
Hi Bidur,
Thanks for posting this. It makes sense to have the option of specifying a threshold. I need to find out what the best practice is for dealing with high radiance values. If you do find any literature on this please post it here.
First, I believe there are 2 types of errors with the nightlight rasters:
Concerning adding a threshold parameter to getCtryNlData
. As mentioned in our online discussion earlier getCtryNlData()
has the parameter nlStats
which takes a list of functions to perform on the radiances. It is possible to write your own function that will be calculated on the raster. Any function that accepts a vector as input and returns a scalar will work. In this case, thresholded sums of radiances could be obtained by writing a wrapper around the sum function for example:
mySum <- function(x)
{
#OLS valid range = 0 .. 254
#VIIRS valid range = 0 .. 65535
thresh <- 10000
threshX <- x[x < thresh]
#data may contain NAs, handle accordingly
sumThreshX <- sum(threshX, na.rm=TRUE)
return(sumThreshX)
}
Then you can call getCtryNlData()
with this function like so:
ctryNlData <- getCtryNlData(other parameters, nlStats=mySum)
The output data.frame ctryNlData
will have a column with the uppercase name of your function appended e.g. VIIRS_SLK_201401_MYSUM
Still, if required we will add this option to the function.
A way to specify the threshold value while calling the getCtryNlData() function seems helpful.
The VIIRS DNB monthly data that we get from ngdc.noaa.gov still contain errors ( e.g. lights from fire, boats or aurora). Applying thresholding can filter such errors. Users will be able to ignore some radiance values whenever necessary e.g. for example sometimes very high radiance values may occur in the Nightlight Image due to error.
Thank You.