maxPtsNeighborDistToHalfThresh: Function to test the use of rowcols and lonlats in...

Description Usage Arguments Details Examples

View source: R/vignette.R

Description

Function to test the use of rowcols and lonlats in getCtryNlData as input to the nlStats parameter.

Usage

1
2
3
4
5
6
7
8
9
maxPtsNeighborDistToHalfThresh(
  col,
  row,
  lon,
  lat,
  val,
  numPts = 3,
  enablePlot = FALSE
)

Arguments

col

character parameter to tell the package to pass in the colrow values i.e. column and row indices as per the country polygon

row

character parameter to tell the package to pass in the colrow values i.e. column and row indices of non-NA pixels as per the country polygon

lon

character parameter to tell the package to pass in the lonlat values i.e. column and row indices of non-NA pixels as per the country polygon

lat

character parameter to tell the package to pass in the lonlat values i.e. column and row indices of non-NA pixels as per the country polygon

val

character variable which will hold the raster values found in in the raster

numPts

integer The number of top pixels to detect

enablePlot

logical Plot each stage of the iteration showing the pixels surrounding the top pixel as we move farther out till the target pixel is found. Output will be in PDF format.

Details

The function gets the top numPts brightest pixels in a sub-polygon or zone and looks at increasing neighbouring distances looking for the distance to the first pixel that is 1/2 the value of the central pixel.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
pkgReset();
  system.time(rastGFT92 <-  getCtryNlData(ctryCode = "NGA",
     admLevel = "lowest", nlTypes = "OLS.Y", nlPeriods = "1992",
     removeGasFlaresMethod = "OGP", ignoreMissing=FALSE, 
     nlStats = list("maxPtsNeighborDistToHalfThresh", 
     list(numPts=1, enablePlot=TRUE))))

  pkgOptions(extractMethod="gdal",cropMaskMethod="gdal");
  system.time(gdalGFT92 <-  getCtryNlData(ctryCode = "NGA",
      admLevel = "lowest", nlTypes = "OLS.Y", nlPeriods = "1992",
      removeGasFlaresMethod = "OGP", ignoreMissing=FALSE,
      nlStats = list("maxPtsNeighborDistToHalfThresh", 
      list(numPts=1, enablePlot=TRUE))))

## End(Not run)

chrisvwn/Rnightlights documentation built on Sept. 7, 2021, 1:44 a.m.